Skip to content

Commit 7d0a4a1

Browse files
af-mdmaxdml
authored andcommitted
test: add validation for deterministic step IDs in Go workflow execution
1 parent df31e88 commit 7d0a4a1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dbos/workflows_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,21 @@ func TestGoRunningStepsInsideGoRoutines(t *testing.T) {
935935
handle, err := RunWorkflow(dbosCtx, goWorkflow, "test-input")
936936
require.NoError(t, err, "failed to run go workflow")
937937
_, err = handle.GetResult()
938-
938+
939939
close(results)
940940
close(errors)
941941

942942
require.NoError(t, err, "failed to get result from go workflow")
943943
assert.Equal(t, numSteps, len(results), "expected %d results, got %d", numSteps, len(results))
944944
assert.Equal(t, 0, len(errors), "expected no errors, got %d", len(errors))
945+
946+
// Test step IDs are deterministic and in the order of execution
947+
steps, err := GetWorkflowSteps(dbosCtx, handle.GetWorkflowID())
948+
require.NoError(t, err, "failed to get workflow steps")
949+
require.Len(t, steps, numSteps, "expected %d steps, got %d", numSteps, len(steps))
950+
for i := 0; i < numSteps; i++ {
951+
assert.Equal(t, i, steps[i].StepID, "expected step ID to be %d, got %d", i, steps[i].StepID)
952+
}
945953
})
946954
}
947955

0 commit comments

Comments
 (0)