Skip to content

Commit

Permalink
comment in
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta committed Feb 12, 2025
1 parent b7b0e82 commit f3751dc
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions internal/digraph/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,39 +317,39 @@ func TestScheduler(t *testing.T) {
node := result.Node(t, "1")
require.Equal(t, 2, node.State().RetryCount) // 2 retry
})
// t.Run("RetryWithScript", func(t *testing.T) {
// sc := setup(t)

// const testEnv = "TEST_RETRY_WITH_SCRIPT"
// graph := sc.newGraph(t,
// newStep("1",
// withScript(`
// if [ "$TEST_RETRY_WITH_SCRIPT" -eq 1 ]; then
// exit 1
// fi
// exit 0
// `),
// withRetryPolicy(1, time.Millisecond*500),
// ),
// )

// _ = os.Setenv(testEnv, "1")
// go func() {
// time.Sleep(time.Millisecond * 300)
// _ = os.Setenv(testEnv, "0")
// t.Cleanup(func() {
// _ = os.Unsetenv(testEnv)
// })
// }()

// result := graph.Schedule(t, scheduler.StatusSuccess)

// result.AssertNodeStatus(t, "1", scheduler.NodeStatusSuccess)

// node := result.Node(t, "1")
// require.Equal(t, 2, node.State().DoneCount) // 2 executions
// require.Equal(t, 1, node.State().RetryCount) // 1 retry
// })
t.Run("RetryWithScript", func(t *testing.T) {
sc := setup(t)

const testEnv = "TEST_RETRY_WITH_SCRIPT"
graph := sc.newGraph(t,
newStep("1",
withScript(`
if [ "$TEST_RETRY_WITH_SCRIPT" -eq 1 ]; then
exit 1
fi
exit 0
`),
withRetryPolicy(1, time.Millisecond*500),
),
)

_ = os.Setenv(testEnv, "1")
go func() {
time.Sleep(time.Millisecond * 300)
_ = os.Setenv(testEnv, "0")
t.Cleanup(func() {
_ = os.Unsetenv(testEnv)
})
}()

result := graph.Schedule(t, scheduler.StatusSuccess)

result.AssertNodeStatus(t, "1", scheduler.NodeStatusSuccess)

node := result.Node(t, "1")
require.Equal(t, 2, node.State().DoneCount) // 2 executions
require.Equal(t, 1, node.State().RetryCount) // 1 retry
})
t.Run("RetryPolicySuccess", func(t *testing.T) {
file := filepath.Join(
os.TempDir(), fmt.Sprintf("flag_test_retry_success_%s", uuid.Must(uuid.NewRandom()).String()),
Expand Down

0 comments on commit f3751dc

Please sign in to comment.