lostluck commented on code in PR #38736:
URL: https://github.com/apache/beam/pull/38736#discussion_r3325228040
##########
sdks/go/pkg/beam/core/runtime/exec/datasampler_test.go:
##########
@@ -104,16 +104,9 @@ func TestDataSampler(t *testing.T) {
for _, sample := range test.samples {
dataSampler.SendSample(sample.PCollectionID,
sample.Element, sample.Timestamp)
}
- var samplesCount = -1
- var samples map[string][]*DataSample
- for i := 0; i < 5; i++ {
- samples = dataSampler.GetSamples(test.pids)
- if len(samples) == len(test.want) {
- samplesCount = len(samples)
- break
- }
- time.Sleep(time.Second)
- }
+ time.Sleep(1 * time.Second)
+ samples := dataSampler.GetSamples(test.pids)
+ samplesCount := len(samples)
Review Comment:
It is. And 1 second is especially long.
These days one might try and use the synctest package which subverts time,
but the nature of beam kinda prevents the necessary goroutine shenanigans.
I need to look at this on a real screen before i stamp it. Synctest might
work if this isn't in a pipeline execution context...
--
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]