Skip to content

Commit

Permalink
tests: Ensure proper cleanup (scsi reservation)
Browse files Browse the repository at this point in the history
Check that after PersistentReservation feature gate is disabled, no
mount points or socket files are left behind.

Signed-off-by: Vasiliy Ulyanov <[email protected]>
  • Loading branch information
vasiliy-ul committed Jul 31, 2023
1 parent ca4c9b5 commit a3004aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/storage/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ go_library(
"//pkg/certificates/triple/cert:go_default_library",
"//pkg/host-disk:go_default_library",
"//pkg/pointer:go_default_library",
"//pkg/storage/reservation:go_default_library",
"//pkg/storage/types:go_default_library",
"//pkg/virt-config:go_default_library",
"//pkg/virt-launcher/virtwrap/converter:go_default_library",
Expand Down
12 changes: 12 additions & 0 deletions tests/storage/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import (
v1 "kubevirt.io/api/core/v1"
"kubevirt.io/client-go/kubecli"

"kubevirt.io/kubevirt/pkg/storage/reservation"
virtconfig "kubevirt.io/kubevirt/pkg/virt-config"
"kubevirt.io/kubevirt/tests"
"kubevirt.io/kubevirt/tests/console"
"kubevirt.io/kubevirt/tests/exec"
"kubevirt.io/kubevirt/tests/flags"
"kubevirt.io/kubevirt/tests/framework/checks"
"kubevirt.io/kubevirt/tests/libnode"
"kubevirt.io/kubevirt/tests/libstorage"
"kubevirt.io/kubevirt/tests/libvmi"
"kubevirt.io/kubevirt/tests/libwait"
Expand Down Expand Up @@ -307,6 +309,16 @@ var _ = SIGDescribe("[Serial]SCSI persistent reservation", Serial, func() {
}
return len(ds.Spec.Template.Spec.Containers) == 1
}, time.Minute*5, time.Second*2).Should(BeTrue())

nodes := libnode.GetAllSchedulableNodes(virtClient)
for _, node := range nodes.Items {
output, err := tests.ExecuteCommandInVirtHandlerPod(node.Name, []string{"mount"})
Expect(err).ToNot(HaveOccurred())
Expect(output).ToNot(ContainSubstring("kubevirt/daemons/pr"))
output, err = tests.ExecuteCommandInVirtHandlerPod(node.Name, []string{"ls", reservation.GetPrHelperSocketDir()})
Expect(err).ToNot(HaveOccurred())
Expect(output).To(BeEmpty())
}
})
})

Expand Down

0 comments on commit a3004aa

Please sign in to comment.