web: fix test goroutine in TestTLS()

This commit is contained in:
Lars Lehtonen 2019-12-09 09:28:42 -08:00
parent 55ab44c8be
commit f25ad35f0a
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2

View File

@ -221,10 +221,10 @@ func TestTLS(t *testing.T) {
service.HandleFunc("/", fn)
errCh := make(chan error, 1)
go func() {
if err := service.Run(); err != nil {
t.Fatal(err)
}
errCh <- service.Run()
close(errCh)
}()
var s []*registry.Service
@ -257,4 +257,13 @@ func TestTLS(t *testing.T) {
if string(b) != str {
t.Errorf("Expected %s got %s", str, string(b))
}
select {
case err := <-errCh:
if err != nil {
t.Fatalf("Run():%v", err)
}
case <-time.After(time.Duration(time.Second)):
t.Logf("service.Run() survived a client request without an error")
}
}