Raise the anti-flood limits of the development servers from the live module

On a freshly started stack the live module failed 8 tests of 12 with
ConnectFailedBanned: a server with its default anti-flood limits bans the
address that connects as often as these tests do, after three or four
connections. scripts/it-smoke.sh sets the limits when it prepares its admin
identity, so the module passed only after the smoke script had run.

The module now raises virtualserver_antiflood_points_needed_ip_block and
..._command_block itself before its first connection, once per server and
run, through the ServerQuery admin login that refused_moves uses, and clears
the bans of an earlier run with bandelall (banclear is not a command of
either server). The command of the module header works on a fresh stack.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-24 04:13:13 +03:00
1 parent 81d1de86e1
commit 9283191e58
1 file changed
+44
@@ -20,6 +20,15 @@
//!
//! The sessions are made by [`TsConnector`] through the plain `Connector`
//! interface, as a client of the seam outside an engine would make them.
//!
//! The servers ban an address that connects as often as these tests do
//! (`ConnectFailedBanned` after three or four connections) unless their
//! anti-flood limits are raised first. `scripts/it-smoke.sh` raises them when it
//! prepares its admin identity; this module raises them itself, once per server
//! and run, through the ServerQuery admin login that `refused_moves` uses
//! ([`raise_flood_limits`]), so that the command above works on a freshly
//! started stack. It needs that login (the development servers of
//! `dev/docker-compose.yml` have it) and does not lower the limits again.
use std::collections::BTreeMap;
use std::future::Future;
@@ -89,12 +98,47 @@ impl Dev {
}
}
/// Raise the anti-flood limits of a development server, once per run, and
/// lift the bans an earlier run left behind. The tests connect many times in
/// a few seconds from one address, which a server with its default limits
/// bans (`ConnectFailedBanned`); `scripts/it-smoke.sh` sets the same two
/// values in `admin_args`. Done through the ServerQuery login of the admin,
/// which the tests that create channels and keys use as well.
async fn raise_flood_limits(dev: &Dev) {
use tokio::sync::OnceCell;
use voelin_query::{Command as Query, QueryClient};
static TS3_READY: OnceCell<()> = OnceCell::const_new();
static TS6_READY: OnceCell<()> = OnceCell::const_new();
let ready = if dev.ssh { &TS6_READY } else { &TS3_READY };
ready
.get_or_init(|| async {
let (admin, _) = within("the query login", QueryClient::connect(&dev.query()))
.await
.unwrap_or_else(|e| panic!("the query login of {}: {e}", dev.name));
for key in [
"virtualserver_antiflood_points_needed_ip_block",
"virtualserver_antiflood_points_needed_command_block",
] {
let edit = Query::new("serveredit").arg(key, 100_000);
within("the anti-flood limits", admin.send(&edit))
.await
.unwrap_or_else(|e| panic!("{} refused {key}: {e}", dev.name));
}
// A ban of an earlier run outlives the change of the limit.
within("the ban list", admin.send(&Query::new("bandelall")))
.await
.unwrap_or_else(|e| panic!("{} did not lift its bans: {e}", dev.name));
})
.await;
}
/// A TeamSpeak session as a client of the seam sees it: made by the
/// connector, with its push channel and media sink.
async fn session(
dev: &Dev,
options: &ConnectOptions,
) -> (Arc<dyn Session>, mpsc::Receiver<v1::Push>, MediaReceiver) {
raise_flood_limits(dev).await;
let (sink, media) = media_channel();
let params = connect_params(options, sink, &Backends::empty()).expect("connect parameters");
let connected =