From 5a44b70f63a8bbbec741bf5f66a0ba1120611460 Mon Sep 17 00:00:00 2001 From: Max Leske Date: Thu, 8 Feb 2024 19:05:54 +0100 Subject: [PATCH] fix: always pass FTWTest as pointer --- .pre-commit-config.yaml | 2 +- runner/run.go | 4 ++-- runner/run_cloud_test.go | 2 +- runner/run_test.go | 2 +- test/files.go | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11611c7..5ff506d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: my-cmd name: go-cyclo alias: go-cyclo - args: [ go, cyclo, -over=15] + args: [ gocyclo, -over=15] - id: my-cmd name: "Check files aren't using go's testing package" entry: 'testing\.T' diff --git a/runner/run.go b/runner/run.go index 7ceb677..043e61f 100644 --- a/runner/run.go +++ b/runner/run.go @@ -25,7 +25,7 @@ import ( var errBadTestInput = errors.New("ftw/run: bad test input: choose between data, encoded_request, or raw_request") // Run runs your tests with the specified Config. -func Run(cfg *config.FTWConfiguration, tests []test.FTWTest, c RunnerConfig, out *output.Output) (*TestRunContext, error) { +func Run(cfg *config.FTWConfiguration, tests []*test.FTWTest, c RunnerConfig, out *output.Output) (*TestRunContext, error) { out.Println("%s", out.Message("** Running go-ftw!")) logLines, err := waflog.NewFTWLogLines(cfg) @@ -73,7 +73,7 @@ func Run(cfg *config.FTWConfiguration, tests []test.FTWTest, c RunnerConfig, out // RunTest runs an individual test. // runContext contains information for the current test run // ftwTest is the test you want to run -func RunTest(runContext *TestRunContext, ftwTest test.FTWTest) error { +func RunTest(runContext *TestRunContext, ftwTest *test.FTWTest) error { changed := true for _, testCase := range ftwTest.Tests { diff --git a/runner/run_cloud_test.go b/runner/run_cloud_test.go index 7704097..892d139 100644 --- a/runner/run_cloud_test.go +++ b/runner/run_cloud_test.go @@ -24,7 +24,7 @@ import ( type runCloudTestSuite struct { suite.Suite cfg *config.FTWConfiguration - ftwTests []test.FTWTest + ftwTests []*test.FTWTest out *output.Output ts *httptest.Server dest *ftwhttp.Destination diff --git a/runner/run_test.go b/runner/run_test.go index e05dfb2..062b3ab 100644 --- a/runner/run_test.go +++ b/runner/run_test.go @@ -100,7 +100,7 @@ var destinationMap = map[string]string{ type runTestSuite struct { suite.Suite cfg *config.FTWConfiguration - ftwTests []test.FTWTest + ftwTests []*test.FTWTest logFilePath string out *output.Output ts *httptest.Server diff --git a/test/files.go b/test/files.go index 7ffd6a0..5bf4ffd 100644 --- a/test/files.go +++ b/test/files.go @@ -15,8 +15,8 @@ import ( // GetTestsFromFiles will get the files to be processed. // If some file has yaml error, will stop processing and // return the error with the partial list of files read. -func GetTestsFromFiles(globPattern string) ([]FTWTest, error) { - var tests []FTWTest +func GetTestsFromFiles(globPattern string) ([]*FTWTest, error) { + var tests []*FTWTest var err error log.Trace().Msgf("ftw/test: using glob pattern %s", globPattern) @@ -42,7 +42,7 @@ func GetTestsFromFiles(globPattern string) ([]FTWTest, error) { } ftwTest.FileName = fileName - tests = append(tests, *ftwTest) + tests = append(tests, ftwTest) } if len(tests) == 0 {