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

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 // SPDX-License-Identifier: Apache-2.0
package integration package integration
@ -32,19 +32,20 @@ func runTestKubectlCommand(t *testing.T, args ...string) (string, string) {
func requireCleanKubectlStderr(t *testing.T, stderr string) { func requireCleanKubectlStderr(t *testing.T, stderr string) {
// Every line must be empty or contain a known, innocuous warning. // Every line must be empty or contain a known, innocuous warning.
for _, line := range strings.Split(stderr, "\n") { for _, line := range strings.Split(stderr, "\n") {
if strings.TrimSpace(line) == "" { switch {
continue case strings.TrimSpace(line) == "",
} strings.Contains(line, "Throttling request took"),
if strings.Contains(line, "Throttling request took") { strings.Contains(line, "due to client-side throttling, not priority and fairness"),
continue 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"):
if strings.Contains(line, "due to client-side throttling, not priority and fairness") { // ignore these allowed stderr lines
continue default:
} // anything else is a failure
require.Failf(t, "unexpected kubectl stderr", "kubectl produced unexpected stderr:\n%s\n\n", stderr) require.Failf(t, "unexpected kubectl stderr", "kubectl produced unexpected stderr:\n%s\n\n", stderr)
return return
} }
} }
}
func TestGetPinnipedCategory(t *testing.T) { func TestGetPinnipedCategory(t *testing.T) {
env := testlib.IntegrationEnv(t) env := testlib.IntegrationEnv(t)