Skip to content

Commit a4282b3

Browse files
committed
Allow credential based tests to be skipped
1 parent 62e1578 commit a4282b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

upcloud/service/service_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ func teardown() {
129129

130130
// TestGetAccount tests that the GetAccount() method returns proper data
131131
func TestGetAccount(t *testing.T) {
132+
if os.Getenv("UPCLOUD_GO_SDK_TEST_NO_CREDENTIALS") == "yes" {
133+
t.Skip("Skipping TestGetAccount...")
134+
}
135+
132136
svc := getService()
133137
account, err := svc.GetAccount()
134138
username, _ := getCredentials()
@@ -1322,6 +1326,10 @@ func handleError(err error) {
13221326

13231327
// Reads the API username and password from the environment, panics if they are not available
13241328
func getCredentials() (string, string) {
1329+
if os.Getenv("UPCLOUD_GO_SDK_TEST_NO_CREDENTIALS") == "yes" {
1330+
return "username", "password"
1331+
}
1332+
13251333
user := os.Getenv("UPCLOUD_GO_SDK_TEST_USER")
13261334
password := os.Getenv("UPCLOUD_GO_SDK_TEST_PASSWORD")
13271335

0 commit comments

Comments
 (0)