@@ -649,7 +649,30 @@ func TestWorkloadReconciler(t *testing.T) {
649
649
},
650
650
},
651
651
},
652
- "should update the Workload AdmissionCheckState when Slices status is changed to Forming" : {
652
+ "should update the Workload's AdmissionCheckState when one Slice is in the Forming state" : {
653
+ request : baseRequest ,
654
+ objs : []client.Object {
655
+ baseAdmissionCheckWrapper .DeepCopy (),
656
+ baseWorkloadWrapperWithFinalizer .DeepCopy (),
657
+ baseSlice1Wrapper .Clone ().Forming ().Obj (),
658
+ baseSlice2Wrapper .Clone ().Obj (),
659
+ },
660
+ wantWorkloads : []kueue.Workload {
661
+ * baseWorkloadWrapperWithFinalizer .Clone ().
662
+ AdmissionCheck (kueue.AdmissionCheckState {
663
+ Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
664
+ State : kueue .CheckStatePending ,
665
+ LastTransitionTime : metav1 .NewTime (now ),
666
+ Message : `Slices are in states: 1 Forming, 0 Degraded, 0 Ready, 0 Error, 0 Deformed` ,
667
+ }).
668
+ Obj (),
669
+ },
670
+ wantSlices : []slice.Slice {
671
+ * baseSlice1Wrapper .Clone ().Forming ().Obj (),
672
+ * baseSlice2Wrapper .Clone ().Obj (),
673
+ },
674
+ },
675
+ "should update the Workload's AdmissionCheckState when all Slices are in the Forming state" : {
653
676
request : baseRequest ,
654
677
objs : []client.Object {
655
678
baseAdmissionCheckWrapper .DeepCopy (),
@@ -663,7 +686,7 @@ func TestWorkloadReconciler(t *testing.T) {
663
686
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
664
687
State : kueue .CheckStatePending ,
665
688
LastTransitionTime : metav1 .NewTime (now ),
666
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are being formed ` ,
689
+ Message : `Slices are in states: 2 Forming, 0 Degraded, 0 Ready, 0 Error, 0 Deformed ` ,
667
690
}).
668
691
Obj (),
669
692
},
@@ -672,7 +695,30 @@ func TestWorkloadReconciler(t *testing.T) {
672
695
* baseSlice2Wrapper .Clone ().Forming ().Obj (),
673
696
},
674
697
},
675
- "should update the Workload AdmissionCheckState when the Slice status is changed to Ready" : {
698
+ "should update the Workload's AdmissionCheckState when one Slice is in the Ready state" : {
699
+ request : baseRequest ,
700
+ objs : []client.Object {
701
+ baseAdmissionCheckWrapper .DeepCopy (),
702
+ baseWorkloadWrapperWithFinalizer .DeepCopy (),
703
+ baseSlice1Wrapper .Clone ().Ready ().Obj (),
704
+ baseSlice2Wrapper .Clone ().Forming ().Obj (),
705
+ },
706
+ wantWorkloads : []kueue.Workload {
707
+ * baseWorkloadWrapperWithFinalizer .Clone ().
708
+ AdmissionCheck (kueue.AdmissionCheckState {
709
+ Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
710
+ State : kueue .CheckStatePending ,
711
+ LastTransitionTime : metav1 .NewTime (now ),
712
+ Message : `Slices are in states: 1 Forming, 0 Degraded, 1 Ready, 0 Error, 0 Deformed` ,
713
+ }).
714
+ Obj (),
715
+ },
716
+ wantSlices : []slice.Slice {
717
+ * baseSlice1Wrapper .Clone ().Ready ().Obj (),
718
+ * baseSlice2Wrapper .Clone ().Forming ().Obj (),
719
+ },
720
+ },
721
+ "should update the Workload's AdmissionCheckState when all Slices are in the Ready state" : {
676
722
request : baseRequest ,
677
723
objs : []client.Object {
678
724
baseAdmissionCheckWrapper .DeepCopy (),
@@ -686,7 +732,7 @@ func TestWorkloadReconciler(t *testing.T) {
686
732
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
687
733
State : kueue .CheckStateReady ,
688
734
LastTransitionTime : metav1 .NewTime (now ),
689
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are fully operational ` ,
735
+ Message : `Slices are in states: 0 Forming, 0 Degraded, 2 Ready, 0 Error, 0 Deformed ` ,
690
736
}).
691
737
Obj (),
692
738
},
@@ -703,12 +749,12 @@ func TestWorkloadReconciler(t *testing.T) {
703
749
},
704
750
},
705
751
},
706
- "should update the Workload AdmissionCheckState when the Slice status is changed to Degraded" : {
752
+ "should update the Workload's AdmissionCheckState when one Slice is in the Ready state and another is in the Degraded state " : {
707
753
request : baseRequest ,
708
754
objs : []client.Object {
709
755
baseAdmissionCheckWrapper .DeepCopy (),
710
756
baseWorkloadWrapperWithFinalizer .DeepCopy (),
711
- baseSlice1Wrapper .Clone ().Degraded ().Obj (),
757
+ baseSlice1Wrapper .Clone ().Ready ().Obj (),
712
758
baseSlice2Wrapper .Clone ().Degraded ().Obj (),
713
759
},
714
760
wantWorkloads : []kueue.Workload {
@@ -717,12 +763,12 @@ func TestWorkloadReconciler(t *testing.T) {
717
763
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
718
764
State : kueue .CheckStateReady ,
719
765
LastTransitionTime : metav1 .NewTime (now ),
720
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are running with reduced capacity or performance ` ,
766
+ Message : `Slices are in states: 0 Forming, 1 Degraded, 1 Ready, 0 Error, 0 Deformed ` ,
721
767
}).
722
768
Obj (),
723
769
},
724
770
wantSlices : []slice.Slice {
725
- * baseSlice1Wrapper .Clone ().Degraded ().Obj (),
771
+ * baseSlice1Wrapper .Clone ().Ready ().Obj (),
726
772
* baseSlice2Wrapper .Clone ().Degraded ().Obj ()},
727
773
wantEvents : []utiltesting.EventRecord {
728
774
{
@@ -733,27 +779,27 @@ func TestWorkloadReconciler(t *testing.T) {
733
779
},
734
780
},
735
781
},
736
- "should update the Workload AdmissionCheckState when the Slice status is changed to Deformed " : {
782
+ "should update the Workload's AdmissionCheckState when one Slice is in the Error state " : {
737
783
request : baseRequest ,
738
784
objs : []client.Object {
739
785
baseAdmissionCheckWrapper .DeepCopy (),
740
786
baseWorkloadWrapperWithFinalizer .DeepCopy (),
741
- baseSlice1Wrapper .Clone ().Deformed ().Obj (),
742
- baseSlice2Wrapper .Clone ().Deformed ().Obj (),
787
+ baseSlice1Wrapper .Clone ().Ready ().Obj (),
788
+ baseSlice2Wrapper .Clone ().Error ().Obj (),
743
789
},
744
790
wantWorkloads : []kueue.Workload {
745
791
* baseWorkloadWrapperWithFinalizer .Clone ().
746
792
AdmissionCheck (kueue.AdmissionCheckState {
747
793
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
748
794
State : kueue .CheckStateRejected ,
749
795
LastTransitionTime : metav1 .NewTime (now ),
750
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are being torn down ` ,
796
+ Message : `Slices are in states: 0 Forming, 0 Degraded, 1 Ready, 1 Error, 0 Deformed. Errors: Error by test ` ,
751
797
}).
752
798
Obj (),
753
799
},
754
800
wantSlices : []slice.Slice {
755
- * baseSlice1Wrapper .Clone ().Deformed ().Obj (),
756
- * baseSlice2Wrapper .Clone ().Deformed ().Obj ()},
801
+ * baseSlice1Wrapper .Clone ().Ready ().Obj (),
802
+ * baseSlice2Wrapper .Clone ().Error ().Obj ()},
757
803
wantEvents : []utiltesting.EventRecord {
758
804
{
759
805
Key : client .ObjectKeyFromObject (baseWorkloadWrapper ),
@@ -763,28 +809,27 @@ func TestWorkloadReconciler(t *testing.T) {
763
809
},
764
810
},
765
811
},
766
- "should update the Workload AdmissionCheckState when the Slice status is changed to Error " : {
812
+ "should update the Workload's AdmissionCheckState when one Slice is in the Deformed state " : {
767
813
request : baseRequest ,
768
814
objs : []client.Object {
769
815
baseAdmissionCheckWrapper .DeepCopy (),
770
816
baseWorkloadWrapperWithFinalizer .DeepCopy (),
771
- baseSlice1Wrapper .Clone ().Error ().Obj (),
772
- baseSlice2Wrapper .Clone ().Error ().Obj (),
817
+ baseSlice1Wrapper .Clone ().Ready ().Obj (),
818
+ baseSlice2Wrapper .Clone ().Deformed ().Obj (),
773
819
},
774
820
wantWorkloads : []kueue.Workload {
775
821
* baseWorkloadWrapperWithFinalizer .Clone ().
776
822
AdmissionCheck (kueue.AdmissionCheckState {
777
823
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
778
824
State : kueue .CheckStateRejected ,
779
825
LastTransitionTime : metav1 .NewTime (now ),
780
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are not operational due to an errors ` ,
826
+ Message : `Slices are in states: 0 Forming, 0 Degraded, 1 Ready, 0 Error, 1 Deformed ` ,
781
827
}).
782
828
Obj (),
783
829
},
784
830
wantSlices : []slice.Slice {
785
- * baseSlice1Wrapper .Clone ().Error ().Obj (),
786
- * baseSlice2Wrapper .Clone ().Error ().Obj (),
787
- },
831
+ * baseSlice1Wrapper .Clone ().Ready ().Obj (),
832
+ * baseSlice2Wrapper .Clone ().Deformed ().Obj ()},
788
833
wantEvents : []utiltesting.EventRecord {
789
834
{
790
835
Key : client .ObjectKeyFromObject (baseWorkloadWrapper ),
@@ -809,7 +854,7 @@ func TestWorkloadReconciler(t *testing.T) {
809
854
Name : kueue .AdmissionCheckReference (baseAdmissionCheckName ),
810
855
State : kueue .CheckStateReady ,
811
856
LastTransitionTime : metav1 .NewTime (now ),
812
- Message : `The Slices "default/workload-ps1", "default/workload-ps2" are fully operational ` ,
857
+ Message : `Slices are in states: 0 Forming, 0 Degraded, 2 Ready, 0 Error, 0 Deformed ` ,
813
858
}).
814
859
Obj (),
815
860
},
0 commit comments