Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine the integration tests for the immutable PyTorchJob queueName #2130

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions pkg/controller.v1/pytorch/pytorchjob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,26 +202,21 @@ var _ = Describe("PyTorchJob controller", func() {
Expect(testK8sClient.Create(ctx, job)).Should(Succeed())

By("Attempting to update the PyTorchJob with a different queue value")
updatedJob := &kubeflowv1.PyTorchJob{}
Eventually(func() bool {
err := testK8sClient.Get(ctx, jobKey, updatedJob)
return err == nil
}, testutil.Timeout, testutil.Interval).Should(BeTrue(), "Failed to get PyTorchJob")

Eventually(func() bool {
Eventually(func(g Gomega) {
updatedJob := &kubeflowv1.PyTorchJob{}
g.Expect(testK8sClient.Get(ctx, jobKey, updatedJob)).Should(Succeed(), "Failed to get PyTorchJob")
updatedJob.Spec.RunPolicy.SchedulingPolicy.Queue = "test"
err := testK8sClient.Update(ctx, updatedJob)
g.Expect(err).To(HaveOccurred(), "Expected an error when updating the queue, but update succeeded")
By("Checking that the queue update fails")
Expect(err).To(HaveOccurred(), "Expected an error when updating the queue, but update succeeded")
Expect(err).To(MatchError(ContainSubstring("spec.runPolicy.schedulingPolicy.queue is immutable"), "The error message did not contain the expected message"))
return err != nil
}, testutil.Timeout, testutil.Interval).Should(BeTrue())

}, testutil.Timeout, testutil.Interval).Should(Succeed())

By("Validating the queue was not updated")
freshJob := &kubeflowv1.PyTorchJob{}
Expect(testK8sClient.Get(ctx, client.ObjectKeyFromObject(job), freshJob)).Should(Succeed(), "Failed to get PyTorchJob after update attempt")
Expect(freshJob.Spec.RunPolicy.SchedulingPolicy.Queue).To(Equal("initial-queue"), "The queue should remain as the initial value since it should be immutable")

})

It("Shouldn't create resources if PyTorchJob is suspended", func() {
Expand Down
Loading