@@ -413,54 +413,25 @@ func getErrorMessage(c *testing.T, body []byte) string {
413413 return strings .TrimSpace (resp .Message )
414414}
415415
416- func waitAndAssert (t * testing.T , timeout time.Duration , f interface {}, comparison interface {}, args ... interface {}) {
417- t1 := time .Now ()
418- defer func () {
419- t2 := time .Now ()
420- t .Logf ("waited for %v (out of %v)" , t2 .Sub (t1 ), timeout )
421- }()
422-
423- after := time .After (timeout )
424- for {
425- v , comment := f .(checkF )(t )
426- args = append ([]interface {}{v }, args ... )
427- shouldAssert := assert .Check (t , comparison , args ... )
428- select {
429- case <- after :
430- shouldAssert = true
431- default :
432- }
433- if shouldAssert {
434- if len (comment ) > 0 {
435- args = append (args , comment )
436- }
437- assert .Assert (t , comparison , args ... )
438- return
439- }
440- time .Sleep (100 * time .Millisecond )
441- }
442- }
443-
444416type checkF func (* testing.T ) (interface {}, string )
445417type reducer func (... interface {}) interface {}
446418
447- func pollCheck (t * testing.T , f interface {} , compare func (x interface {}) assert.BoolOrComparison ) poll.Check {
419+ func pollCheck (t * testing.T , f checkF , compare func (x interface {}) assert.BoolOrComparison ) poll.Check {
448420 return func (poll.LogT ) poll.Result {
449- ff := f .(checkF )
450- v , comment := ff (t )
421+ v , comment := f (t )
451422 if assert .Check (t , compare (v )) {
452423 return poll .Success ()
453424 }
454425 return poll .Continue (comment )
455426 }
456427}
457428
458- func reducedCheck (r reducer , funcs ... interface {} ) checkF {
429+ func reducedCheck (r reducer , funcs ... checkF ) checkF {
459430 return func (c * testing.T ) (interface {}, string ) {
460431 var values []interface {}
461432 var comments []string
462433 for _ , f := range funcs {
463- v , comment := f .( checkF ) (c )
434+ v , comment := f (c )
464435 values = append (values , v )
465436 if len (comment ) > 0 {
466437 comments = append (comments , comment )
0 commit comments