Skip to content

Commit

Permalink
Update feature gate setup to new CDI version (now on CDI CR)
Browse files Browse the repository at this point in the history
Signed-off-by: Bartosz Rybacki <[email protected]>
  • Loading branch information
brybacki committed Nov 26, 2020
1 parent c8bc909 commit 449dc3d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/datavolume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,26 @@ var _ = Describe("[Serial]DataVolume Integration", func() {
BeforeEach(func() {
By("Enable featuregate=HonorWaitForFirstConsumer")
// in practice we might have HonorWaitForFirstConsumer twice in featureGates array, but this is not a problem
jsonpath := `-o=jsonpath="{.spec.featureGates}"`
out, _, err := tests.RunCommand("kubectl", "get", "cdiconfigs.cdi.kubevirt.io", "config", jsonpath)
jsonpath := `-o=jsonpath="{.spec.config.featureGates}"`
out, _, err := tests.RunCommand("kubectl", "get", "cdis.cdi.kubevirt.io", "cdi", jsonpath)
Expect(err).ToNot(HaveOccurred())

// no feature Gates? we need to add the whole structure, else just add the flag
// Looks like the output might be quoted
if str, err := strconv.Unquote(strings.TrimSpace(out)); str == "" {
patch := `{"spec":{"featureGates":["HonorWaitForFirstConsumer"]}}`
_, _, err = tests.RunCommand("kubectl", "patch", "cdiconfigs.cdi.kubevirt.io", "config", "-o=json", "--type=merge", "-p", patch)
patch := `{"spec": { "config": {"featureGates":["HonorWaitForFirstConsumer"]}}}`
_, _, err = tests.RunCommand("kubectl", "patch", "cdis.cdi.kubevirt.io", "cdi", "-o=json", "--type=merge", "-p", patch)
Expect(err).ToNot(HaveOccurred())
} else {
patch := `[{"op": "add" , "path": "/spec/featureGates/0", "value": "HonorWaitForFirstConsumer"}]`
_, _, err = tests.RunCommand("kubectl", "patch", "cdiconfigs.cdi.kubevirt.io", "config", "--type=json", "-p", patch)
patch := `[{"op": "add" , "path": "/spec/config/featureGates/0", "value": "HonorWaitForFirstConsumer"}]`
_, _, err = tests.RunCommand("kubectl", "patch", "cdis.cdi.kubevirt.io", "cdi", "--type=json", "-p", patch)
Expect(err).ToNot(HaveOccurred())
}
})
AfterEach(func() {
By("Restore featuregates")
patch := `[{"op": "remove" , "path": "/spec/featureGates/0", "value": "HonorWaitForFirstConsumer"}]`
_, _, err = tests.RunCommand("kubectl", "patch", "cdiconfigs.cdi.kubevirt.io", "config", "--type=json", "-p", patch)
patch := `[{"op": "remove" , "path": "/spec/config/featureGates/0", "value": "HonorWaitForFirstConsumer"}]`
_, _, err = tests.RunCommand("kubectl", "patch", "cdis.cdi.kubevirt.io", "cdi", "--type=json", "-p", patch)
Expect(err).ToNot(HaveOccurred())
})
It("[test_id:3189]should be successfully started and stopped multiple times", func() {
Expand Down

0 comments on commit 449dc3d

Please sign in to comment.