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

This commit is contained in:
YuikoTakada 2020-01-15 00:36:45 +00:00
parent 5d1c301610
commit aa2691eeac
5 changed files with 12 additions and 5 deletions

View File

@ -48,7 +48,6 @@ pkg/volume/vsphere_volume
test/e2e/apps test/e2e/apps
test/e2e/autoscaling test/e2e/autoscaling
test/e2e/instrumentation/logging/stackdriver test/e2e/instrumentation/logging/stackdriver
test/e2e/instrumentation/monitoring
test/integration/deployment test/integration/deployment
test/integration/etcd test/integration/etcd
test/integration/examples test/integration/examples

View File

@ -48,6 +48,7 @@ go_library(
"//vendor/github.com/onsi/gomega:go_default_library", "//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/golang.org/x/oauth2/google: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/monitoring/v3:go_default_library",
"//vendor/google.golang.org/api/option:go_default_library",
], ],
) )

View File

@ -35,6 +35,7 @@ import (
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"golang.org/x/oauth2/google" "golang.org/x/oauth2/google"
gcm "google.golang.org/api/monitoring/v3" gcm "google.golang.org/api/monitoring/v3"
"google.golang.org/api/option"
) )
// Stackdriver container accelerator metrics, as described here: // Stackdriver container accelerator metrics, as described here:
@ -63,8 +64,9 @@ func testStackdriverAcceleratorMonitoring(f *framework.Framework) {
ctx := context.Background() ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) 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) framework.ExpectNoError(err)

View File

@ -38,6 +38,7 @@ import (
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"golang.org/x/oauth2/google" "golang.org/x/oauth2/google"
"google.golang.org/api/option"
) )
const ( const (
@ -99,8 +100,9 @@ func testCustomMetrics(f *framework.Framework, kubeClient clientset.Interface, c
ctx := context.Background() ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) 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 { if err != nil {
framework.Failf("Failed to create gcm service, %v", err) framework.Failf("Failed to create gcm service, %v", err)
} }
@ -145,8 +147,9 @@ func testExternalMetrics(f *framework.Framework, kubeClient clientset.Interface,
ctx := context.Background() ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) 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 { if err != nil {
framework.Failf("Failed to create gcm service, %v", err) framework.Failf("Failed to create gcm service, %v", err)
} }

View File

@ -32,6 +32,7 @@ import (
"github.com/onsi/ginkgo" "github.com/onsi/ginkgo"
"golang.org/x/oauth2/google" "golang.org/x/oauth2/google"
gcm "google.golang.org/api/monitoring/v3" gcm "google.golang.org/api/monitoring/v3"
"google.golang.org/api/option"
) )
var ( var (
@ -76,6 +77,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per
ctx := context.Background() ctx := context.Background()
client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope) client, err := google.DefaultClient(ctx, gcm.CloudPlatformScope)
framework.ExpectNoError(err)
// Hack for running tests locally // Hack for running tests locally
// If this is your use case, create application default credentials: // If this is your use case, create application default credentials:
@ -90,7 +92,7 @@ func testStackdriverMonitoring(f *framework.Framework, pods, allPodsCPU int, per
client := oauth2.NewClient(oauth2.NoContext, ts) 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): // set this env var if accessing Stackdriver test endpoint (default is prod):
// $ export STACKDRIVER_API_ENDPOINT_OVERRIDE=https://test-monitoring.sandbox.googleapis.com/ // $ export STACKDRIVER_API_ENDPOINT_OVERRIDE=https://test-monitoring.sandbox.googleapis.com/