MCPcopy
hub / github.com/PeerDB-io/peerdb / EnvWaitFor

Function EnvWaitFor

flow/e2e/test_utils.go:874–889  ·  view source on GitHub ↗
(t *testing.T, env WorkflowRun, timeout time.Duration, reason string, f func() bool)

Source from the content-addressed store, hash-verified

872}
873
874func EnvWaitFor(t *testing.T, env WorkflowRun, timeout time.Duration, reason string, f func() bool) {
875 t.Helper()
876 t.Log("WaitFor", reason, time.Now())
877
878 deadline := time.Now().Add(timeout)
879 for !f() {
880 if time.Now().After(deadline) {
881 env.Cancel(t.Context())
882 t.Fatal("UNEXPECTED TIMEOUT", reason, time.Now())
883 }
884 time.Sleep(time.Second)
885 if err := t.Context().Err(); err != nil {
886 t.Fatal(reason, err)
887 }
888 }
889}
890
891func EnvWaitForFinished(t *testing.T, env WorkflowRun, timeout time.Duration) {
892 t.Helper()

Callers 15

Test_Invalid_NumericMethod · 0.85
Test_Types_SFMethod · 0.85
Test_Multi_Table_SFMethod · 0.85
TestCreateTopicMethod · 0.85
Test_Overwrite_PGMethod · 0.85
TestQRepPauseMethod · 0.85
TestXminPauseMethod · 0.85
TestTransformMethod · 0.85

Calls 4

LogMethod · 0.80
CancelMethod · 0.65
ErrMethod · 0.65
AddMethod · 0.45

Tested by 15

Test_Invalid_NumericMethod · 0.68
Test_Types_SFMethod · 0.68
Test_Multi_Table_SFMethod · 0.68
TestCreateTopicMethod · 0.68
Test_Overwrite_PGMethod · 0.68
TestQRepPauseMethod · 0.68
TestXminPauseMethod · 0.68
TestTransformMethod · 0.68