forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a functional test to ensure we catch bogus disk paths
Signed-off-by: Jed Lejosne <[email protected]>
- Loading branch information
1 parent
b812d21
commit 66efd26
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,6 +269,20 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp | |
}) | ||
}) | ||
}) | ||
Describe("Bogus container disk path", func() { | ||
Context("that points to outside of the volume", func() { | ||
It("should be rejected on VMI creation", func() { | ||
vmi := libvmi.NewAlpine() | ||
vmi.Spec.Volumes[0].ContainerDisk.Path = "../test" | ||
By("Starting the VirtualMachineInstance") | ||
_, err := virtClient.RestClient().Post().Resource("virtualmachineinstances").Namespace(util.NamespaceTestDefault).Body(vmi).Do(context.Background()).Get() | ||
Expect(err).To(HaveOccurred()) | ||
Expect(err.Error()).To(ContainSubstring("admission webhook")) | ||
Expect(err.Error()).To(ContainSubstring("denied the request")) | ||
Expect(err.Error()).To(ContainSubstring("must be an absolute path to a file without relative components")) | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
func getContainerDiskContainerOfPod(pod *k8sv1.Pod, volumeName string) *k8sv1.Container { | ||
|