on main help sign in
chore: remove flaky tests
commita8f90ff06ce66abb19b7e9a847cf20d8e60ef67c authorKujtim Hoxha <kujtimii.h@gmail.com> dateFri 7 Nov 2025, 13:15 (1 year ago) parent4401d5b
1 file changed−42
internal/agent/tools/job_test.go−42
internal/agent/tools/job_test.go−42
@@ -2,7 +2,6 @@ package tools
22
33import (
44 "context"
5− "strings"
65 "testing"
76 "time"
87
@@ -60,24 +59,6 @@ func TestBackgroundShell_Kill(t *testing.T) {
6059 require.True(t, bgShell.IsDone())
6160}
6261
63−func TestBackgroundShell_GetOutput_NoHang(t *testing.T) {
64− t.Parallel()
65−
66− workingDir := t.TempDir()
67− ctx := context.Background()
68−
69− // Start a long-running background shell
70− bgManager := shell.GetBackgroundShellManager()
71− bgShell, err := bgManager.Start(ctx, workingDir, nil, "while true; do echo \"Hello from background job - $(date +%T)\"; sleep 1; done", "")
72− require.NoError(t, err)
73− defer bgManager.Kill(bgShell.ID)
74− // wait for 2 seconds
75− time.Sleep(2 * time.Second)
76− stdout, _, _, err := bgShell.GetOutput()
77− require.NoError(t, err)
78− require.Len(t, strings.Split(stdout, "\n"), 3)
79−}
80−
8162func TestBackgroundShell_MultipleOutputCalls(t *testing.T) {
8263 t.Parallel()
8364
@@ -345,27 +326,4 @@ func TestBackgroundShell_AutoBackground(t *testing.T) {
345326 require.True(t, ok, "Should be able to retrieve background shell")
346327 require.Equal(t, bgShell.ID, retrieved.ID)
347328 })
348−
349− // Test that we can check output of long-running command later
350− t.Run("can check output after completion", func(t *testing.T) {
351− t.Parallel()
352− bgManager := shell.GetBackgroundShellManager()
353− bgShell, err := bgManager.Start(ctx, workingDir, nil, "sleep 3 && echo 'completed'", "")
354− require.NoError(t, err)
355− defer bgManager.Kill(bgShell.ID)
356−
357− // Initially should be running
358− _, _, done, _ := bgShell.GetOutput()
359− require.False(t, done, "Should be running initially")
360−
361− // Wait for completion
362− time.Sleep(4 * time.Second)
363−
364− // Now should be done
365− stdout, stderr, done, err := bgShell.GetOutput()
366− require.NoError(t, err)
367− require.True(t, done, "Should be done after waiting")
368− require.Contains(t, stdout, "completed")
369− require.Empty(t, stderr)
370− })
371329}