Skip to content

Commit 945df9d

Browse files
Fixing e2e test
1 parent 1327da7 commit 945df9d

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

pkg/controller/queuejobresources/genericresource/genericresource.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (gr *GenericResources) Cleanup(aw *arbv1.AppWrapper, awr *arbv1.AppWrapperG
167167
}
168168

169169
// Get the resource to see if it exists in the AppWrapper namespace
170-
labelSelector := fmt.Sprintf("%s=%s, %s=%s", appwrapperJobLabelName, aw.Name, appwrapperJobLabelNamespace, aw.Namespace)
170+
labelSelector := fmt.Sprintf("%s=%s, %s=%s, %s=%s", appwrapperJobLabelName, aw.Name, appwrapperJobLabelNamespace, aw.Namespace, resourceName, unstruct.GetName())
171171
inEtcd, err := dclient.Resource(rsrc).Namespace(aw.Namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labelSelector})
172172
if err != nil {
173173
return name, gvk, err
@@ -310,7 +310,7 @@ func (gr *GenericResources) SyncQueueJob(aw *arbv1.AppWrapper, awr *arbv1.AppWra
310310
}
311311

312312
// Get the resource to see if it exists
313-
labelSelector := fmt.Sprintf("%s=%s, %s=%s", appwrapperJobLabelName, aw.Name, appwrapperJobLabelNamespace, aw.Namespace)
313+
labelSelector := fmt.Sprintf("%s=%s, %s=%s, %s=%s", appwrapperJobLabelName, aw.Name, appwrapperJobLabelNamespace, aw.Namespace, resourceName, unstruct.GetName())
314314
inEtcd, err := dclient.Resource(rsrc).List(context.Background(), metav1.ListOptions{LabelSelector: labelSelector})
315315
if err != nil {
316316
return []*v1.Pod{}, err

test/e2e/queue.go

+1-19
Original file line numberDiff line numberDiff line change
@@ -200,32 +200,14 @@ var _ = Describe("AppWrapper E2E Test", func() {
200200
appwrappersPtr := &appwrappers
201201
defer cleanupTestObjectsPtr(context, appwrappersPtr)
202202

203-
aw := createDeploymentAW(context, "aw-deployment-3", "test")
203+
aw := createDeploymentAW(context, "aw-deployment-3")
204204
appwrappers = append(appwrappers, aw)
205205

206206
fmt.Fprintf(GinkgoWriter, "[e2e] Awaiting %d pods running for AW %s.\n", aw.Spec.SchedSpec.MinAvailable, aw.Name)
207207
err := waitAWPodsReady(context, aw)
208208
Expect(err).NotTo(HaveOccurred())
209209
})
210210

211-
It("Create Two AppWrappers Same Name Different Namespaces - Deployment Only - 3 Pods Each", func() {
212-
fmt.Fprintf(os.Stdout, "[e2e] Create Two AppWrappers Same Name Different Namespaces - Deployment Only 3 Pods Each - Started.\n")
213-
context := initTestContext()
214-
var appwrappers []*arbv1.AppWrapper
215-
appwrappersPtr := &appwrappers
216-
defer cleanupTestObjectsPtr(context, appwrappersPtr)
217-
218-
namespaces := []string{"nstest1", "nstest2"}
219-
for _, ns := range namespaces {
220-
aw := createDeploymentAW(context, "aw-deployment-3", ns)
221-
appwrappers = append(appwrappers, aw)
222-
223-
fmt.Fprintf(GinkgoWriter, "[e2e] Awaiting %d pods running for AW %s in namespace %s.\n", aw.Spec.SchedSpec.MinAvailable, aw.Name, ns)
224-
err := waitAWPodsReady(context, aw)
225-
Expect(err).NotTo(HaveOccurred())
226-
}
227-
})
228-
229211
It("Create AppWrapper - Generic Deployment Only - 3 pods", func() {
230212
fmt.Fprintf(os.Stdout, "[e2e] Create AppWrapper - Generic Deployment Only - 3 pods - Started.\n")
231213
context := initTestContext()

test/e2e/util.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func initTestContext() *context {
9191
Name: cxt.namespace,
9292
},
9393
}, metav1.CreateOptions{})
94+
9495
// Expect(err).NotTo(HaveOccurred())
9596

9697
/* _, err = cxt.kubeclient.SchedulingV1beta1().PriorityClasses().Create(gcontext.Background(), &schedv1.PriorityClass{
@@ -646,12 +647,12 @@ func createJobAWWithInitContainer(context *context, name string, requeuingTimeIn
646647
return appwrapper
647648
}
648649

649-
func createDeploymentAW(context *context, name string, namespace string) *arbv1.AppWrapper {
650-
rb := []byte(fmt.Sprintf(`{"apiVersion": "apps/v1",
650+
func createDeploymentAW(context *context, name string) *arbv1.AppWrapper {
651+
rb := []byte(`{"apiVersion": "apps/v1",
651652
"kind": "Deployment",
652653
"metadata": {
653654
"name": "aw-deployment-3",
654-
"namespace": "%s",
655+
"namespace": "test",
655656
"labels": {
656657
"app": "aw-deployment-3"
657658
}
@@ -686,13 +687,13 @@ func createDeploymentAW(context *context, name string, namespace string) *arbv1.
686687
]
687688
}
688689
}
689-
}} `, namespace))
690+
}} `)
690691
var schedSpecMin int = 3
691692

692693
aw := &arbv1.AppWrapper{
693694
ObjectMeta: metav1.ObjectMeta{
694695
Name: name,
695-
Namespace: namespace,
696+
Namespace: context.namespace,
696697
},
697698
Spec: arbv1.AppWrapperSpec{
698699
SchedSpec: arbv1.SchedulingSpecTemplate{
@@ -711,7 +712,7 @@ func createDeploymentAW(context *context, name string, namespace string) *arbv1.
711712
},
712713
}
713714

714-
appwrapper, err := context.karclient.WorkloadV1beta1().AppWrappers(namespace).Create(context.ctx, aw, metav1.CreateOptions{})
715+
appwrapper, err := context.karclient.WorkloadV1beta1().AppWrappers(context.namespace).Create(context.ctx, aw, metav1.CreateOptions{})
715716
Expect(err).NotTo(HaveOccurred())
716717

717718
return appwrapper

0 commit comments

Comments
 (0)