Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static check failures in test/e2e/instrumentation/monitoring #87221

Merged
merged 1 commit into from Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion hack/.staticcheck_failures
Expand Up @@ -48,7 +48,6 @@ pkg/volume/vsphere_volume
test/e2e/apps
test/e2e/autoscaling
test/e2e/instrumentation/logging/stackdriver
test/e2e/instrumentation/monitoring
test/integration/deployment
test/integration/etcd
test/integration/examples
Expand Down
1 change: 1 addition & 0 deletions test/e2e/instrumentation/monitoring/BUILD
Expand Up @@ -48,6 +48,7 @@ go_library(
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
"//vendor/google.golang.org/api/monitoring/v3:go_default_library",
"//vendor/google.golang.org/api/option:go_default_library",
],
)

Expand Down
4 changes: 3 additions & 1 deletion test/e2e/instrumentation/monitoring/accelerator.go
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/onsi/ginkgo"
"golang.org/x/oauth2/google"
gcm "google.golang.org/api/monitoring/v3"
"google.golang.org/api/option"
)

// Stackdriver container accelerator metrics, as described here:
Expand Down Expand Up @@ -63,8 +64,9 @@ func testStackdriverAcceleratorMonitoring(f *framework.Framework) {

ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope)
framework.ExpectNoError(err)

gcmService, err := gcm.New(client)
gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client))

framework.ExpectNoError(err)

Expand Down
Expand Up @@ -38,6 +38,7 @@ import (

"github.com/onsi/ginkgo"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
)

const (
Expand Down Expand Up @@ -99,8 +100,9 @@ func testCustomMetrics(f *framework.Framework, kubeClient clientset.Interface, c

ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope)
framework.ExpectNoError(err)

gcmService, err := gcm.New(client)
gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client))
if err != nil {
framework.Failf("Failed to create gcm service, %v", err)
}
Expand Down Expand Up @@ -145,8 +147,9 @@ func testExternalMetrics(f *framework.Framework, kubeClient clientset.Interface,

ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope)
framework.ExpectNoError(err)

gcmService, err := gcm.New(client)
gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client))
if err != nil {
framework.Failf("Failed to create gcm service, %v", err)
}
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/instrumentation/monitoring/stackdriver.go
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/onsi/ginkgo"
"golang.org/x/oauth2/google"
gcm "google.golang.org/api/monitoring/v3"
"google.golang.org/api/option"
)

var (
Expand Down Expand Up @@ -76,6 +77,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per

ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope)
framework.ExpectNoError(err)

// Hack for running tests locally
// If this is your use case, create application default credentials:
Expand All @@ -90,7 +92,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per
client := oauth2.NewClient(oauth2.NoContext, ts)
*/

gcmService, err := gcm.New(client)
gcmService, err := gcm.NewService(ctx, option.WithHTTPClient(client))

// set this env var if accessing Stackdriver test endpoint (default is prod):
// $ export STACKDRIVER_API_ENDPOINT_OVERRIDE=https://test-monitoring.sandbox.googleapis.com/
Expand Down