This commit is contained in:
Jesse Duffield 2023-05-26 19:04:11 +10:00
parent 9c7db3a37b
commit 8b15f22379
5 changed files with 12 additions and 11 deletions

6
.vscode/tasks.json vendored
View file

@ -24,7 +24,7 @@
{
"label": "Run current file integration test",
"type": "shell",
"command": "go generate pkg/integration/tests/tests.go && go run cmd/integration_test/main.go cli ${relativeFile}",
"command": "go run cmd/integration_test/main.go cli ${relativeFile}",
"problemMatcher": [],
"group": {
"kind": "test",
@ -37,7 +37,7 @@
{
"label": "Run current file integration test (slow)",
"type": "shell",
"command": "go generate pkg/integration/tests/tests.go && go run cmd/integration_test/main.go cli --slow ${relativeFile}",
"command": "go run cmd/integration_test/main.go cli --slow ${relativeFile}",
"problemMatcher": [],
"group": {
"kind": "test",
@ -49,7 +49,7 @@
{
"label": "Run current file integration test (sandbox)",
"type": "shell",
"command": "go generate pkg/integration/tests/tests.go && go run cmd/integration_test/main.go cli --sandbox ${relativeFile}",
"command": "go run cmd/integration_test/main.go cli --sandbox ${relativeFile}",
"problemMatcher": [],
"group": {
"kind": "test",

View file

@ -29,8 +29,6 @@ func TestIntegration(t *testing.T) {
tests := tests.GetTests()
tests = tests[0:3]
err := components.RunTests(
tests,
t.Logf,
@ -46,7 +44,7 @@ func TestIntegration(t *testing.T) {
// }
t.Run(test.Name(), func(t *testing.T) {
// t.Parallel()
t.Parallel()
err := f()
assert.NoError(t, err)
})
@ -98,6 +96,7 @@ func runCmdHeadless(cmd *exec.Cmd) error {
if !result.Success {
return errors.New(result.Message)
}
fmt.Printf("test succeeded")
return nil
}

View file

@ -18,7 +18,7 @@ func retryWaitTimes() []int {
// give it more leeway compared to when we're running things locally.
return []int{0, 1, 1, 1, 1, 1, 5, 10, 20, 40, 100, 200, 500, 1000, 2000, 4000}
} else {
return []int{0, 1, 1, 1, 1, 1}
return []int{0, 1, 1, 1, 1, 1, 5, 10, 20, 40, 100, 200, 500, 1000, 2000, 4000}
}
}

View file

@ -40,7 +40,9 @@ func success() IntegrationTestResult {
func writeResult(result IntegrationTestResult) error {
resultPath := os.Getenv(PathEnvVar)
if resultPath == "" {
return fmt.Errorf("Environment variable %s not set", PathEnvVar)
panic("path env var not set!")
// path env var not set so we'll assume we don't need to write the result to a file
return nil
}
file, err := os.Create(resultPath)
@ -62,7 +64,7 @@ func writeResult(result IntegrationTestResult) error {
func ReadResult(resultPath string) (IntegrationTestResult, error) {
file, err := os.Open(resultPath)
if err != nil {
return IntegrationTestResult{}, fmt.Errorf("Error creating file: %w", err)
return IntegrationTestResult{}, fmt.Errorf("Error reading file: %w", err)
}
decoder := json.NewDecoder(file)
@ -74,7 +76,7 @@ func ReadResult(resultPath string) (IntegrationTestResult, error) {
}
file.Close()
_ = os.Remove(resultPath)
// _ = os.Remove(resultPath)
return result, nil
}

View file

@ -55,7 +55,7 @@ var Commit = NewIntegrationTest(NewIntegrationTestArgs{
IsFocused().
Lines(
Contains("A myfile"),
Contains("A myfile2"),
Contains("A myfile3"),
)
},
})