From 837b0eaa27c66e7b0895492077cc76fbabf7c22e Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 27 Nov 2024 15:48:34 -0300 Subject: [PATCH] Get the workflow and increase the timeout of this test --- .../workflow_definition_test.go | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/test/integration_tests/workflow_definition_test.go b/test/integration_tests/workflow_definition_test.go index a1b48f84..d4ff6928 100644 --- a/test/integration_tests/workflow_definition_test.go +++ b/test/integration_tests/workflow_definition_test.go @@ -18,6 +18,7 @@ import ( const retryLimit = 5 func TestWorkflowCreation(t *testing.T) { + executor := testdata.WorkflowExecutor workflow := testdata.NewKitchenSinkWorkflow(testdata.WorkflowExecutor) err := workflow.Register(true) if err != nil { @@ -31,9 +32,25 @@ func TestWorkflowCreation(t *testing.T) { if err != nil { t.Fatalf("Failed to complete the workflow, reason: %s", err) } + assert.NotEmpty(t, run, "Workflow is null", run) - assert.Equal(t, string(model.CompletedWorkflow), run.Status) - assert.Equal(t, "input1", run.Input["key1"]) + + timeout := time.After(60 * time.Second) + tick := time.Tick(1 * time.Second) + workflowId := run.WorkflowId + for { + select { + case <-timeout: + t.Fatalf("Timed out and workflow %s didn't complete", workflowId) + case <-tick: + wf, err := executor.GetWorkflow(workflowId, false) + assert.NoError(t, err) + assert.Equal(t, model.CompletedWorkflow, wf.Status) + assert.Equal(t, "input1", run.Input["key1"]) + return + } + } + } func TestRemoveWorkflow(t *testing.T) {