@@ -411,12 +411,14 @@ var _ = Describe("Simulator requests scheduling", Ordered, func() {
411411
412412 // We sent 2500 requests, after about 2.5 seconds
413413 // number of running requests should be 1000
414- // and the number of waiting requests should be less than 1000
414+ // and the number of waiting requests should be less than 1000.
415+ // Since we are in the middle of requests scheduling,
416+ // the number of running requests can be 999.
415417 runningStr = findMetric (metrics , runningMetric )
416418 Expect (runningStr ).NotTo (Equal ("" ))
417419 running , err = strconv .Atoi (runningStr )
418420 Expect (err ).NotTo (HaveOccurred ())
419- Expect (running ).To (Equal (1000 ))
421+ Expect (running ).To (Or ( Equal (1000 ), Equal ( 999 ) ))
420422 waitingStr = findMetric (metrics , waitingMetric )
421423 waiting , err = strconv .Atoi (waitingStr )
422424 Expect (err ).NotTo (HaveOccurred ())
@@ -431,13 +433,15 @@ var _ = Describe("Simulator requests scheduling", Ordered, func() {
431433 Expect (err ).NotTo (HaveOccurred ())
432434 metrics = strings .Split (string (data ), "\n " )
433435
434- // number of running requests should be 1000
435- // and the number of waiting requests should be less than 1000
436+ // The number of running requests should be 1000
437+ // and the number of waiting requests should be less than 1000.
438+ // Since we are in the middle of requests scheduling,
439+ // the number of running requests can be 999.
436440 runningStr = findMetric (metrics , runningMetric )
437441 Expect (runningStr ).NotTo (Equal ("" ))
438442 running , err = strconv .Atoi (runningStr )
439443 Expect (err ).NotTo (HaveOccurred ())
440- Expect (running ).To (Equal (1000 ))
444+ Expect (running ).To (Or ( Equal (1000 ), Equal ( 999 ) ))
441445 waitingStr = findMetric (metrics , waitingMetric )
442446 waiting , err = strconv .Atoi (waitingStr )
443447 Expect (err ).NotTo (HaveOccurred ())
0 commit comments