Skip to content

Commit

Permalink
Merge pull request #818 from achanda/perf
Browse files Browse the repository at this point in the history
Run a bunch of tests in parallel
  • Loading branch information
diptanu committed Feb 26, 2016
2 parents 8c27f15 + 34b5dcb commit dd2f82c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func newTask() *structs.Task {
}

func TestConsul_MakeChecks(t *testing.T) {
t.Parallel()
service := &structs.Service{
Name: "Bar",
Checks: []*structs.ServiceCheck{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions client/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestDiffAllocs(t *testing.T) {
t.Parallel()
alloc1 := mock.Alloc() // Ignore
alloc2 := mock.Alloc() // Update
alloc2u := new(structs.Allocation)
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit dd2f82c

Please sign in to comment.