web: fix test goroutine in TestTLS()
This commit is contained in:
		| @@ -221,10 +221,10 @@ func TestTLS(t *testing.T) { | |||||||
|  |  | ||||||
| 	service.HandleFunc("/", fn) | 	service.HandleFunc("/", fn) | ||||||
|  |  | ||||||
|  | 	errCh := make(chan error, 1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		if err := service.Run(); err != nil { | 		errCh <- service.Run() | ||||||
| 			t.Fatal(err) | 		close(errCh) | ||||||
| 		} |  | ||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
| 	var s []*registry.Service | 	var s []*registry.Service | ||||||
| @@ -257,4 +257,13 @@ func TestTLS(t *testing.T) { | |||||||
| 	if string(b) != str { | 	if string(b) != str { | ||||||
| 		t.Errorf("Expected %s got %s", str, string(b)) | 		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") | ||||||
|  | 	} | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user