diff options
Diffstat (limited to 'extras/hs-test/suite_no_topo_test.go')
-rw-r--r-- | extras/hs-test/suite_no_topo_test.go | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/extras/hs-test/suite_no_topo_test.go b/extras/hs-test/suite_no_topo_test.go index 260fc1d681d..af0cf9a197a 100644 --- a/extras/hs-test/suite_no_topo_test.go +++ b/extras/hs-test/suite_no_topo_test.go @@ -14,18 +14,18 @@ const ( tapInterfaceName = "htaphost" ) -var noTopoTests = []func(s *NoTopoSuite){} -var noTopoSoloTests = []func(s *NoTopoSuite){} +var noTopoTests = map[string][]func(s *NoTopoSuite){} +var noTopoSoloTests = map[string][]func(s *NoTopoSuite){} type NoTopoSuite struct { HstSuite } func registerNoTopoTests(tests ...func(s *NoTopoSuite)) { - noTopoTests = append(noTopoTests, tests...) + noTopoTests[getTestFilename()] = tests } func registerNoTopoSoloTests(tests ...func(s *NoTopoSuite)) { - noTopoSoloTests = append(noTopoSoloTests, tests...) + noTopoSoloTests[getTestFilename()] = tests } func (s *NoTopoSuite) SetupSuite() { @@ -68,15 +68,17 @@ var _ = Describe("NoTopoSuite", Ordered, ContinueOnFailure, func() { s.TearDownTest() }) - for _, test := range noTopoTests { - test := test - pc := reflect.ValueOf(test).Pointer() - funcValue := runtime.FuncForPC(pc) - testName := strings.Split(funcValue.Name(), ".")[2] - It(testName, func(ctx SpecContext) { - s.log(testName + ": BEGIN") - test(&s) - }, SpecTimeout(suiteTimeout)) + for filename, tests := range noTopoTests { + for _, test := range tests { + test := test + pc := reflect.ValueOf(test).Pointer() + funcValue := runtime.FuncForPC(pc) + testName := filename + "/" + strings.Split(funcValue.Name(), ".")[2] + It(testName, func(ctx SpecContext) { + s.log(testName + ": BEGIN") + test(&s) + }, SpecTimeout(suiteTimeout)) + } } }) @@ -95,14 +97,16 @@ var _ = Describe("NoTopoSuiteSolo", Ordered, ContinueOnFailure, Serial, func() { s.TearDownTest() }) - for _, test := range noTopoSoloTests { - test := test - pc := reflect.ValueOf(test).Pointer() - funcValue := runtime.FuncForPC(pc) - testName := strings.Split(funcValue.Name(), ".")[2] - It(testName, Label("SOLO"), func(ctx SpecContext) { - s.log(testName + ": BEGIN") - test(&s) - }, SpecTimeout(suiteTimeout)) + for filename, tests := range noTopoSoloTests { + for _, test := range tests { + test := test + pc := reflect.ValueOf(test).Pointer() + funcValue := runtime.FuncForPC(pc) + testName := filename + "/" + strings.Split(funcValue.Name(), ".")[2] + It(testName, Label("SOLO"), func(ctx SpecContext) { + s.log(testName + ": BEGIN") + test(&s) + }, SpecTimeout(suiteTimeout)) + } } }) |