[test] service.TestService: run subtest in parallel
Reason: the t.Fatalf and t.Fatal must be invoked by test routine, not by other routine, or the the test will not stopped [1]. [1] megacheck SA2002
This commit is contained in:
		| @@ -30,10 +30,16 @@ func TestService(t *testing.T) { | ||||
| 	// we can't test service.Init as it parses the command line | ||||
| 	// service.Init() | ||||
|  | ||||
| 	// register handler | ||||
| 	// do that later | ||||
| 	t.Run("Run", func(t *testing.T) { | ||||
| 		t.Parallel() | ||||
|  | ||||
| 		// run service | ||||
| 		service.Run() | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("Debug.Health", func(t *testing.T) { | ||||
| 		t.Parallel() | ||||
|  | ||||
| 	go func() { | ||||
| 		// wait for start | ||||
| 		wg.Wait() | ||||
|  | ||||
| @@ -57,8 +63,5 @@ func TestService(t *testing.T) { | ||||
|  | ||||
| 		// shutdown the service | ||||
| 		cancel() | ||||
| 	}() | ||||
|  | ||||
| 	// run service | ||||
| 	service.Run() | ||||
| 	}) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user