lostluck commented on code in PR #36235:
URL: https://github.com/apache/beam/pull/36235#discussion_r2370371909


##########
sdks/go/pkg/beam/runners/prism/internal/jobservices/server_test.go:
##########
@@ -121,6 +132,30 @@ func TestServer_RunThenCancel(t *testing.T) {
                t.Fatalf("server.Run() = returned empty preparation ID, want 
non-empty")
        }
 
+       // Wait for the job to be in the RUNNING state before we cancel it.
+       const (
+               maxRetries = 10
+               retrySleep = 100 * time.Millisecond
+       )
+       var jobIsRunning bool
+       for range maxRetries {
+               stateResp, err := undertest.GetState(ctx, 
&jobpb.GetJobStateRequest{JobId: runResp.GetJobId()})

Review Comment:
   I'd use the streaming version of the call, not the one-off . Then there's 
less dynamic waiting for things to happen for up to a second.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to