Tests: give the fail2ban and task-manager checks room under load

Two long-standing flakes in system_tests, both timing:

- security: the ban period was set to one second, but the test makes a
  hundred more requests before it checks that a valid password from the
  banned address is refused, so under load the ban had already expired.
  Five seconds, and the expiry check sleeps six.
- task: a task scheduled one second out was queried for straight away,
  and under load the query landed after the task manager had run and
  removed it. Three seconds.

Seven consecutive system_tests runs, neither recurred.
This commit is contained in:
2026-09-19 15:38:01 -07:00
parent cee4fd6bc6
commit 2f1e4bd2c7
2 changed files with 9 additions and 4 deletions
+6 -3
View File
@@ -174,8 +174,11 @@ pub async fn test(test: &mut TestServer) {
.registry_update_object( .registry_update_object(
ObjectType::Security, ObjectType::Security,
Id::singleton(), Id::singleton(),
// inbuxa: five seconds, not one: the checks below make a hundred
// more requests before the ban is tested, and under load a
// one-second ban expired first
json!({ json!({
Property::AuthBanPeriod: registry::types::duration::Duration::from_millis(1000) Property::AuthBanPeriod: registry::types::duration::Duration::from_millis(5000)
}), }),
) )
.await; .await;
@@ -206,8 +209,8 @@ pub async fn test(test: &mut TestServer) {
assert_eq!(blocked_ip.reason, BlockReason::AuthFailure); assert_eq!(blocked_ip.reason, BlockReason::AuthFailure);
assert!(blocked_ip.expires_at.is_some()); assert!(blocked_ip.expires_at.is_some());
// After 1 second the ban should be lifted // After the ban period the ban should be lifted
tokio::time::sleep(Duration::from_secs(2)).await; tokio::time::sleep(Duration::from_secs(6)).await;
validate_password_with_ip( validate_password_with_ip(
"[email protected]", "[email protected]",
"this is a very strong password", "this is a very strong password",
+3 -1
View File
@@ -39,7 +39,9 @@ pub async fn test(test: &mut TestServer) {
admin.assert_no_tasks().await; admin.assert_no_tasks().await;
// Create a successful task for future execution // Create a successful task for future execution
admin.schedule_test_task(TASK_SUCCESS, 1).await; // inbuxa: three seconds, not one: the query below takes longer than a
// second under load, and the task had already run and been removed
admin.schedule_test_task(TASK_SUCCESS, 3).await;
admin.assert_has_tasks(1).await; admin.assert_has_tasks(1).await;
admin.assert_no_tasks().await; admin.assert_no_tasks().await;