Skip to content

Commit

Permalink
Adding in support for a "No Project" setting for gcp:project, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rshade committed Nov 19, 2024
1 parent 01ba4e4 commit 30c4eb7
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 130 deletions.
4 changes: 3 additions & 1 deletion provider/errors/no_project.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
unable to detect a global setting for GCP Project.
Pulumi will rely on per-resource settings for this operation.
Set the GCP Project by using:
`pulumi config set gcp:project <project>`
`pulumi config set gcp:project <project>`
If you would like to override global project setting:
`pulumi config set gcp:project DisableGlobalProjectWarning`
18 changes: 18 additions & 0 deletions provider/provider_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ func TestNoGlobalProjectWarning(t *testing.T) {
)
}

func TestGlobalProjectNoProjectWarning(t *testing.T) {
if testing.Short() {
t.Skipf("Skipping in testing.Short() mode, assuming this is a CI run without GCP creds")
}
cwd, err := os.Getwd()
require.NoError(t, err)

test := pulumitest.NewPulumiTest(t, "test-programs/noproject-bucket",
opttest.LocalProviderPath(providerName, filepath.Join(cwd, "..", "bin")))

test.SetConfig(t, "gcpProj", noProjectVar)
res := test.Up(t)
require.Contains(
t, res.StdOut,
"No Project",
)
}

// Test programs that were automatically extracted from examples without autocorrection.
func TestAutoExtractedProgramsUpgrade(t *testing.T) {
type testCase struct {
Expand Down
Loading

0 comments on commit 30c4eb7

Please sign in to comment.