Skip to content

Commit

Permalink
Merge #11647
Browse files Browse the repository at this point in the history
11647: Fix test failure on Windows r=AaronFriel a=AaronFriel

PR #11611 assumed a unix-y error message in one of the failure cases of the test `TestGoModEdits`. This case did not match on Windows:

```
=== FAIL: testing/integration TestGoModEdits/invalid-path-non-existent (0.00s)
    program_test.go:170: 
        	Error Trace:	C:\a\pulumi\pulumi\pkg\testing\integration\program_test.go:170
        	Error:      	Error "error reading go.mod at ../../../.tmp.non-existent-dir: open ..\\..\\..\\.tmp.non-existent-dir\\go.mod: The system cannot find the path specified." does not contain "open ../../../.tmp.non-existent-dir/go.mod: no such file or directory"
        	Test:       	TestGoModEdits/invalid-path-non-existent
    --- FAIL: TestGoModEdits/invalid-path-non-existent (0.00s)
```


Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
  • Loading branch information
bors[bot] and AaronFriel committed Dec 14, 2022
2 parents 685f2e2 + 576bc08 commit 8922b44
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/testing/integration/program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -116,6 +117,11 @@ func TestGoModEdits(t *testing.T) {
`), 0600)
require.NoError(t, err)

errNotExists := "no such file or directory"
if runtime.GOOS == "windows" {
errNotExists = "The system cannot find the path specified"
}

tests := []struct {
name string
dep string
Expand All @@ -130,7 +136,7 @@ func TestGoModEdits(t *testing.T) {
{
name: "invalid-path-non-existent",
dep: "../../../.tmp.non-existent-dir",
expectedError: "open ../../../.tmp.non-existent-dir/go.mod: no such file or directory",
expectedError: errNotExists,
},
{
name: "invalid-path-bad-go-mod",
Expand Down

0 comments on commit 8922b44

Please sign in to comment.