diff --git a/test/e2e_node/node_shutdown_linux_test.go b/test/e2e_node/node_shutdown_linux_test.go index f0941587016..4d3b93b98fe 100644 --- a/test/e2e_node/node_shutdown_linux_test.go +++ b/test/e2e_node/node_shutdown_linux_test.go @@ -28,6 +28,7 @@ import ( "strconv" "time" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/fields" "github.com/onsi/ginkgo" @@ -223,8 +224,9 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut ginkgo.Context("when gracefully shutting down with Pod priority", func() { const ( - pollInterval = 1 * time.Second - podStatusUpdateTimeout = 10 * time.Second + pollInterval = 1 * time.Second + podStatusUpdateTimeout = 10 * time.Second + priorityClassesCreateTimeout = 10 * time.Second ) var ( @@ -271,11 +273,22 @@ var _ = SIGDescribe("GracefulNodeShutdown [Serial] [NodeFeature:GracefulNodeShut ginkgo.By("Wait for the node to be ready") waitForNodeReady() - - for _, customClass := range []*schedulingv1.PriorityClass{customClassA, customClassB, customClassC} { + customClasses := []*schedulingv1.PriorityClass{customClassA, customClassB, customClassC} + for _, customClass := range customClasses { _, err := f.ClientSet.SchedulingV1().PriorityClasses().Create(context.Background(), customClass, metav1.CreateOptions{}) - framework.ExpectNoError(err) + if err != nil && !apierrors.IsAlreadyExists(err) { + framework.ExpectNoError(err) + } } + gomega.Eventually(func() error { + for _, customClass := range customClasses { + _, err := f.ClientSet.SchedulingV1().PriorityClasses().Get(context.Background(), customClass.Name, metav1.GetOptions{}) + if err != nil { + return err + } + } + return nil + }, priorityClassesCreateTimeout, pollInterval).Should(gomega.BeNil()) }) ginkgo.AfterEach(func() {