Skip to content

Commit

Permalink
Added tests for bad copy_out directives
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich committed Feb 5, 2024
1 parent 456ff6b commit c5c697b
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion internal/controller/nnf_workflow_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
})
})

When("Using bad copy_in/copy_out directives", func() {
When("Using bad copy_in directives", func() {

It("Fails missing or malformed jobdw reference", func() {
workflow.Spec.DWDirectives = []string{
Expand Down Expand Up @@ -411,6 +411,55 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
})
})

When("Using bad copy_out directives", func() {

It("Fails missing or malformed jobdw reference", func() {
workflow.Spec.DWDirectives = []string{
"#DW jobdw name=test type=lustre capacity=1GiB",
"#DW copy_out source=$DW_JOB_INCORRECT/my-file.in destination=/lus/maui/my-file.out",
}

Expect(k8sClient.Create(context.TODO(), workflow)).To(Succeed(), "create workflow")

Eventually(func() *dwsv1alpha2.WorkflowDriverStatus {
expected := &dwsv1alpha2.Workflow{}
k8sClient.Get(context.TODO(), key, expected)
return getErroredDriverStatus(expected)
}).ShouldNot(BeNil(), "have an error present")

})

It("Fails missing or malformed persistentdw reference", func() {
workflow.Spec.DWDirectives = []string{
"#DW create_persistent name=test type=lustre capacity=1GiB",
"#DW copy_out source=$DW_PERSISTENT_INCORRECT/my-file.int destination=/lus/maui/my-file.out",
}

Expect(k8sClient.Create(context.TODO(), workflow)).To(Succeed(), "create workflow")

Eventually(func() *dwsv1alpha2.WorkflowDriverStatus {
expected := &dwsv1alpha2.Workflow{}
k8sClient.Get(context.TODO(), key, expected)
return getErroredDriverStatus(expected)
}).ShouldNot(BeNil(), "have an error present")
})

It("Fails missing or malformed global lustre reference", func() {
workflow.Spec.DWDirectives = []string{
"#DW jobdw name=test type=lustre capacity=1GiB",
"#DW copy_out source=$DW_JOB_test/my-file.int destination=/lus/INCORRECT/my-file.out",
}

Expect(k8sClient.Create(context.TODO(), workflow)).To(Succeed(), "create workflow")

Eventually(func() *dwsv1alpha2.WorkflowDriverStatus {
expected := &dwsv1alpha2.Workflow{}
k8sClient.Get(context.TODO(), key, expected)
return getErroredDriverStatus(expected)
}).ShouldNot(BeNil(), "have an error present")
})
})

When("Using copy_in directives", func() {
var (
dmm *nnfv1alpha1.NnfDataMovementManager
Expand Down

0 comments on commit c5c697b

Please sign in to comment.