From 0e527da8a970a0460b80bf83792bc5d683cee8de Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 13 Jan 2021 18:38:49 -0800 Subject: [PATCH] Removing IsConfigRequired --- internal/testrunner/runners/asset/runner.go | 5 --- .../testrunner/runners/pipeline/runner.go | 5 --- internal/testrunner/runners/system/runner.go | 5 --- internal/testrunner/testrunner.go | 31 ++----------------- 4 files changed, 2 insertions(+), 44 deletions(-) diff --git a/internal/testrunner/runners/asset/runner.go b/internal/testrunner/runners/asset/runner.go index 7a5b6887f2..655d8916f9 100644 --- a/internal/testrunner/runners/asset/runner.go +++ b/internal/testrunner/runners/asset/runner.go @@ -54,11 +54,6 @@ func (r runner) CanRunPerDataStream() bool { return false } -// IsConfigRequired returns whether this test runner needs configuration. -func (r runner) IsConfigRequired() bool { - return false -} - // Run runs the asset loading tests func (r runner) Run(options testrunner.TestOptions) ([]testrunner.TestResult, error) { r.testFolder = options.TestFolder diff --git a/internal/testrunner/runners/pipeline/runner.go b/internal/testrunner/runners/pipeline/runner.go index 16d9741467..5a909e898d 100644 --- a/internal/testrunner/runners/pipeline/runner.go +++ b/internal/testrunner/runners/pipeline/runner.go @@ -59,11 +59,6 @@ func (r *runner) CanRunPerDataStream() bool { return true } -// IsConfigRequired returns whether this test runner needs configuration. -func (r *runner) IsConfigRequired() bool { - return true -} - func (r *runner) run() ([]testrunner.TestResult, error) { testCaseFiles, err := r.listTestCaseFiles() if err != nil { diff --git a/internal/testrunner/runners/system/runner.go b/internal/testrunner/runners/system/runner.go index 33736d02e2..d229ccf63b 100644 --- a/internal/testrunner/runners/system/runner.go +++ b/internal/testrunner/runners/system/runner.go @@ -67,11 +67,6 @@ func (r *runner) CanRunPerDataStream() bool { return true } -// IsConfigRequired returns whether this test runner needs configuration. -func (r *runner) IsConfigRequired() bool { - return true -} - // Run runs the system tests defined under the given folder func (r *runner) Run(options testrunner.TestOptions) ([]testrunner.TestResult, error) { r.options = options diff --git a/internal/testrunner/testrunner.go b/internal/testrunner/testrunner.go index 9b0f5e3574..9ef57b05f4 100644 --- a/internal/testrunner/testrunner.go +++ b/internal/testrunner/testrunner.go @@ -47,7 +47,6 @@ type TestRunner interface { TearDown() error CanRunPerDataStream() bool - IsConfigRequired() bool } var runners = map[TestType]TestRunner{} @@ -183,44 +182,18 @@ func Run(testType TestType, options TestOptions) ([]TestResult, error) { return results, nil } -// NoConfigTestRunners returns test runners that don't need configuration. -func NoConfigTestRunners() []TestRunner { - noConfigRunners := make([]TestRunner, 0) - for _, runner := range runners { - if !runner.IsConfigRequired() { - noConfigRunners = append(noConfigRunners, runner) - } - } - - return noConfigRunners -} - // TestRunners returns registered test runners. func TestRunners() map[TestType]TestRunner { return runners } +// findTestFoldersPaths can only be called for test runners that require tests to be defined +// at the data stream level. func findTestFolderPaths(packageRootPath, dataStreamGlob, testTypeGlob string) ([]string, error) { testFoldersGlob := filepath.Join(packageRootPath, "data_stream", dataStreamGlob, "_dev", "test", testTypeGlob) paths, err := filepath.Glob(testFoldersGlob) if err != nil { return nil, errors.Wrap(err, "error finding test folders") } - - // Handle test types that don't need configuration folders. - dataStreamFoldersGlob := filepath.Join(packageRootPath, "data_stream", dataStreamGlob) - dataStreamFolderPaths, err := filepath.Glob(dataStreamFoldersGlob) - if err != nil { - return nil, errors.Wrap(err, "error finding data stream folders") - } - for _, noConfigRunner := range NoConfigTestRunners() { - t := noConfigRunner.Type() - if testTypeGlob == "*" || testTypeGlob == string(t) { - for _, p := range dataStreamFolderPaths { - paths = append(paths, filepath.Join(p, string(t))) - } - } - } - return paths, err }