Allow new warning messages about GCP plugin in TestGetPinnipedCategory

This commit is contained in:
Ryan Richard 2022-06-08 10:22:15 -07:00
parent cc1163e326
commit dd61ada540
1 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2021 the Pinniped contributors. All Rights Reserved.
// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package integration
@ -32,18 +32,19 @@ func runTestKubectlCommand(t *testing.T, args ...string) (string, string) {
func requireCleanKubectlStderr(t *testing.T, stderr string) {
// Every line must be empty or contain a known, innocuous warning.
for _, line := range strings.Split(stderr, "\n") {
if strings.TrimSpace(line) == "" {
continue
}
if strings.Contains(line, "Throttling request took") {
continue
}
if strings.Contains(line, "due to client-side throttling, not priority and fairness") {
continue
}
switch {
case strings.TrimSpace(line) == "",
strings.Contains(line, "Throttling request took"),
strings.Contains(line, "due to client-side throttling, not priority and fairness"),
strings.Contains(line, "the gcp auth plugin is deprecated in v1.22+, unavailable in v1.25+; use gcloud instead"),
strings.Contains(line, "To learn more, consult https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke"):
// ignore these allowed stderr lines
default:
// anything else is a failure
require.Failf(t, "unexpected kubectl stderr", "kubectl produced unexpected stderr:\n%s\n\n", stderr)
return
}
}
}
func TestGetPinnipedCategory(t *testing.T) {