Skip to content

Commit

Permalink
test: refactor idtoken test (#921)
Browse files Browse the repository at this point in the history
- move them into the idtoken package
- use ADC var name as some tests require the fallback
- remove my locally sourced creds
- remove build tag restricting run
  • Loading branch information
codyoss committed Mar 15, 2021
1 parent 3e8a51c commit 1d307bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build integration

package idtoken
package idtoken_test

import (
"context"
Expand All @@ -20,7 +18,7 @@ import (
)

const (
envCredentialFile = "GCLOUD_TESTS_GOLANG_KEY"
envCredentialFile = "GOOGLE_APPLICATION_CREDENTIALS"

aud = "http://example.com"
)
Expand All @@ -29,7 +27,6 @@ func TestNewTokenSource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
os.Setenv(envCredentialFile, "/Users/codyoss/creds/codyoss-workspace-2b1fb7cd40c0.json")
ts, err := idtoken.NewTokenSource(context.Background(), "http://example.com", option.WithCredentialsFile(os.Getenv(envCredentialFile)))
if err != nil {
t.Fatalf("unable to create TokenSource: %v", err)
Expand All @@ -56,7 +53,6 @@ func TestNewClient_WithCredentialFile(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
os.Setenv(envCredentialFile, "/Users/codyoss/creds/codyoss-workspace-2b1fb7cd40c0.json")
client, err := idtoken.NewClient(context.Background(), aud, option.WithCredentialsFile(os.Getenv(envCredentialFile)))
if err != nil {
t.Fatalf("unable to create Client: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/kokoro/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Fail on any error
set -eo pipefail

export GCLOUD_TESTS_GOLANG_KEY="${KOKORO_GFILE_DIR}/secret_manager/go-cloud-integration-service-account"
export GOOGLE_APPLICATION_CREDENTIALS="${KOKORO_GFILE_DIR}/secret_manager/go-cloud-integration-service-account"

# Display commands being run
set -x
Expand Down

0 comments on commit 1d307bf

Please sign in to comment.