Run ts6_banners with the TeamSpeak 6 server to itself
The engine stage of the live smoke failed in every run that reached it, before and after every recent branch, at crates/voelin-core/tests/live.rs `disabled policy must prevent HTTP requests` (ts6_banners, left: 4, right: 0), while the six tests of the file passed one after the other. ts6_banners sets and unsets the TeamSpeak 6 server's banners, and it counts the requests that reach an HTTP server of its own for the images it set, to show that an engine whose policy is disabled makes none. The server tells every client that connects while the banners are set where they are, and an engine fetches what it is told (as it should): the other tests of the binary, which cargo runs side by side, connect engines to the same server, and their requests were counted as the engine under test's. Reproduced against the development servers with the tests in pairs: ts6_banners alone passes (62 s), with ts6_avatars, ts6_engine or ts6_channel_joins at the same time it fails (`left: 2` or, in the join test's case, a later count, `left: 6, right: 4`), and the TS3 and TS6 tests without it pass in any combination. So the test was wrong, not the engine or the script's ordering: it needs the server to itself. The TeamSpeak 6 tests that connect now hold a lock shared and ts6_banners holds it exclusively, so it runs before or after them and not meanwhile. The smoke is not run with --test-threads=1 for this: that would hide it, not remove it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
661a607a35
commit
069fd2ac12
2 files changed
+23
No files matched your search
@@ -1,8 +1,10 @@
|
||||
//! Engine against the development servers (dev/docker-compose.yml).
|
||||
//! Runs only with `VOELIN_LIVE=1`; `scripts/it-smoke.sh` sets it.
|
||||
|
||||
use std::sync::LazyLock;
|
||||
use std::time::Duration;
|
||||
|
||||
use tokio::sync::RwLock;
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use tokio::time::{Instant, timeout_at};
|
||||
use voelin_core::{
|
||||
@@ -15,6 +17,17 @@ fn live() -> bool {
|
||||
std::env::var("VOELIN_LIVE").is_ok_and(|v| v == "1")
|
||||
}
|
||||
|
||||
/// The TeamSpeak 6 server's banners are the server's, and `ts6_banners` sets and
|
||||
/// unsets them there. While it does, whatever else connects to the server is
|
||||
/// told the addresses of those banners, and an engine fetches what it is told
|
||||
/// (as it should): the requests of such an engine reached the HTTP server of
|
||||
/// `ts6_banners`, which counts the requests of the engine under test, and the
|
||||
/// test failed on `disabled policy must prevent HTTP requests` in every run
|
||||
/// that had the tests of this file run side by side (as they do). The tests
|
||||
/// that connect to the server hold this shared, `ts6_banners` exclusively: it
|
||||
/// runs with the server to itself, and the others before or after it.
|
||||
static TS6: LazyLock<RwLock<()>> = LazyLock::new(|| RwLock::new(()));
|
||||
|
||||
/// Wait for an event matching `f`, failing after 20 s.
|
||||
async fn wait_for(
|
||||
rx: &mut Receiver<Event>,
|
||||
@@ -131,6 +144,7 @@ async fn ts6_engine() {
|
||||
if !live() {
|
||||
return;
|
||||
}
|
||||
let _server = TS6.read().await;
|
||||
engine_roundtrip("127.0.0.1:9988", query(voelin_query::Transport::Ssh, "127.0.0.1:10022"))
|
||||
.await;
|
||||
}
|
||||
@@ -258,6 +272,7 @@ async fn ts6_channel_joins() {
|
||||
if !live() {
|
||||
return;
|
||||
}
|
||||
let _server = TS6.read().await;
|
||||
channel_joins("127.0.0.1:9988", query(voelin_query::Transport::Ssh, "127.0.0.1:10022")).await;
|
||||
}
|
||||
|
||||
@@ -329,6 +344,7 @@ async fn ts6_banners() {
|
||||
if !live() {
|
||||
return;
|
||||
}
|
||||
let _server = TS6.write().await;
|
||||
let voice_addr =
|
||||
std::env::var("VOELIN_BANNER_VOICE_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into());
|
||||
let query_addr =
|
||||
@@ -512,6 +528,7 @@ async fn ts6_avatars() {
|
||||
if !live() {
|
||||
return;
|
||||
}
|
||||
let _server = TS6.read().await;
|
||||
let voice_addr =
|
||||
std::env::var("VOELIN_BANNER_VOICE_ADDR").unwrap_or_else(|_| "127.0.0.1:9988".into());
|
||||
let dir = std::env::temp_dir().join(format!("voelin-live-avatars-{}", std::process::id()));
|
||||
|
||||
@@ -536,6 +536,12 @@ done
|
||||
log "TeamSpeak session (voelin-core ts_session) against both servers: link conformance subset, chat, refused moves, poke, voice, files"
|
||||
VOELIN_LIVE=1 cargo test --quiet -p voelin-core --lib ts_session::live_tests -- --test-threads=1 2>&1 | grep -E "test result|panicked|timed out" || fail "TeamSpeak session tests failed"
|
||||
|
||||
# The engine tests of one binary run side by side and share the TeamSpeak 6
|
||||
# server: ts6_banners sets the server's banners, which every other engine that
|
||||
# connects meanwhile fetches, so crates/voelin-core/tests/live.rs lets it run
|
||||
# alone (a lock the TS6 tests hold, ts6_banners exclusively). It used to fail
|
||||
# on `disabled policy must prevent HTTP requests` in every run of this stage.
|
||||
# Not run with --test-threads=1: that hid the problem, it did not remove it.
|
||||
log "engine (voelin-core) against both servers, media pipeline through TS6"
|
||||
VOELIN_LIVE=1 cargo test --quiet -p voelin-core --features media-desktop --test live --test stream_live --test media_live 2>&1 | grep -E "test result|panicked|timed out" || fail "engine tests failed"
|
||||
|
||||
|
||||
Reference in new issue
Block a user