Skip to content

Commit

Permalink
fix env issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Oren committed Mar 23, 2023
1 parent 6e20eab commit f4d0eb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package stackit
import (
"context"
"net/http"
"os"
"reflect"
"testing"
"time"
Expand All @@ -11,6 +12,13 @@ import (
)

func TestNew(t *testing.T) {
eml := os.Getenv("STACKIT_SERVICE_ACCOUNT_EMAIL")
tok := os.Getenv("STACKIT_SERVICE_ACCOUNT_TOKEN")
env := os.Getenv("STACKIT_ENV")
os.Setenv("STACKIT_SERVICE_ACCOUNT_EMAIL", "")
os.Setenv("STACKIT_SERVICE_ACCOUNT_TOKEN", "")
os.Setenv("STACKIT_ENV", "")

cfg := Config{
ServiceAccountToken: "token",
ServiceAccountEmail: "sa-id",
Expand Down Expand Up @@ -41,6 +49,9 @@ func TestNew(t *testing.T) {
}
})
}
os.Setenv("STACKIT_SERVICE_ACCOUNT_EMAIL", eml)
os.Setenv("STACKIT_SERVICE_ACCOUNT_TOKEN", tok)
os.Setenv("STACKIT_ENV", env)
}

func TestClient_DoWithRetry(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func LocalClient() (*client.Client, error) {
return nil, errors.New("STACKIT_SERVICE_ACCOUNT_TOKEN is missing from env variables")
}

return client.New(context.Background(), client.Config{
return client.NewClientWithConfig(context.Background(), client.Config{
ServiceAccountEmail: aid,
ServiceAccountToken: ato,
})
Expand Down

0 comments on commit f4d0eb8

Please sign in to comment.