Commit 29512f7e authored by Alberto Bertogli's avatar Alberto Bertogli

testlib: Add tests for testlib.WaitFor

parent fdae72f2
Pipeline #128506428 passed with stages
in 8 minutes and 33 seconds
......@@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"testing"
"time"
)
func TestBasic(t *testing.T) {
......@@ -83,3 +84,15 @@ func TestGetFreePort(t *testing.T) {
t.Errorf("failed to get free port")
}
}
func TestWaitFor(t *testing.T) {
ok := WaitFor(func() bool { return true }, 20*time.Millisecond)
if !ok {
t.Errorf("WaitFor(true) timed out")
}
ok = WaitFor(func() bool { return false }, 20*time.Millisecond)
if ok {
t.Errorf("WaitFor(false) worked")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment