add functional tests for inputs
@@ -353,6 +353,65 @@ var _ = Describe("Configurations", func() {
})
+ Context("with input devices", func() {
+ var vmi *v1.VirtualMachineInstance
+ BeforeEach(func() {
+ vmi = tests.NewRandomVMIWithEphemeralDisk(tests.ContainerDiskFor(tests.ContainerDiskFedora))
+ })
+ It("should failed to start the VMI with wrong type of input device", func() {
+ vmi.Spec.Domain.Devices.Inputs = []v1.Input{
+ {
+ Name: "tablet0",
+ Type: "keyboard",
+ Bus: "virtio",
+ },
+ }
+ By("Starting a VirtualMachineInstance")
+ vmi, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi)
+ Expect(err).To(HaveOccurred(), "should not start vmi")
+ })
+
+ It("should failed to start the VMI with wrong bus of input device", func() {
+ vmi.Spec.Domain.Devices.Inputs = []v1.Input{
+ {
+ Name: "tablet0",
+ Type: "tablet",
+ Bus: "ps2",
+ },
+ }
+ By("Starting a VirtualMachineInstance")
+ vmi, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi)
+ Expect(err).To(HaveOccurred(), "should not start vmi")
+ })
+
+ It("should start the VMI with tablet input device", func() {
+ vmi.Spec.Domain.Devices.Inputs = []v1.Input{
+ {
+ Name: "tablet0",
+ Type: "tablet",
+ Bus: "virtio",
+ },
+ }
+ By("Starting a VirtualMachineInstance")
+ vmi, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi)
+ Expect(err).ToNot(HaveOccurred(), "should start vmi")
+
+ tests.WaitForSuccessfulVMIStart(vmi)
+
+ By("Expecting the VirtualMachineInstance console")
+ expecter, err := tests.LoggedInFedoraExpecter(vmi)
+ Expect(err).ToNot(HaveOccurred(), "should start console")
+ defer expecter.Close()
+
+ By("Checking the tablet input under guest OS")
+ _, err = expecter.ExpectBatch([]expect.Batcher{
+ &expect.BSnd{S: "grep -rs '^QEMU Virtio Tablet' /sys/devices | wc -l\n"},
+ &expect.BExp{R: "1"},
+ }, 120*time.Second)
+ Expect(err).ToNot(HaveOccurred(), "should report input device")
+ })
+ })
+
Context("[rfe_id:140][crit:medium][vendor:cnv-qe@redhat.com][level:component]with namespace memory limits above VMI required memory", func() {
var vmi *v1.VirtualMachineInstance
It("[test_id:1670]should failed to start the VMI", func() {
