Skip to content

Commit f6b5079

Browse files
authored
Merge PR #2191: fix(test): fix flaky TestVerifyStartupNudgeDelivery_IdleAgent session collision
fix(test): fix flaky TestVerifyStartupNudgeDelivery_IdleAgent session collision
2 parents c5722f1 + d4360fa commit f6b5079

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

internal/polecat/session_manager_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,15 @@ func TestVerifyStartupNudgeDelivery_IdleAgent(t *testing.T) {
437437
tm := tmux.NewTmux()
438438
sessionName := "gt-test-nudge-verify-" + t.Name()
439439

440-
// Kill any orphaned session from a previous interrupted test run.
440+
// Kill any orphaned session from a previous interrupted test run,
441+
// then wait for tmux to fully destroy it (kill-session can be async).
441442
_ = tm.KillSession(sessionName)
443+
for i := 0; i < 20; i++ {
444+
if exists, _ := tm.HasSession(sessionName); !exists {
445+
break
446+
}
447+
time.Sleep(50 * time.Millisecond)
448+
}
442449

443450
// Create a tmux session with a shell
444451
if err := tm.NewSession(sessionName, os.TempDir()); err != nil {

0 commit comments

Comments
 (0)