Skip to content

Commit 8bbb054

Browse files
committed
Fixed bug in docker file
Reduced noise in e2e test.
1 parent ea18fcc commit 8bbb054

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,6 @@ kubernetes.tar.gz
125125
/bazel-*
126126
*.pyc
127127

128+
# .devcontainer files
129+
.devcontainer
130+

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM registry.access.redhat.com/ubi8/go-toolset:1.18.10-1 AS BUILDER
22
ARG GO_BUILD_ARGS
3+
USER root
34

45
COPY Makefile Makefile
56
COPY go.mod go.mod

test/e2e/queue.go

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
297297
time.Sleep(2 * time.Minute)
298298
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
299299
if err != nil {
300-
fmt.Fprintf(os.Stdout, "Error getting status")
300+
fmt.Fprint(GinkgoWriter, "Error getting status")
301301
}
302302
pass := false
303-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
303+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
304304
if len(aw1.Status.PendingPodConditions) == 0 {
305305
pass = true
306306
}
@@ -526,10 +526,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
526526
time.Sleep(60 * time.Second)
527527
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
528528
if err != nil {
529-
fmt.Fprintf(os.Stdout, "Error getting status")
529+
fmt.Fprintf(GinkgoWriter, "Error getting status")
530530
}
531531
pass := false
532-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
532+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
533533
if aw1.Status.State == arbv1.AppWrapperStateFailed {
534534
pass = true
535535
}
@@ -551,10 +551,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
551551
time.Sleep(1 * time.Minute)
552552
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
553553
if err != nil {
554-
fmt.Fprintf(os.Stdout, "Error getting status")
554+
fmt.Fprint(GinkgoWriter, "Error getting status")
555555
}
556556
pass := false
557-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
557+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
558558
if aw1.Status.State == arbv1.AppWrapperStateCompleted {
559559
pass = true
560560
}
@@ -577,10 +577,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
577577
time.Sleep(1 * time.Minute)
578578
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
579579
if err != nil {
580-
fmt.Fprintf(os.Stdout, "Error getting status")
580+
fmt.Fprint(GinkgoWriter, "Error getting status")
581581
}
582582
pass := false
583-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
583+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
584584
if aw1.Status.State == arbv1.AppWrapperStateCompleted {
585585
pass = true
586586
}
@@ -641,10 +641,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
641641
time.Sleep(1 * time.Minute)
642642
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
643643
if err != nil {
644-
fmt.Fprintf(os.Stdout, "Error getting status")
644+
fmt.Fprintf(GinkgoWriter, "Error getting status, %v", err)
645645
}
646646
pass := false
647-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
647+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
648648
if aw1.Status.State == arbv1.AppWrapperStateEnqueued {
649649
pass = true
650650
}
@@ -689,10 +689,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
689689
Expect(err1).NotTo(HaveOccurred())
690690
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
691691
if err != nil {
692-
fmt.Fprintf(os.Stdout, "Error getting status")
692+
fmt.Fprintf(GinkgoWriter, "Error getting status, %v", err)
693693
}
694694
pass := false
695-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
695+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
696696
if aw1.Status.State == arbv1.AppWrapperStateRunningHoldCompletion {
697697
pass = true
698698
}
@@ -715,10 +715,10 @@ var _ = Describe("AppWrapper E2E Test", func() {
715715
Expect(err1).NotTo(HaveOccurred())
716716
aw1, err := context.karclient.ArbV1().AppWrappers(aw.Namespace).Get(aw.Name, metav1.GetOptions{})
717717
if err != nil {
718-
fmt.Fprintf(os.Stdout, "Error getting status")
718+
fmt.Fprintf(GinkgoWriter, "Error getting status, %v", err)
719719
}
720720
pass := false
721-
fmt.Fprintf(os.Stdout, "[e2e] status of AW %v.\n", aw1.Status.State)
721+
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
722722
if aw1.Status.State == arbv1.AppWrapperStateActive {
723723
pass = true
724724
}
@@ -759,7 +759,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
759759
name = fmt.Sprintf("%s%d", name, i+1)
760760
cpuDemand := "5m"
761761
if ((i+1)%modDivisor) == 0 || i == 0 {
762-
fmt.Fprintf(os.Stdout, "[e2e] Creating AW %s with %s cpu and %d replica(s).\n", name, cpuDemand, replicas)
762+
fmt.Fprintf(GinkgoWriter, "[e2e] Creating AW %s with %s cpu and %d replica(s).\n", name, cpuDemand, replicas)
763763
}
764764
aw := createGenericDeploymentWithCPUAW(context, name, cpuDemand, replicas)
765765
aws = append(aws, aw)
@@ -768,9 +768,6 @@ var _ = Describe("AppWrapper E2E Test", func() {
768768
// Give the deployments time to create pods
769769
time.Sleep(2 * time.Minute)
770770
for i := 0; i < len(aws); i++ {
771-
if ((i+1)%modDivisor) == 0 || i == 0 {
772-
fmt.Fprintf(os.Stdout, "[e2e] Checking for %d replicas running for AW %s.\n", replicas, aws[i].Name)
773-
}
774771
err := waitAWReadyQuiet(context, aws[i])
775772
Expect(err).NotTo(HaveOccurred())
776773
}

test/e2e/util.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func cleanupTestContextExtendedTime(cxt *context, seconds time.Duration) {
169169
// Wait for namespace deleted.
170170
// err = wait.Poll(100*time.Millisecond, seconds, namespaceNotExist(cxt))
171171
// if err != nil {
172-
// fmt.Fprintf(os.Stdout, "[cleanupTestContextExtendedTime] Failure check for namespace: %s.\n", cxt.namespace)
172+
// fmt.Fprintf(GinkgoWriter, "[cleanupTestContextExtendedTime] Failure check for namespace: %s.\n", cxt.namespace)
173173
// }
174174
//Expect(err).NotTo(HaveOccurred())
175175
}
@@ -407,12 +407,12 @@ func anyPodsExist(ctx *context, awNamespace string, awName string) wait.Conditio
407407

408408
// First find a pod from the list that is part of the AW
409409
if awn, found := podFromPodList.Labels["appwrapper.mcad.ibm.com"]; !found || awn != awName {
410-
//DEBUG fmt.Fprintf(os.Stdout, "[anyPodsExist] Pod %s in phase: %s not part of AppWrapper: %s, labels: %#v\n",
410+
//DEBUG fmt.Fprintf(GinkgoWriter, "[anyPodsExist] Pod %s in phase: %s not part of AppWrapper: %s, labels: %#v\n",
411411
//DEBUG podFromPodList.Name, podFromPodList.Status.Phase, awName, podFromPodList.Labels)
412412
continue
413413
}
414414
podExistsNum++
415-
fmt.Fprintf(os.Stdout, "[anyPodsExist] Found Pod %s in phase: %s as part of AppWrapper: %s, labels: %#v\n",
415+
fmt.Fprintf(GinkgoWriter, "[anyPodsExist] Found Pod %s in phase: %s as part of AppWrapper: %s, labels: %#v\n",
416416
podFromPodList.Name, podFromPodList.Status.Phase, awName, podFromPodList.Labels)
417417
}
418418

@@ -426,7 +426,7 @@ func podPhase(ctx *context, awNamespace string, awName string, pods []*v1.Pod, p
426426
Expect(err).NotTo(HaveOccurred())
427427

428428
if podList == nil || podList.Size() < 1 {
429-
fmt.Fprintf(os.Stdout, "[podPhase] Listing podList found for Namespace: %s/%s resulting in no podList found that could match AppWrapper with pod count: %d\n",
429+
fmt.Fprintf(GinkgoWriter, "[podPhase] Listing podList found for Namespace: %s/%s resulting in no podList found that could match AppWrapper with pod count: %d\n",
430430
awNamespace, awName, len(pods))
431431
}
432432

@@ -436,7 +436,7 @@ func podPhase(ctx *context, awNamespace string, awName string, pods []*v1.Pod, p
436436

437437
// First find a pod from the list that is part of the AW
438438
if awn, found := podFromPodList.Labels["appwrapper.mcad.ibm.com"]; !found || awn != awName {
439-
fmt.Fprintf(os.Stdout, "[podPhase] Pod %s in phase: %s not part of AppWrapper: %s, labels: %#v\n",
439+
fmt.Fprintf(GinkgoWriter, "[podPhase] Pod %s in phase: %s not part of AppWrapper: %s, labels: %#v\n",
440440
podFromPodList.Name, podFromPodList.Status.Phase, awName, podFromPodList.Labels)
441441
continue
442442
}
@@ -458,8 +458,8 @@ func podPhase(ctx *context, awNamespace string, awName string, pods []*v1.Pod, p
458458
}
459459

460460
}
461-
if matchToPodsFromInput == false {
462-
fmt.Fprintf(os.Stdout, "[podPhase] Pod %s in phase: %s does not match any input pods: %#v \n",
461+
if !matchToPodsFromInput {
462+
fmt.Fprintf(GinkgoWriter, "[podPhase] Pod %s in phase: %s does not match any input pods: %#v \n",
463463
podFromPodList.Name, podFromPodList.Status.Phase, inputPodIDs)
464464
}
465465
break
@@ -478,7 +478,7 @@ func awStatePhase(ctx *context, aw *arbv1.AppWrapper, phase []arbv1.AppWrapperSt
478478

479479
phaseCount := 0
480480
if !quite {
481-
fmt.Fprintf(os.Stdout, "[awStatePhase] AW %s found with state: %s.\n", aw.Name, aw.Status.State)
481+
fmt.Fprintf(GinkgoWriter, "[awStatePhase] AW %s found with state: %s.\n", aw.Name, aw.Status.State)
482482
}
483483

484484
for _, p := range phase {
@@ -497,7 +497,7 @@ func cleanupTestObjectsPtr(context *context, appwrappersPtr *[]*arbv1.AppWrapper
497497

498498
func cleanupTestObjectsPtrVerbose(context *context, appwrappersPtr *[]*arbv1.AppWrapper, verbose bool) {
499499
if appwrappersPtr == nil {
500-
fmt.Fprintf(os.Stdout, "[cleanupTestObjectsPtr] No AppWrappers to cleanup.\n")
500+
fmt.Fprintf(GinkgoWriter, "[cleanupTestObjectsPtr] No AppWrappers to cleanup.\n")
501501
} else {
502502
cleanupTestObjects(context, *appwrappersPtr)
503503
}
@@ -509,7 +509,7 @@ func cleanupTestObjects(context *context, appwrappers []*arbv1.AppWrapper) {
509509

510510
func cleanupTestObjectsVerbose(context *context, appwrappers []*arbv1.AppWrapper, verbose bool) {
511511
if appwrappers == nil {
512-
fmt.Fprintf(os.Stdout, "[cleanupTestObjects] No AppWrappers to cleanup.\n")
512+
fmt.Fprintf(GinkgoWriter, "[cleanupTestObjects] No AppWrappers to cleanup.\n")
513513
return
514514
}
515515

@@ -519,13 +519,13 @@ func cleanupTestObjectsVerbose(context *context, appwrappers []*arbv1.AppWrapper
519519
pods := getPodsOfAppWrapper(context, aw)
520520
awNamespace := aw.Namespace
521521
awName := aw.Name
522-
fmt.Fprintf(os.Stdout, "[cleanupTestObjects] Deleting AW %s.\n", aw.Name)
522+
fmt.Fprintf(GinkgoWriter, "[cleanupTestObjects] Deleting AW %s.\n", aw.Name)
523523
err := deleteAppWrapper(context, aw.Name)
524524
Expect(err).NotTo(HaveOccurred())
525525

526526
// Wait for the pods of the deleted the appwrapper to be destroyed
527527
for _, pod := range pods {
528-
fmt.Fprintf(os.Stdout, "[cleanupTestObjects] Awaiting pod %s/%s to be deleted for AW %s.\n",
528+
fmt.Fprintf(GinkgoWriter, "[cleanupTestObjects] Awaiting pod %s/%s to be deleted for AW %s.\n",
529529
pod.Namespace, pod.Name, aw.Name)
530530
}
531531
err = waitAWPodsDeleted(context, awNamespace, awName, pods)
@@ -536,7 +536,7 @@ func cleanupTestObjectsVerbose(context *context, appwrappers []*arbv1.AppWrapper
536536
for _, pod := range pods {
537537
podExist, _ := context.kubeclient.CoreV1().Pods(pod.Namespace).Get(gcontext.Background(), pod.Name, metav1.GetOptions{})
538538
if podExist != nil {
539-
fmt.Fprintf(os.Stdout, "[cleanupTestObjects] Found pod %s/%s %s, not completedly deleted for AW %s.\n", podExist.Namespace, podExist.Name, podExist.Status.Phase, aw.Name)
539+
fmt.Fprintf(GinkgoWriter, "[cleanupTestObjects] Found pod %s/%s %s, not completedly deleted for AW %s.\n", podExist.Namespace, podExist.Name, podExist.Status.Phase, aw.Name)
540540
podsStillExisting = append(podsStillExisting, podExist)
541541
}
542542
}
@@ -560,31 +560,31 @@ func awPodPhase(ctx *context, aw *arbv1.AppWrapper, phase []v1.PodPhase, taskNum
560560
Expect(err).NotTo(HaveOccurred())
561561

562562
if podList == nil || podList.Size() < 1 {
563-
fmt.Fprintf(os.Stdout, "[awPodPhase] Listing podList found for Namespace: %s resulting in no podList found that could match AppWrapper: %s \n",
563+
fmt.Fprintf(GinkgoWriter, "[awPodPhase] Listing podList found for Namespace: %s resulting in no podList found that could match AppWrapper: %s \n",
564564
aw.Namespace, aw.Name)
565565
}
566566

567567
readyTaskNum := 0
568568
for _, pod := range podList.Items {
569569
if awn, found := pod.Labels["appwrapper.mcad.ibm.com"]; !found || awn != aw.Name {
570570
if !quite {
571-
fmt.Fprintf(os.Stdout, "[awPodPhase] Pod %s not part of AppWrapper: %s, labels: %s\n", pod.Name, aw.Name, pod.Labels)
571+
fmt.Fprintf(GinkgoWriter, "[awPodPhase] Pod %s not part of AppWrapper: %s, labels: %s\n", pod.Name, aw.Name, pod.Labels)
572572
}
573573
continue
574574
}
575575

576576
for _, p := range phase {
577577
if pod.Status.Phase == p {
578578
//DEBUGif quite {
579-
//DEBUG fmt.Fprintf(os.Stdout, "[awPodPhase] Found pod %s of AppWrapper: %s, phase: %v\n", pod.Name, aw.Name, p)
579+
//DEBUG fmt.Fprintf(GinkgoWriter, "[awPodPhase] Found pod %s of AppWrapper: %s, phase: %v\n", pod.Name, aw.Name, p)
580580
//DEBUG}
581581
readyTaskNum++
582582
break
583583
} else {
584584
pMsg := pod.Status.Message
585585
if len(pMsg) > 0 {
586586
pReason := pod.Status.Reason
587-
fmt.Fprintf(os.Stdout, "[awPodPhase] pod: %s, phase: %s, reason: %s, message: %s\n", pod.Name, p, pReason, pMsg)
587+
fmt.Fprintf(GinkgoWriter, "[awPodPhase] pod: %s, phase: %s, reason: %s, message: %s\n", pod.Name, p, pReason, pMsg)
588588
}
589589
containerStatuses := pod.Status.ContainerStatuses
590590
for _, containerStatus := range containerStatuses {
@@ -594,7 +594,7 @@ func awPodPhase(ctx *context, aw *arbv1.AppWrapper, phase []v1.PodPhase, taskNum
594594
if len(wMsg) > 0 {
595595
wReason := waitingState.Reason
596596
containerName := containerStatus.Name
597-
fmt.Fprintf(os.Stdout, "[awPodPhase] condition for pod: %s, phase: %s, container name: %s, "+
597+
fmt.Fprintf(GinkgoWriter, "[awPodPhase] condition for pod: %s, phase: %s, container name: %s, "+
598598
"reason: %s, message: %s\n", pod.Name, p, containerName, wReason, wMsg)
599599
}
600600
}
@@ -604,7 +604,7 @@ func awPodPhase(ctx *context, aw *arbv1.AppWrapper, phase []v1.PodPhase, taskNum
604604
}
605605

606606
//DEBUGif taskNum <= readyTaskNum && quite {
607-
//DEBUG fmt.Fprintf(os.Stdout, "[awPodPhase] Successfully found %v podList of AppWrapper: %s, state: %s\n", readyTaskNum, aw.Name, aw.Status.State)
607+
//DEBUG fmt.Fprintf(GinkgoWriter, "[awPodPhase] Successfully found %v podList of AppWrapper: %s, state: %s\n", readyTaskNum, aw.Name, aw.Status.State)
608608
//DEBUG}
609609

610610
return taskNum <= readyTaskNum, nil

0 commit comments

Comments
 (0)