web: fix test goroutine in TestTLS()
This commit is contained in:
parent
55ab44c8be
commit
f25ad35f0a
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user