@@ -19,6 +19,7 @@ package e2e_go_test
1919import (
2020 "encoding/base64"
2121 "encoding/json"
22+ "errors"
2223 "fmt"
2324 "path/filepath"
2425 "strings"
@@ -51,7 +52,8 @@ var _ = Describe("operator-sdk", func() {
5152 testutils .WrapWarnOutput (tc .Kubectl .Command ("delete" , "clusterrolebinding" , metricsClusterRoleBindingName ))
5253
5354 By ("cleaning up created API objects during test process" )
54- tc .CleanupManifests (filepath .Join ("config" , "default" ))
55+ // TODO(estroz): go/v2 does not have this target, so generalize once tests are refactored.
56+ testutils .WrapWarn (tc .Make ("undeploy" ))
5557
5658 By ("ensuring that the namespace was deleted" )
5759 testutils .WrapWarnOutput (tc .Kubectl .Wait (false , "namespace" , "foo" , "--for" , "delete" , "--timeout" , "2m" ))
@@ -174,8 +176,15 @@ var _ = Describe("operator-sdk", func() {
174176 // The controller updates memcacheds' status.nodes with a list of pods it is replicated across
175177 // on a successful reconcile.
176178 By ("validating that the created resource object gets reconciled in the controller" )
177- status , err := tc .Kubectl .Get (true , "memcacheds" , "memcached-sample" , "-o" , "jsonpath={.status.nodes}" )
178- Expect (err ).NotTo (HaveOccurred ())
179+ var status string
180+ getStatus := func () error {
181+ status , err = tc .Kubectl .Get (true , "memcacheds" , "memcached-sample" , "-o" , "jsonpath={.status.nodes}" )
182+ if err == nil && strings .TrimSpace (status ) == "" {
183+ err = errors .New ("empty status, continue" )
184+ }
185+ return err
186+ }
187+ Eventually (getStatus , 1 * time .Minute , time .Second ).Should (Succeed ())
179188 var nodes []string
180189 Expect (json .Unmarshal ([]byte (status ), & nodes )).To (Succeed ())
181190 Expect (len (nodes )).To (BeNumerically (">" , 0 ))
0 commit comments