From 34d3deff9bad12da47e396e93b16f58a090fa0d4 Mon Sep 17 00:00:00 2001 From: Abhishek Chanda Date: Thu, 18 Feb 2016 19:19:25 -0800 Subject: [PATCH] Run a bunch of tests in parallel --- client/consul_test.go | 7 +++++++ client/util_test.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/client/consul_test.go b/client/consul_test.go index 1b111382a..83cf36fcd 100644 --- a/client/consul_test.go +++ b/client/consul_test.go @@ -71,6 +71,7 @@ func newTask() *structs.Task { } func TestConsul_MakeChecks(t *testing.T) { + t.Parallel() service := &structs.Service{ Name: "Bar", Checks: []*structs.ServiceCheck{ @@ -116,6 +117,7 @@ func TestConsul_MakeChecks(t *testing.T) { } func TestConsul_InvalidPortLabelForService(t *testing.T) { + t.Parallel() task := &structs.Task{ Name: "foo", Driver: "docker", @@ -157,6 +159,7 @@ func TestConsul_InvalidPortLabelForService(t *testing.T) { } func TestConsul_Services_Deleted_From_Task(t *testing.T) { + t.Parallel() c := newConsulService() task := structs.Task{ Name: "redis", @@ -189,6 +192,7 @@ func TestConsul_Services_Deleted_From_Task(t *testing.T) { } func TestConsul_Service_Should_Be_Re_Reregistered_On_Change(t *testing.T) { + t.Parallel() c := newConsulService() task := newTask() s1 := structs.Service{ @@ -215,6 +219,7 @@ func TestConsul_Service_Should_Be_Re_Reregistered_On_Change(t *testing.T) { } func TestConsul_AddCheck_To_Service(t *testing.T) { + t.Parallel() apiClient := &mockConsulApiClient{} c := newConsulService() c.client = apiClient @@ -245,6 +250,7 @@ func TestConsul_AddCheck_To_Service(t *testing.T) { } func TestConsul_ModifyCheck(t *testing.T) { + t.Parallel() apiClient := &mockConsulApiClient{} c := newConsulService() c.client = apiClient @@ -281,6 +287,7 @@ func TestConsul_ModifyCheck(t *testing.T) { } func TestConsul_FilterNomadServicesAndChecks(t *testing.T) { + t.Parallel() c := newConsulService() srvs := map[string]*consul.AgentService{ "foo-bar": { diff --git a/client/util_test.go b/client/util_test.go index 64413df9a..431a93f6b 100644 --- a/client/util_test.go +++ b/client/util_test.go @@ -13,6 +13,7 @@ import ( ) func TestDiffAllocs(t *testing.T) { + t.Parallel() alloc1 := mock.Alloc() // Ignore alloc2 := mock.Alloc() // Update alloc2u := new(structs.Allocation) @@ -56,6 +57,7 @@ func TestDiffAllocs(t *testing.T) { } func TestRandomStagger(t *testing.T) { + t.Parallel() intv := time.Minute for i := 0; i < 10; i++ { stagger := randomStagger(intv) @@ -66,6 +68,7 @@ func TestRandomStagger(t *testing.T) { } func TestShuffleStrings(t *testing.T) { + t.Parallel() // Generate input inp := make([]string, 10) for idx := range inp { @@ -86,6 +89,7 @@ func TestShuffleStrings(t *testing.T) { } func TestPersistRestoreState(t *testing.T) { + t.Parallel() dir, err := ioutil.TempDir("", "nomad") if err != nil { t.Fatalf("err: %s", err)