Skip to content

Commit

Permalink
skip 5 second sleep at start of SetupCDCFlowStatusQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jan 6, 2024
1 parent a20f178 commit d9ca763
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flow/e2e/bigquery/peer_flow_bq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ func (s PeerFlowE2ETestSuiteBQ) Test_Simple_Schema_Changes_BQ() {
s.t.Log("Inserted row after dropping all columns in the source table")

// verify we got our two rows, if schema did not match up it will error.
e2e.EnvWaitForEqualTables(env, s, "normalize altered row", tableName, "id,c1")
e2e.EnvWaitForEqualTables(env, s, "normalize drop column", tableName, "id,c1")

env.CancelWorkflow()
}()
Expand Down
16 changes: 9 additions & 7 deletions flow/e2e/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ func EnvWaitForEqualTablesWithNames(

func SetupCDCFlowStatusQuery(env *testsuite.TestWorkflowEnvironment,
connectionGen FlowConnectionGenerationConfig,
) {
// wait for PeerFlowStatusQuery to finish setup
// sleep for 5 second to allow the workflow to start
time.Sleep(5 * time.Second)
) error {
// errors expected while PeerFlowStatusQuery is setup
counter := 0
for {
time.Sleep(time.Second)
counter++
response, err := env.QueryWorkflow(
shared.CDCFlowStateQuery,
connectionGen.FlowJobName,
Expand All @@ -186,13 +187,14 @@ func SetupCDCFlowStatusQuery(env *testsuite.TestWorkflowEnvironment,
}

if *state.CurrentFlowState == protos.FlowStatus_STATUS_RUNNING {
break
return nil
}
} else {
} else if counter > 15 {
return err
} else if counter > 5 {
// log the error for informational purposes
slog.Error(err.Error())
}
time.Sleep(1 * time.Second)
}
}

Expand Down

0 comments on commit d9ca763

Please sign in to comment.