Skip to content

Commit

Permalink
fix: always pass FTWTest as pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
theseion authored and fzipi committed Feb 8, 2024
1 parent f3fec1b commit 5a44b70
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions runner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion runner/run_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion runner/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 5a44b70

Please sign in to comment.