istio.io/istio@v0.0.0-20240520182934-d79c90f27776/tests/integration/ambient/untaint/untaint_test.go (about) 1 //go:build integ 2 // +build integ 3 4 // Copyright Istio Authors 5 // 6 // Licensed under the Apache License, Version 2.0 (the "License"); 7 // you may not use this file except in compliance with the License. 8 // You may obtain a copy of the License at 9 // 10 // http://www.apache.org/licenses/LICENSE-2.0 11 // 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 // See the License for the specific language governing permissions and 16 // limitations under the License. 17 18 package untaint 19 20 import ( 21 "fmt" 22 "testing" 23 "time" 24 25 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 26 27 "istio.io/istio/pkg/test/framework" 28 "istio.io/istio/pkg/test/util/retry" 29 ) 30 31 func TestTaintsRemoved(t *testing.T) { 32 framework. 33 NewTest(t). 34 Run(func(ctx framework.TestContext) { 35 // make cni not deploy to one of the nodes 36 taintNodes(ctx) 37 38 // make sure all nodes were untainted 39 retry.UntilSuccessOrFail(t, func() error { 40 nodeC := ctx.Clusters().Default().Kube().CoreV1().Nodes() 41 nodes, err := nodeC.List(ctx.Context(), metav1.ListOptions{}) 42 if err != nil { 43 return err 44 } 45 46 for _, node := range nodes.Items { 47 for _, taint := range node.Spec.Taints { 48 if taint.Key == "cni.istio.io/not-ready" { 49 return fmt.Errorf("node %v still has taint %v", node.Name, taint) 50 } 51 } 52 } 53 return nil 54 }, retry.Delay(1*time.Second), retry.Timeout(80*time.Second)) 55 }) 56 }