@@ -19,6 +19,7 @@ package e2e_go_test
19
19
import (
20
20
"encoding/base64"
21
21
"encoding/json"
22
+ "errors"
22
23
"fmt"
23
24
"path/filepath"
24
25
"strings"
@@ -51,7 +52,8 @@ var _ = Describe("operator-sdk", func() {
51
52
testutils .WrapWarnOutput (tc .Kubectl .Command ("delete" , "clusterrolebinding" , metricsClusterRoleBindingName ))
52
53
53
54
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" ))
55
57
56
58
By ("ensuring that the namespace was deleted" )
57
59
testutils .WrapWarnOutput (tc .Kubectl .Wait (false , "namespace" , "foo" , "--for" , "delete" , "--timeout" , "2m" ))
@@ -174,8 +176,15 @@ var _ = Describe("operator-sdk", func() {
174
176
// The controller updates memcacheds' status.nodes with a list of pods it is replicated across
175
177
// on a successful reconcile.
176
178
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 ())
179
188
var nodes []string
180
189
Expect (json .Unmarshal ([]byte (status ), & nodes )).To (Succeed ())
181
190
Expect (len (nodes )).To (BeNumerically (">" , 0 ))
0 commit comments