Skip to content

Commit

Permalink
Do not Errorf during file watcher verification test loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
timoreimann authored and traefiker committed Oct 4, 2018
1 parent 44e06a1 commit d69977c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions provider/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,21 @@ func TestProvideWithWatch(t *testing.T) {
}

timeout = time.After(time.Second * 1)
success := false
for !success {
var numUpdates, numBackends, numFrontends, numTLSConfs int
for {
select {
case config := <-configChan:
success = assert.Len(t, config.Configuration.Backends, test.expectedNumBackend)
success = success && assert.Len(t, config.Configuration.Frontends, test.expectedNumFrontend)
success = success && assert.Len(t, config.Configuration.TLS, test.expectedNumTLSConf)
numUpdates++
numBackends = len(config.Configuration.Backends)
numFrontends = len(config.Configuration.Frontends)
numTLSConfs = len(config.Configuration.TLS)
t.Logf("received update #%d: backends %d/%d, frontends %d/%d, TLS configs %d/%d", numUpdates, numBackends, test.expectedNumBackend, numFrontends, test.expectedNumFrontend, numTLSConfs, test.expectedNumTLSConf)

if numBackends == test.expectedNumBackend && numFrontends == test.expectedNumFrontend && numTLSConfs == test.expectedNumTLSConf {
return
}
case <-timeout:
t.Errorf("timeout while waiting for config")
return
t.Fatal("timeout while waiting for config")
}
}
})
Expand Down

0 comments on commit d69977c

Please sign in to comment.