@@ -173,20 +173,21 @@ func expectNoTraceCountIncrease(t *testing.T, suite *suite.ConformanceTestSuite,
173173
174174 httputils .MakeRequestAndExpectEventuallyConsistentResponse (t , suite .RoundTripper , suite .TimeoutConfig , gwAddr , * expectedResponse )
175175
176- observed := false
177- deadline := time .Now ().Add (15 * time .Second )
178- for time .Now ().Before (deadline ) {
176+ observedCurrentCount := false
177+ err = wait .PollUntilContextTimeout (t .Context (), time .Second , 15 * time .Second , true , func (_ context.Context ) (bool , error ) {
179178 curCount , err := tracing .QueryTraceFromTempo (t , suite .Client , tags )
180179 if err != nil {
181180 tlog .Logf (t , "failed to get current trace count from tempo: %v" , err )
182- time .Sleep (time .Second )
183- continue
181+ return false , nil
182+ }
183+ observedCurrentCount = true
184+ if curCount > preCount {
185+ return false , fmt .Errorf ("trace count increased from %d to %d" , preCount , curCount )
184186 }
185- observed = true
186- require .LessOrEqual (t , curCount , preCount , "trace count increased" )
187- time .Sleep (time .Second )
188- }
189- require .True (t , observed , "failed to get current trace count from tempo" )
187+ return false , nil
188+ })
189+ require .ErrorIs (t , err , context .DeadlineExceeded )
190+ require .True (t , observedCurrentCount , "failed to get current trace count from tempo" )
190191}
191192
192193var ZipkinTracingTest = suite.ConformanceTest {
0 commit comments