Merge pull request #818 from achanda/perf
Run a bunch of tests in parallel
This commit is contained in:
commit
0b63bf3f83
|
@ -71,6 +71,7 @@ func newTask() *structs.Task {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_MakeChecks(t *testing.T) {
|
func TestConsul_MakeChecks(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
service := &structs.Service{
|
service := &structs.Service{
|
||||||
Name: "Bar",
|
Name: "Bar",
|
||||||
Checks: []*structs.ServiceCheck{
|
Checks: []*structs.ServiceCheck{
|
||||||
|
@ -116,6 +117,7 @@ func TestConsul_MakeChecks(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_InvalidPortLabelForService(t *testing.T) {
|
func TestConsul_InvalidPortLabelForService(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
task := &structs.Task{
|
task := &structs.Task{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Driver: "docker",
|
Driver: "docker",
|
||||||
|
@ -157,6 +159,7 @@ func TestConsul_InvalidPortLabelForService(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_Services_Deleted_From_Task(t *testing.T) {
|
func TestConsul_Services_Deleted_From_Task(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
c := newConsulService()
|
c := newConsulService()
|
||||||
task := structs.Task{
|
task := structs.Task{
|
||||||
Name: "redis",
|
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) {
|
func TestConsul_Service_Should_Be_Re_Reregistered_On_Change(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
c := newConsulService()
|
c := newConsulService()
|
||||||
task := newTask()
|
task := newTask()
|
||||||
s1 := structs.Service{
|
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) {
|
func TestConsul_AddCheck_To_Service(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
apiClient := &mockConsulApiClient{}
|
apiClient := &mockConsulApiClient{}
|
||||||
c := newConsulService()
|
c := newConsulService()
|
||||||
c.client = apiClient
|
c.client = apiClient
|
||||||
|
@ -245,6 +250,7 @@ func TestConsul_AddCheck_To_Service(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_ModifyCheck(t *testing.T) {
|
func TestConsul_ModifyCheck(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
apiClient := &mockConsulApiClient{}
|
apiClient := &mockConsulApiClient{}
|
||||||
c := newConsulService()
|
c := newConsulService()
|
||||||
c.client = apiClient
|
c.client = apiClient
|
||||||
|
@ -281,6 +287,7 @@ func TestConsul_ModifyCheck(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConsul_FilterNomadServicesAndChecks(t *testing.T) {
|
func TestConsul_FilterNomadServicesAndChecks(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
c := newConsulService()
|
c := newConsulService()
|
||||||
srvs := map[string]*consul.AgentService{
|
srvs := map[string]*consul.AgentService{
|
||||||
"foo-bar": {
|
"foo-bar": {
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDiffAllocs(t *testing.T) {
|
func TestDiffAllocs(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
alloc1 := mock.Alloc() // Ignore
|
alloc1 := mock.Alloc() // Ignore
|
||||||
alloc2 := mock.Alloc() // Update
|
alloc2 := mock.Alloc() // Update
|
||||||
alloc2u := new(structs.Allocation)
|
alloc2u := new(structs.Allocation)
|
||||||
|
@ -56,6 +57,7 @@ func TestDiffAllocs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRandomStagger(t *testing.T) {
|
func TestRandomStagger(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
intv := time.Minute
|
intv := time.Minute
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
stagger := randomStagger(intv)
|
stagger := randomStagger(intv)
|
||||||
|
@ -66,6 +68,7 @@ func TestRandomStagger(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestShuffleStrings(t *testing.T) {
|
func TestShuffleStrings(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// Generate input
|
// Generate input
|
||||||
inp := make([]string, 10)
|
inp := make([]string, 10)
|
||||||
for idx := range inp {
|
for idx := range inp {
|
||||||
|
@ -86,6 +89,7 @@ func TestShuffleStrings(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPersistRestoreState(t *testing.T) {
|
func TestPersistRestoreState(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
dir, err := ioutil.TempDir("", "nomad")
|
dir, err := ioutil.TempDir("", "nomad")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue