Skip to content

Commit f82af6d

Browse files
europaulclaude
andcommitted
fix vector test flaky by generating SSH logs repeatedly
The test generated an SSH event only once, which could be missed if the log watcher's streaming connection wasn't established yet. Generate SSH events in a loop every 10 seconds so the watchers are guaranteed to catch a matching log entry regardless of startup timing. Signed-off-by: Paul Gaiduk <paulg@zededa.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3264362 commit f82af6d

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tests/vector/vector_test.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,26 @@ func TestWorkingConfig(t *testing.T) {
340340
}
341341
}()
342342

343-
time.Sleep(5 * time.Second) // Give some time for the log watcher to start
344-
steppy.AnnounceNext("generate logs from debug container")
345-
cmd = "exit"
346-
if _, err := eveNode.EveRunCommand(cmd); err != nil {
347-
logFatalf("Failed to run ssh '%s': %v", cmd, err)
348-
} else {
349-
logInfof("SSH command '%s' executed successfully, logs should be generated", cmd)
350-
}
343+
steppy.AnnounceNext("generate logs from debug container repeatedly")
344+
stopGenerating := make(chan struct{})
345+
go func() {
346+
cmd := "exit"
347+
ticker := time.NewTicker(10 * time.Second)
348+
defer ticker.Stop()
349+
for {
350+
if _, err := eveNode.EveRunCommand(cmd); err != nil {
351+
logInfof("SSH command '%s' failed (may be transient): %v", cmd, err)
352+
} else {
353+
logInfof("SSH command '%s' executed successfully, logs should be generated", cmd)
354+
}
355+
select {
356+
case <-stopGenerating:
357+
return
358+
case <-ticker.C:
359+
}
360+
}
361+
}()
351362

352363
wg.Wait()
364+
close(stopGenerating)
353365
}

0 commit comments

Comments
 (0)