@@ -120,7 +120,7 @@ var _ = Describe("kubebuilder", func() {
120
120
By ("uncomment kustomize files to ensure that pods are restricted" )
121
121
uncommentPodStandards (kbc )
122
122
123
- Run (kbc , "memcached:1.4.36-alpine" )
123
+ Run (kbc )
124
124
})
125
125
126
126
It ("should generate a runnable project with deploy-image/v1-alpha without options " , func () {
@@ -162,13 +162,13 @@ var _ = Describe("kubebuilder", func() {
162
162
By ("uncomment kustomize files to ensure that pods are restricted" )
163
163
uncommentPodStandards (kbc )
164
164
165
- Run (kbc , "busybox:1.28" )
165
+ Run (kbc )
166
166
})
167
167
})
168
168
})
169
169
170
170
// Run runs a set of e2e tests for a scaffolded project defined by a TestContext.
171
- func Run (kbc * utils.TestContext , imageCR string ) {
171
+ func Run (kbc * utils.TestContext ) {
172
172
var controllerPodName string
173
173
var err error
174
174
@@ -249,42 +249,19 @@ func Run(kbc *utils.TestContext, imageCR string) {
249
249
return err
250
250
}, time .Minute , time .Second ).Should (Succeed ())
251
251
252
- By ("applying the CRD Editor Role" )
253
- crdEditorRole := filepath .Join ("config" , "rbac" ,
254
- fmt .Sprintf ("%s_editor_role.yaml" , strings .ToLower (kbc .Kind )))
255
- EventuallyWithOffset (1 , func () error {
256
- _ , err = kbc .Kubectl .Apply (true , "-f" , crdEditorRole )
257
- return err
258
- }, time .Minute , time .Second ).Should (Succeed ())
259
-
260
- By ("applying the CRD Viewer Role" )
261
- crdViewerRole := filepath .Join ("config" , "rbac" , fmt .Sprintf ("%s_viewer_role.yaml" , strings .ToLower (kbc .Kind )))
262
- EventuallyWithOffset (1 , func () error {
263
- _ , err = kbc .Kubectl .Apply (true , "-f" , crdViewerRole )
264
- return err
265
- }, time .Minute , time .Second ).Should (Succeed ())
266
-
267
- //TODO: We need to understand why it is not passing in the prow but is passing locally
268
- // By("validating that pod(s) status.phase=Running")
269
- // var podsOutput string
270
- // getPods := func() error {
271
- // podsOutput, err = kbc.Kubectl.Get(true, "pods", "-o",
272
- // "jsonpath={range .items[*]}{.metadata.name},{.status.phase} {end}")
273
- // if err == nil && strings.TrimSpace(podsOutput) == "" {
274
- // err = errors.New("empty pod output, continue")
275
- // }
276
-
277
- // return err
278
- // }
279
- // Eventually(getPods, 5*time.Minute, time.Second).Should(Succeed())
280
- // podSlice := strings.Split(strings.TrimSpace(podsOutput), " ")
281
- // Expect(len(podSlice)).To(BeNumerically(">", 0))
282
- // for _, pod := range podSlice {
283
- // // make sure any pod that contains the substring "memcached" is in the running state
284
- // if strings.Contains(pod, fmt.Sprintf("%s-sample", strings.ToLower(kbc.Kind))) {
285
- // Expect(pod).To(ContainSubstring(",Running"))
286
- // }
287
- // }
252
+ By ("validating that pod(s) status.phase=Running" )
253
+ getMemcachedPodStatus := func () error {
254
+ status , err := kbc .Kubectl .Get (true , "pods" , "-l" ,
255
+ fmt .Sprintf ("type=%s" , strings .ToLower (kbc .Kind )),
256
+ "-o" , "jsonpath={.items[*].status}" ,
257
+ )
258
+ ExpectWithOffset (2 , err ).NotTo (HaveOccurred ())
259
+ if ! strings .Contains (status , "\" phase\" :\" Running\" " ) {
260
+ return err
261
+ }
262
+ return nil
263
+ }
264
+ EventuallyWithOffset (1 , getMemcachedPodStatus , time .Minute , time .Second ).Should (Succeed ())
288
265
}
289
266
290
267
func uncommentPodStandards (kbc * utils.TestContext ) {
0 commit comments