1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-16 06:39:49 +02:00
lego/acme/utils_test.go
2016-03-11 04:52:59 +01:00

27 lines
427 B
Go

package acme
import (
"testing"
"time"
)
func TestWaitForTimeout(t *testing.T) {
c := make(chan error)
go func() {
err := WaitFor(3*time.Second, 1*time.Second, func() (bool, error) {
return false, nil
})
c <- err
}()
timeout := time.After(4 * time.Second)
select {
case <-timeout:
t.Fatal("timeout exceeded")
case err := <-c:
if err == nil {
t.Errorf("expected timeout error; got %v", err)
}
}
}