@@ -92,6 +92,13 @@ var _ = ginkgo.Describe("Trainjob controller", ginkgo.Ordered, ginkgo.ContinueOn
9292 testingjobset.ReplicatedJobRequirements {
9393 Name : "node" ,
9494 Replicas : 1 ,
95+ Labels : map [string ]string {
96+ "trainer.kubeflow.org/trainjob-ancestor-step" : "trainer" ,
97+ },
98+ },
99+ testingjobset.ReplicatedJobRequirements {
100+ Name : "foo" ,
101+ Replicas : 1 ,
95102 }).
96103 Obj ()
97104 testCtr = testingtrainjob .MakeClusterTrainingRuntime ("test" , testJobSet .Spec )
@@ -126,6 +133,7 @@ var _ = ginkgo.Describe("Trainjob controller", ginkgo.Ordered, ginkgo.ContinueOn
126133 Name : "test" ,
127134 Kind : ptr .To ("ClusterTrainingRuntime" ),
128135 }).
136+ TrainerNumNodes (2 ).
129137 Suspend (false ).
130138 Queue ("local-queue" ).
131139 Obj ()
@@ -136,11 +144,14 @@ var _ = ginkgo.Describe("Trainjob controller", ginkgo.Ordered, ginkgo.ContinueOn
136144 }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
137145 })
138146
139- ginkgo .By ("checking the workload is created" , func () {
147+ ginkgo .By ("checking the workload is created with the correct values " , func () {
140148 wlLookupKey = types.NamespacedName {Name : workloadtrainjob .GetWorkloadNameForTrainJob (createdTrainJob .Name , createdTrainJob .UID ), Namespace : ns .Name }
141149 gomega .Eventually (func (g gomega.Gomega ) {
142150 g .Expect (k8sClient .Get (ctx , wlLookupKey , createdWorkload )).Should (gomega .Succeed ())
143151 g .Expect (createdWorkload .Spec .QueueName ).Should (gomega .Equal (kueue .LocalQueueName ("local-queue" )))
152+ g .Expect (createdWorkload .Spec .PodSets ).Should (gomega .HaveLen (2 ))
153+ g .Expect (createdWorkload .Spec .PodSets [0 ].Count ).Should (gomega .Equal (int32 (2 )))
154+ g .Expect (createdWorkload .Spec .PodSets [1 ].Count ).Should (gomega .Equal (int32 (1 )))
144155 }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
145156 })
146157
@@ -160,6 +171,12 @@ var _ = ginkgo.Describe("Trainjob controller", ginkgo.Ordered, ginkgo.ContinueOn
160171 corev1 .ResourceCPU : kueue .ResourceFlavorReference (onDemandFlavor .Name ),
161172 },
162173 },
174+ kueue.PodSetAssignment {
175+ Name : createdWorkload .Spec .PodSets [1 ].Name ,
176+ Flavors : map [corev1.ResourceName ]kueue.ResourceFlavorReference {
177+ corev1 .ResourceCPU : kueue .ResourceFlavorReference (onDemandFlavor .Name ),
178+ },
179+ },
163180 ).Obj ()
164181 util .SetQuotaReservation (ctx , k8sClient , wlLookupKey , admission )
165182 util .SyncAdmittedConditionForWorkloads (ctx , k8sClient , createdWorkload )
@@ -234,6 +251,12 @@ var _ = ginkgo.Describe("Trainjob controller", ginkgo.Ordered, ginkgo.ContinueOn
234251 corev1 .ResourceCPU : kueue .ResourceFlavorReference (onDemandFlavor .Name ),
235252 },
236253 },
254+ kueue.PodSetAssignment {
255+ Name : createdWorkload .Spec .PodSets [1 ].Name ,
256+ Flavors : map [corev1.ResourceName ]kueue.ResourceFlavorReference {
257+ corev1 .ResourceCPU : kueue .ResourceFlavorReference (onDemandFlavor .Name ),
258+ },
259+ },
237260 ).Obj ()
238261 util .SetQuotaReservation (ctx , k8sClient , wlLookupKey , admission )
239262 util .SyncAdmittedConditionForWorkloads (ctx , k8sClient , createdWorkload )
0 commit comments