Skip to content

Commit 2782521

Browse files
committed
chore: add unit test to excercise flake
1 parent 7924bb2 commit 2782521

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

agent/agentscripts/agentscripts_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ func TestTimeout(t *testing.T) {
5353
require.ErrorIs(t, runner.Execute(context.Background(), nil), agentscripts.ErrTimeout)
5454
}
5555

56+
// TestCronClose exists because StartCront() can happen after Close(),
57+
// so the cron go routine is not exited.
58+
func TestCronClose(t *testing.T) {
59+
t.Parallel()
60+
runner := agentscripts.New(agentscripts.Options{})
61+
runner.StartCron()
62+
require.NoError(t, runner.Close(), "close runner")
63+
}
64+
5665
func setup(t *testing.T, patchLogs func(ctx context.Context, req agentsdk.PatchLogs) error) *agentscripts.Runner {
5766
t.Helper()
5867
if patchLogs == nil {

0 commit comments

Comments
 (0)