Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions docs/developer/testing/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ You can also execute make test-e2e with a $GINKGO_ARGS variable set. Example:
make test-e2e GINKGO_ARGS="--ginkgo.focus='MySQL application DATAMOVER'"
```

Some tests, like the DPA configuration will need the test filter removed
```bash
make test-e2e TEST_FILTER="" GINKGO_ARGS="--focus='Should enable and disable VMFileRestore'"
```

### Run selected test for HCP against external HostedControlPlane

Set common env variables as mentioned above, then run:
Expand Down
58 changes: 58 additions & 0 deletions tests/e2e/dpa_deployment_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type TestDPASpec struct {
NoS3ForcePathStyle bool
NoRegion bool
DoNotBackupImages bool
EnableVMFR bool
EnableNonAdmin bool
}

func createTestDPASpec(testSpec TestDPASpec) *oadpv1alpha1.DataProtectionApplicationSpec {
Expand Down Expand Up @@ -129,6 +131,16 @@ func createTestDPASpec(testSpec TestDPASpec) *oadpv1alpha1.DataProtectionApplica
if testSpec.DoNotBackupImages {
dpaSpec.BackupImages = ptr.To(false)
}
if testSpec.EnableNonAdmin {
dpaSpec.NonAdmin = &oadpv1alpha1.NonAdmin{
Enable: ptr.To(true),
}
}
if testSpec.EnableVMFR {
dpaSpec.VMFileRestore = &oadpv1alpha1.VMFileRestore{
Enable: ptr.To(true),
}
}
return dpaSpec
}

Expand Down Expand Up @@ -374,6 +386,52 @@ var _ = ginkgo.Describe("Configuration testing for DPA Custom Resource", func()
}, "Delete restic object from spec.configuration, use spec.configuration.nodeAgent instead"),
)

ginkgo.It("Should enable and disable NonAdmin", func() {
// 1. Enable NonAdmin
testSpec := TestDPASpec{
BSLSecretName: bslSecretName,
EnableNonAdmin: true,
}
dpaSpec := createTestDPASpec(testSpec)
err := dpaCR.CreateOrUpdate(dpaSpec)
gomega.Expect(err).ToNot(gomega.HaveOccurred())

log.Printf("Waiting for DPA to be reconciled with NonAdmin enabled")
gomega.Eventually(dpaCR.IsReconciledTrue(), time.Minute*2, time.Second*5).Should(gomega.BeTrue())

// 2. Disable NonAdmin
testSpec.EnableNonAdmin = false
dpaSpec = createTestDPASpec(testSpec)
err = dpaCR.CreateOrUpdate(dpaSpec)
gomega.Expect(err).ToNot(gomega.HaveOccurred())

log.Printf("Waiting for DPA to be reconciled with NonAdmin disabled")
gomega.Eventually(dpaCR.IsReconciledTrue(), time.Minute*2, time.Second*5).Should(gomega.BeTrue())
})

ginkgo.It("Should enable and disable VMFileRestore", func() {
// 1. Enable VMFileRestore
testSpec := TestDPASpec{
BSLSecretName: bslSecretName,
EnableVMFR: true,
}
dpaSpec := createTestDPASpec(testSpec)
err := dpaCR.CreateOrUpdate(dpaSpec)
gomega.Expect(err).ToNot(gomega.HaveOccurred())

log.Printf("Waiting for DPA to be reconciled with VMFileRestore enabled")
gomega.Eventually(dpaCR.IsReconciledTrue(), time.Minute*2, time.Second*5).Should(gomega.BeTrue())

// 2. Disable VMFileRestore
testSpec.EnableVMFR = false
dpaSpec = createTestDPASpec(testSpec)
err = dpaCR.CreateOrUpdate(dpaSpec)
gomega.Expect(err).ToNot(gomega.HaveOccurred())

log.Printf("Waiting for DPA to be reconciled with VMFileRestore disabled")
gomega.Eventually(dpaCR.IsReconciledTrue(), time.Minute*2, time.Second*5).Should(gomega.BeTrue())
})

ginkgo.DescribeTable("DPA Deletion test",
func() {
log.Printf("Creating DPA")
Expand Down