Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: ut.
Signed-off-by: shuangkun <[email protected]>
  • Loading branch information
shuangkun committed Sep 28, 2025
commit ab94e8fb81dc22d895d22f108e5c639ad31cb948
14 changes: 11 additions & 3 deletions workflow/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ func TestParallelism(t *testing.T) {
wfv1.MustUnmarshalWorkflow(`
metadata:
name: my-wf-0
namespace: default
spec:
entrypoint: main
templates:
Expand All @@ -720,6 +721,7 @@ spec:
wfv1.MustUnmarshalWorkflow(`
metadata:
name: my-wf-1
namespace: default
spec:
entrypoint: main
templates:
Expand All @@ -730,6 +732,7 @@ spec:
wfv1.MustUnmarshalWorkflow(`
metadata:
name: my-wf-2
namespace: default
spec:
shutdown: Terminate
entrypoint: main
Expand All @@ -742,20 +745,25 @@ spec:
)
defer cancel()

// Process throttle items first to handle throttling
assert.True(t, controller.processNextThrottleItem(ctx))
assert.True(t, controller.processNextThrottleItem(ctx))
assert.True(t, controller.processNextThrottleItem(ctx))

assert.True(t, controller.processNextItem(ctx))
assert.True(t, controller.processNextItem(ctx))
assert.True(t, controller.processNextItem(ctx))

expectWorkflow(ctx, controller, "my-wf-0", func(wf *wfv1.Workflow) {
expectNamespacedWorkflow(ctx, controller, "default", "my-wf-0", func(wf *wfv1.Workflow) {
require.NotNil(t, wf)
assert.Equal(t, wfv1.WorkflowRunning, wf.Status.Phase)
})
expectWorkflow(ctx, controller, "my-wf-1", func(wf *wfv1.Workflow) {
expectNamespacedWorkflow(ctx, controller, "default", "my-wf-1", func(wf *wfv1.Workflow) {
require.NotNil(t, wf)
assert.Equal(t, wfv1.WorkflowPending, wf.Status.Phase)
assert.Equal(t, "Workflow processing has been postponed because too many workflows are already running", wf.Status.Message)
})
expectWorkflow(ctx, controller, "my-wf-2", func(wf *wfv1.Workflow) {
expectNamespacedWorkflow(ctx, controller, "default", "my-wf-2", func(wf *wfv1.Workflow) {
require.NotNil(t, wf)
assert.Equal(t, wfv1.WorkflowFailed, wf.Status.Phase)
})
Expand Down
Loading