Skip to content

Commit

Permalink
Made check for creds vars in sweepers match test runs (#4755) (#9055)
Browse files Browse the repository at this point in the history
Specifically, checking the result of multiEnvSearch to see if a var is set, then getting the correct creds value with getTestCredsFromEnv is how TestAcc precheck works. This means that the default creds value can be true (and pass validation) but the actual used creds value will still be an empty string

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored May 3, 2021
1 parent a553acf commit fb5f35b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/4755.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
5 changes: 2 additions & 3 deletions google/gcp_sweeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ func sharedConfigForRegion(region string) (*Config, error) {
return nil, fmt.Errorf("set project using any of these env variables %v", projectEnvVars)
}

creds := getTestCredsFromEnv()
if creds == "" {
if v := multiEnvSearch(credsEnvVars); v == "" {
return nil, fmt.Errorf("set credentials using any of these env variables %v", credsEnvVars)
}

conf := &Config{
Credentials: creds,
Credentials: getTestCredsFromEnv(),
Region: region,
Project: project,
}
Expand Down

0 comments on commit fb5f35b

Please sign in to comment.