@@ -581,25 +581,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
581
581
aw := createGenericJobAWWithStatus (context , "aw-test-job-with-comp-1" )
582
582
err1 := waitAWPodsReady (context , aw )
583
583
Expect (err1 ).NotTo (HaveOccurred ())
584
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
585
- if err != nil {
586
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v\n " , err )
587
- }
588
- Expect (err ).Should (Succeed ())
589
- var pass = false
590
- for true {
591
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
592
- if err != nil {
593
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v\n " , err )
594
- }
595
- if aw1 .Status .State == arbv1 .AppWrapperStateCompleted {
596
- pass = true
597
- break
598
- }
599
- }
600
-
601
- Expect (pass ).To (Equal (true ))
602
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
584
+ Eventually (AppWrapper (context , aw .Namespace , aw .Name ), 2 * time .Minute ).Should (WithTransform (AppWrapperState , Equal (arbv1 .AppWrapperStateCompleted )))
603
585
appwrappers = append (appwrappers , aw )
604
586
fmt .Fprintf (os .Stdout , "[e2e] MCAD Job Completion Test - Completed.\n " )
605
587
})
@@ -614,23 +596,8 @@ var _ = Describe("AppWrapper E2E Test", func() {
614
596
aw := createGenericJobAWWithMultipleStatus (context , "aw-test-job-with-comp-ms-21" )
615
597
err1 := waitAWPodsReady (context , aw )
616
598
Expect (err1 ).NotTo (HaveOccurred (), "Expecting pods to be ready for app wrapper: 'aw-test-job-with-comp-ms-21'" )
617
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
618
- Expect (err ).NotTo (HaveOccurred (), "No error is expected when getting status" )
619
- fmt .Fprintf (GinkgoWriter , "[e2e] MCAD Multi-Item Job Completion Test status of AW %v.\n " , aw1 .Status )
620
- var pass = false
621
- for true {
622
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
623
- if err != nil {
624
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v\n " , err )
625
- }
626
- if aw1 .Status .State == arbv1 .AppWrapperStateCompleted {
627
- pass = true
628
- break
629
- }
630
- }
631
-
632
- Expect (pass ).To (Equal (true ))
633
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
599
+ Eventually (AppWrapper (context , aw .Namespace , aw .Name ), 2 * time .Minute ).Should (WithTransform (AppWrapperState , Equal (arbv1 .AppWrapperStateCompleted )))
600
+ appwrappers = append (appwrappers , aw )
634
601
appwrappers = append (appwrappers , aw )
635
602
fmt .Fprintf (os .Stdout , "[e2e] MCAD Multi-Item Job Completion Test - Completed.\n " )
636
603
})
@@ -684,24 +651,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
684
651
aw := createGenericJobAWtWithLargeCompute (context , "aw-test-job-with-large-comp-1" )
685
652
err1 := waitAWPodsReady (context , aw )
686
653
Expect (err1 ).NotTo (HaveOccurred ())
687
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
688
- if err != nil {
689
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v" , err )
690
- }
691
- pass := false
692
- for true {
693
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
694
- if err != nil {
695
- fmt .Fprint (GinkgoWriter , "Error getting status" )
696
- }
697
- if aw1 .Status .State == arbv1 .AppWrapperStateEnqueued {
698
- pass = true
699
- break
700
- }
701
- }
702
-
703
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
704
- Expect (pass ).To (BeTrue ())
654
+ Eventually (AppWrapper (context , aw .Namespace , aw .Name ), 2 * time .Minute ).Should (WithTransform (AppWrapperState , Equal (arbv1 .AppWrapperStateEnqueued )))
705
655
appwrappers = append (appwrappers , aw )
706
656
fmt .Fprintf (os .Stdout , "[e2e] MCAD Job Large Compute Requirement Test - Completed.\n " )
707
657
@@ -738,25 +688,9 @@ var _ = Describe("AppWrapper E2E Test", func() {
738
688
739
689
aw := createGenericDeploymentAWWithMultipleItems (context , "aw-deployment-rhc" )
740
690
appwrappers = append (appwrappers , aw )
741
- //time.Sleep(30 * time.Second)
742
691
err1 := waitAWPodsReady (context , aw )
743
692
Expect (err1 ).NotTo (HaveOccurred (), "Expecting pods to be ready for app wrapper: aw-deployment-rhc" )
744
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
745
- Expect (err ).NotTo (HaveOccurred (), "Expecting to get app wrapper status" )
746
- pass := false
747
- for true {
748
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
749
- if err != nil {
750
- fmt .Fprint (GinkgoWriter , "Error getting status" )
751
- }
752
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
753
- if aw1 .Status .State == arbv1 .AppWrapperStateRunningHoldCompletion {
754
- pass = true
755
- break
756
- }
757
- }
758
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
759
- Expect (pass ).To (BeTrue ())
693
+ Eventually (AppWrapper (context , aw .Namespace , aw .Name ), 2 * time .Minute ).Should (WithTransform (AppWrapperState , Equal (arbv1 .AppWrapperStateRunningHoldCompletion )))
760
694
fmt .Fprintf (os .Stdout , "[e2e] MCAD Deployment RuningHoldCompletion Test - Completed. Awaiting app wrapper cleanup.\n " )
761
695
})
762
696
@@ -768,26 +702,9 @@ var _ = Describe("AppWrapper E2E Test", func() {
768
702
defer cleanupTestObjectsPtr (context , appwrappersPtr )
769
703
770
704
aw := createGenericServiceAWWithNoStatus (context , appendRandomString ("aw-deployment-2-status" ))
771
- //ßtime.Sleep(1 * time.Minute)
772
705
err1 := waitAWPodsReady (context , aw )
773
706
Expect (err1 ).NotTo (HaveOccurred ())
774
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
775
- if err != nil {
776
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v" , err )
777
- }
778
- pass := false
779
- for true {
780
- aw1 , err := context .karclient .McadV1beta1 ().AppWrappers (aw .Namespace ).Get (context .ctx , aw .Name , metav1.GetOptions {})
781
- if err != nil {
782
- fmt .Fprintf (GinkgoWriter , "Error getting status, %v" , err )
783
- }
784
- if aw1 .Status .State == arbv1 .AppWrapperStateActive {
785
- pass = true
786
- break
787
- }
788
- }
789
- fmt .Fprintf (GinkgoWriter , "[e2e] status of AW %v.\n " , aw1 .Status .State )
790
- Expect (pass ).To (BeTrue ())
707
+ Eventually (AppWrapper (context , aw .Namespace , aw .Name ), 2 * time .Minute ).Should (WithTransform (AppWrapperState , Equal (arbv1 .AppWrapperStateActive )))
791
708
appwrappers = append (appwrappers , aw )
792
709
fmt .Fprintf (os .Stdout , "[e2e] MCAD Service no RuningHoldCompletion or Complete Test - Completed.\n " )
793
710
0 commit comments