pulumi/pkg/testing/integration
Abhinav Gupta 6d93918a13 testing/integration: Fix failure without GOPATH
TestGoModEdits requires that one of the following conditions
be true for the test to pass:

- pulumi/pulumi is checked out at $GOPATH/src/github.com/pulumi/pulumi
- PULUMI_GO_DEP_ROOT is set to the directory where it's checked out

With wide usage of Go modules,
we're less likely to have folks working under GOPATH.

As for PULUMI_GO_DEP_ROOT, it makes sense for the generic utility:
Being able to specify where the dependency is checked out
is useful on a per-project basis,
but it makes less sense for this test.
This test is specifically checking the values inside the sdk/go.mod
and the path for that is always fixed.

This change modifies TestGoModEdits to pass
no matter where the repository is checked out
-- as long as it's called "pulumi".
It does so by hard-coding the position of the repository root
relative to the test directory.

This *feels* slightly icky because depRoot refers to the directory
that contains the "pulumi" directory,
but I think that this is less likely to break and easier to fix,
versus looking for a go.mod file or a .git directory
as the project structure evolves over time.
2022-12-29 17:38:44 -08:00
..
command.go Don't disable ambiant providers during tests (#9404) 2022-04-15 11:14:47 +02:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
program.go Improve ProgramTest errors and path handling for Go programs 2022-12-13 06:53:09 -08:00
program_test.go testing/integration: Fix failure without GOPATH 2022-12-29 17:38:44 -08:00
pulumi.go Fix tests that have incomplete project config. Correct docs for CreatePulumiRepo 2022-10-04 21:29:42 +02:00
s3reporter.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
util.go refactor: use `os.ReadDir` for lightweight directory reading 2022-09-24 15:20:43 +08:00