Skip to content

Commit

Permalink
Add e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Szadkowski <[email protected]>
  • Loading branch information
mszadkow committed Sep 23, 2024
1 parent fa5a1e4 commit 9d9f891
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/e2e/mpi_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"fmt"
"io"
"time"

"github.com/google/go-cmp/cmp"
"github.com/onsi/ginkgo"
Expand Down Expand Up @@ -164,6 +165,29 @@ var _ = ginkgo.Describe("MPIJob", func() {
mpiJob := createJobAndWaitForCompletion(mpiJob)
expectConditionToBeTrue(mpiJob, kubeflow.JobSucceeded)
})

ginkgo.It("should not complete when managed externaly", func() {
mpiJob.Spec.RunPolicy.ManagedBy = ptr.To(kubeflow.MultiKueueController)
ctx := context.Background()
mpiJob = createJob(ctx, mpiJob)

gomega.Consistently(func() error {
updatedJob, err := mpiClient.KubeflowV2beta1().MPIJobs(mpiJob.Namespace).Get(ctx, mpiJob.Name, metav1.GetOptions{})
if err != nil {
return err
}
mpiJob = updatedJob
return nil
}, 5*time.Second, waitInterval).Should(gomega.Succeed())

// job should be created, but never succeeded
condition := getJobCondition(mpiJob, kubeflow.JobCreated)
gomega.Expect(condition).ToNot(gomega.BeNil())
gomega.Expect(condition.Status).To(gomega.Equal(corev1.ConditionTrue))

condition = getJobCondition(mpiJob, kubeflow.JobSucceeded)
gomega.Expect(condition).To(gomega.BeNil())
})
})

})
Expand Down

0 comments on commit 9d9f891

Please sign in to comment.