Acceptance Tests: add port redirection for ssh by default
authorCleber Rosa <crosa@redhat.com>
Mon, 12 Apr 2021 04:46:38 +0000 (00:46 -0400)
committerJohn Snow <jsnow@redhat.com>
Tue, 1 Jun 2021 20:21:20 +0000 (16:21 -0400)
For users of the LinuxTest class, let's set up the VM with the port
redirection for SSH, instead of requiring each test to set the same
arguments.

It also sets the network device, by default, to virtio-net.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20210412044644.55083-6-crosa@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
tests/acceptance/avocado_qemu/__init__.py
tests/acceptance/virtiofs_submounts.py

index 67f75f66e560a3d85513d489c67f440df57e9904..0856880000f350621d54cc8c4d819c1251e5ca9d 100644 (file)
@@ -309,10 +309,13 @@ class LinuxTest(Test, LinuxSSHMixIn):
     timeout = 900
     chksum = None
 
-    def setUp(self, ssh_pubkey=None):
+    def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
         super(LinuxTest, self).setUp()
         self.vm.add_args('-smp', '2')
         self.vm.add_args('-m', '1024')
+        # The following network device allows for SSH connections
+        self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
+                         '-device', '%s,netdev=vnet' % network_device_type)
         self.set_up_boot()
         if ssh_pubkey is None:
             ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys()
index bed8ce44dfc6849ef6d64c0f328faa4824ec344a..e10a935ac4e9c7c767876106ad8eb47ad774d1d7 100644 (file)
@@ -207,10 +207,6 @@ class VirtiofsSubmountsTest(LinuxTest):
             self.vm.add_args('-kernel', vmlinuz,
                              '-append', 'console=ttyS0 root=/dev/sda1')
 
-        # Allow us to connect to SSH
-        self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22',
-                         '-device', 'virtio-net,netdev=vnet')
-
         self.require_accelerator("kvm")
         self.vm.add_args('-accel', 'kvm')