From f82bf07a6eba450666584677eaaed8cc8c07168e Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 2 Jul 2026 14:30:13 -0700 Subject: [PATCH] try to reduce integration test flake after pod restart Signed-off-by: Ryan Richard --- .../integration/limited_ciphers_utils_test.go | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/integration/limited_ciphers_utils_test.go b/test/integration/limited_ciphers_utils_test.go index 3b6682bcb..aecaf3c4c 100644 --- a/test/integration/limited_ciphers_utils_test.go +++ b/test/integration/limited_ciphers_utils_test.go @@ -1,4 +1,4 @@ -// Copyright 2024-2025 the Pinniped contributors. All Rights Reserved. +// Copyright 2024-2026 the Pinniped contributors. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package integration @@ -14,6 +14,8 @@ import ( "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" + apiregistrationv1helper "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1/helper" "sigs.k8s.io/yaml" "go.pinniped.dev/internal/config/concierge" @@ -216,6 +218,23 @@ func restartAllPodsOfApp( requireEventually.Equal(len(newPods), int(originalScale), "wanted pods to return to original scale") requireEventually.True(allPodsReady(newPods), "wanted all new pods to be ready") }, 2*time.Minute, 200*time.Millisecond) + + // Wait for all the APIServices belonging to this app to become available again. + aggregatedClient := testlib.NewAggregatedClientset(t) + testlib.RequireEventually(t, func(requireEventually *require.Assertions) { + listCtx, listCancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer listCancel() + apiServices, err := aggregatedClient.ApiregistrationV1().APIServices().List(listCtx, metav1.ListOptions{ + LabelSelector: "app=" + appName, + }) + requireEventually.NoError(err) + for _, apiService := range apiServices.Items { + requireEventually.True( + apiregistrationv1helper.IsAPIServiceConditionTrue(&apiService, apiregistrationv1.Available), + "wanted APIService %q to have condition Available=True", apiService.Name, + ) + } + }, 2*time.Minute, 200*time.Millisecond) } // Even if the test fails due to the below assertions, still try to scale back to original scale,