Skip to content

Commit

Permalink
Removing IsConfigRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Jan 14, 2021
1 parent 6bda6ef commit 0e527da
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 44 deletions.
5 changes: 0 additions & 5 deletions internal/testrunner/runners/asset/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions internal/testrunner/runners/pipeline/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 0 additions & 5 deletions internal/testrunner/runners/system/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 2 additions & 29 deletions internal/testrunner/testrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type TestRunner interface {
TearDown() error

CanRunPerDataStream() bool
IsConfigRequired() bool
}

var runners = map[TestType]TestRunner{}
Expand Down Expand Up @@ -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
}

0 comments on commit 0e527da

Please sign in to comment.