@@ -28,6 +28,7 @@ import (
2828 . "github.com/onsi/gomega"
2929 corev1 "k8s.io/api/core/v1"
3030 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31+ "k8s.io/apimachinery/pkg/util/wait"
3132
3233 "github.com/cert-manager/istio-csr/test/e2e/framework"
3334)
@@ -76,12 +77,27 @@ var _ = framework.CasesDescribe("CA Root Controller", func() {
7677
7778 It ("all namespaces should have valid configs in" , func () {
7879 By ("ensure all existing namespaces have the correct root CA" )
79- nss , err := f .KubeClientSet .CoreV1 ().Namespaces ().List (ctx , metav1.ListOptions {})
80- Expect (err ).NotTo (HaveOccurred ())
8180
82- for _ , ns := range nss .Items {
83- Expect (expectRootCAExists (ctx , f , ns .Name , rootCA )).NotTo (HaveOccurred ())
84- }
81+ err := wait .PollImmediate (time .Second , time .Second * 30 ,
82+ func () (bool , error ) {
83+ nss , err := f .KubeClientSet .CoreV1 ().Namespaces ().List (ctx , metav1.ListOptions {})
84+ if err != nil {
85+ return false , err
86+ }
87+
88+ for _ , ns := range nss .Items {
89+ err = expectRootCAExists (ctx , f , ns .Name , rootCA )
90+ if err != nil {
91+ By (fmt .Sprintf ("rootCA not yet propagated: %s" , err ))
92+ return false , nil
93+ }
94+ }
95+
96+ return true , nil
97+ },
98+ )
99+
100+ Expect (err ).NotTo (HaveOccurred ())
85101 })
86102
87103 It ("should correctly update when a namespace updates and config map changes" , func () {
0 commit comments