diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 09:25:58 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | 27525f1d426a4ec4e4a0d29ea05d42a8804e996c (patch) | |
tree | b416f19fb69109f015a7bacf9f87b76a25031f2b /pkg | |
parent | 43a9dc48e01dcc773997df09411d20ed79c1b6bb (diff) |
support passing extra command args in integration tests
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/integration/integration.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/integration/integration.go b/pkg/integration/integration.go index 32c0e9ff0..c97b4e5ff 100644 --- a/pkg/integration/integration.go +++ b/pkg/integration/integration.go @@ -15,9 +15,10 @@ import ( ) type Test struct { - Name string `json:"name"` - Speed float64 `json:"speed"` - Description string `json:"description"` + Name string `json:"name"` + Speed float64 `json:"speed"` + Description string `json:"description"` + ExtraCmdArgs string `json:"extraCmdArgs"` } // this function is used by both `go test` and from our lazyintegration gui, but @@ -75,7 +76,7 @@ func RunTests( configDir := filepath.Join(testPath, "used_config") - cmd, err := getLazygitCommand(testPath, rootDir, record, speed) + cmd, err := getLazygitCommand(testPath, rootDir, record, speed, test.ExtraCmdArgs) if err != nil { return err } @@ -338,7 +339,7 @@ func generateSnapshots(actualDir string, expectedDir string) (string, string, er return actual, expected, nil } -func getLazygitCommand(testPath string, rootDir string, record bool, speed float64) (*exec.Cmd, error) { +func getLazygitCommand(testPath string, rootDir string, record bool, speed float64, extraCmdArgs string) (*exec.Cmd, error) { osCommand := oscommands.NewDummyOSCommand() replayPath := filepath.Join(testPath, "recording.json") @@ -365,7 +366,7 @@ func getLazygitCommand(testPath string, rootDir string, record bool, speed float return nil, err } - cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s", tempLazygitPath(), configDir, actualDir) + cmdStr := fmt.Sprintf("%s -debug --use-config-dir=%s --path=%s %s", tempLazygitPath(), configDir, actualDir, extraCmdArgs) cmd := osCommand.ExecutableFromString(cmdStr) cmd.Env = append(cmd.Env, fmt.Sprintf("SPEED=%f", speed)) |