Message ID | 20210323221539.3532660-8-crosa@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Acceptance Test: introduce base class for Linux based tests | expand |
On Wed, Mar 24, 2021 at 2:34 AM Cleber Rosa <crosa@redhat.com> wrote: > The LinuxTest specifically targets users that need to interact with Linux > guests. So, it makes sense to give a connection by default, and avoid > requiring it as boiler-plate code. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 5 ++++- > tests/acceptance/virtiofs_submounts.py | 1 - > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py > b/tests/acceptance/avocado_qemu/__init__.py > index 535f63a48d..4960142bcc 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): > cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) > self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) > > - def launch_and_wait(self): > + def launch_and_wait(self, set_up_ssh_connection=True): > self.vm.set_console() > self.vm.launch() > console_drainer = > datadrainer.LineLogger(self.vm.console_socket.fileno(), > @@ -398,3 +398,6 @@ def launch_and_wait(self): > console_drainer.start() > self.log.info('VM launched, waiting for boot confirmation from > guest') > cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), > self.name) > + if set_up_ssh_connection: > + self.log.info('Setting up the SSH connection') > + self.ssh_connect(self.username, self.ssh_key) > diff --git a/tests/acceptance/virtiofs_submounts.py > b/tests/acceptance/virtiofs_submounts.py > index e10a935ac4..e019d3b896 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -136,7 +136,6 @@ def set_up_virtiofs(self): > > def launch_vm(self): > self.launch_and_wait() > - self.ssh_connect('root', self.ssh_key) > > def set_up_nested_mounts(self): > scratch_dir = os.path.join(self.shared_dir, 'scratch') > -- > 2.25.4 > > >
Hi Cleber, On 3/23/21 11:15 PM, Cleber Rosa wrote: > The LinuxTest specifically targets users that need to interact with Linux > guests. So, it makes sense to give a connection by default, and avoid > requiring it as boiler-plate code. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 5 ++++- > tests/acceptance/virtiofs_submounts.py | 1 - > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > index 535f63a48d..4960142bcc 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): > cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) > self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) > > - def launch_and_wait(self): > + def launch_and_wait(self, set_up_ssh_connection=True): > self.vm.set_console() > self.vm.launch() > console_drainer = datadrainer.LineLogger(self.vm.console_socket.fileno(), > @@ -398,3 +398,6 @@ def launch_and_wait(self): > console_drainer.start() > self.log.info('VM launched, waiting for boot confirmation from guest') > cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name) > + if set_up_ssh_connection: > + self.log.info('Setting up the SSH connection') > + self.ssh_connect(self.username, self.ssh_key) > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > index e10a935ac4..e019d3b896 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -136,7 +136,6 @@ def set_up_virtiofs(self): > > def launch_vm(self): > self.launch_and_wait() > - self.ssh_connect('root', self.ssh_key) > > def set_up_nested_mounts(self): > scratch_dir = os.path.join(self.shared_dir, 'scratch') > what about launch_and_wait calls in boot_linux.py. Don't you want to force ssh connection off there? Thanks Eric
On Tue, Mar 23, 2021 at 7:16 PM Cleber Rosa <crosa@redhat.com> wrote: > > The LinuxTest specifically targets users that need to interact with Linux > guests. So, it makes sense to give a connection by default, and avoid > requiring it as boiler-plate code. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 5 ++++- > tests/acceptance/virtiofs_submounts.py | 1 - > 2 files changed, 4 insertions(+), 2 deletions(-) > Reviewed-by: Willian Rampazzo <willianr@redhat.com>
On Wed, Mar 24, 2021 at 10:22:47AM +0100, Auger Eric wrote: > Hi Cleber, > > On 3/23/21 11:15 PM, Cleber Rosa wrote: > > The LinuxTest specifically targets users that need to interact with Linux > > guests. So, it makes sense to give a connection by default, and avoid > > requiring it as boiler-plate code. > > > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > > --- > > tests/acceptance/avocado_qemu/__init__.py | 5 ++++- > > tests/acceptance/virtiofs_submounts.py | 1 - > > 2 files changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > > index 535f63a48d..4960142bcc 100644 > > --- a/tests/acceptance/avocado_qemu/__init__.py > > +++ b/tests/acceptance/avocado_qemu/__init__.py > > @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): > > cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) > > self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) > > > > - def launch_and_wait(self): > > + def launch_and_wait(self, set_up_ssh_connection=True): > > self.vm.set_console() > > self.vm.launch() > > console_drainer = datadrainer.LineLogger(self.vm.console_socket.fileno(), > > @@ -398,3 +398,6 @@ def launch_and_wait(self): > > console_drainer.start() > > self.log.info('VM launched, waiting for boot confirmation from guest') > > cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name) > > + if set_up_ssh_connection: > > + self.log.info('Setting up the SSH connection') > > + self.ssh_connect(self.username, self.ssh_key) > > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > > index e10a935ac4..e019d3b896 100644 > > --- a/tests/acceptance/virtiofs_submounts.py > > +++ b/tests/acceptance/virtiofs_submounts.py > > @@ -136,7 +136,6 @@ def set_up_virtiofs(self): > > > > def launch_vm(self): > > self.launch_and_wait() > > - self.ssh_connect('root', self.ssh_key) > > > > def set_up_nested_mounts(self): > > scratch_dir = os.path.join(self.shared_dir, 'scratch') > > > what about launch_and_wait calls in boot_linux.py. Don't you want to > force ssh connection off there? > Good point. I guess one could argue that it doesn't hurt those tests, and even that it "tests more". But, I'd argue that less is more here indeed. I'll change those launch_and_wait() to include set_up_ssh_connection=False for those tests. > Thanks > > Eric Thanks a lot! - Cleber.
Hi, On 3/23/21 7:15 PM, Cleber Rosa wrote: > The LinuxTest specifically targets users that need to interact with Linux > guests. So, it makes sense to give a connection by default, and avoid > requiring it as boiler-plate code. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 5 ++++- > tests/acceptance/virtiofs_submounts.py | 1 - > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > index 535f63a48d..4960142bcc 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): > cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) > self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) > > - def launch_and_wait(self): > + def launch_and_wait(self, set_up_ssh_connection=True): > self.vm.set_console() > self.vm.launch() > console_drainer = datadrainer.LineLogger(self.vm.console_socket.fileno(), > @@ -398,3 +398,6 @@ def launch_and_wait(self): > console_drainer.start() > self.log.info('VM launched, waiting for boot confirmation from guest') > cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name) > + if set_up_ssh_connection: > + self.log.info('Setting up the SSH connection') > + self.ssh_connect(self.username, self.ssh_key) Where is self.username set? - Wainer > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > index e10a935ac4..e019d3b896 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -136,7 +136,6 @@ def set_up_virtiofs(self): > > def launch_vm(self): > self.launch_and_wait() > - self.ssh_connect('root', self.ssh_key) > > def set_up_nested_mounts(self): > scratch_dir = os.path.join(self.shared_dir, 'scratch')
On 3/25/21 11:31 AM, Wainer dos Santos Moschetta wrote: > Hi, > > On 3/23/21 7:15 PM, Cleber Rosa wrote: >> The LinuxTest specifically targets users that need to interact with >> Linux >> guests. So, it makes sense to give a connection by default, and avoid >> requiring it as boiler-plate code. >> >> Signed-off-by: Cleber Rosa <crosa@redhat.com> >> --- >> tests/acceptance/avocado_qemu/__init__.py | 5 ++++- >> tests/acceptance/virtiofs_submounts.py | 1 - >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/tests/acceptance/avocado_qemu/__init__.py >> b/tests/acceptance/avocado_qemu/__init__.py >> index 535f63a48d..4960142bcc 100644 >> --- a/tests/acceptance/avocado_qemu/__init__.py >> +++ b/tests/acceptance/avocado_qemu/__init__.py >> @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): >> cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) >> self.vm.add_args('-drive', 'file=%s,format=raw' % >> cloudinit_iso) >> - def launch_and_wait(self): >> + def launch_and_wait(self, set_up_ssh_connection=True): >> self.vm.set_console() >> self.vm.launch() >> console_drainer = >> datadrainer.LineLogger(self.vm.console_socket.fileno(), >> @@ -398,3 +398,6 @@ def launch_and_wait(self): >> console_drainer.start() >> self.log.info('VM launched, waiting for boot confirmation >> from guest') >> cloudinit.wait_for_phone_home(('0.0.0.0', >> self.phone_home_port), self.name) >> + if set_up_ssh_connection: >> + self.log.info('Setting up the SSH connection') >> + self.ssh_connect(self.username, self.ssh_key) > > Where is self.username set? Never mind, I missed patch 06. > > > - Wainer > >> diff --git a/tests/acceptance/virtiofs_submounts.py >> b/tests/acceptance/virtiofs_submounts.py >> index e10a935ac4..e019d3b896 100644 >> --- a/tests/acceptance/virtiofs_submounts.py >> +++ b/tests/acceptance/virtiofs_submounts.py >> @@ -136,7 +136,6 @@ def set_up_virtiofs(self): >> def launch_vm(self): >> self.launch_and_wait() >> - self.ssh_connect('root', self.ssh_key) >> def set_up_nested_mounts(self): >> scratch_dir = os.path.join(self.shared_dir, 'scratch') > >
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 535f63a48d..4960142bcc 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -390,7 +390,7 @@ def set_up_cloudinit(self, ssh_pubkey=None): cloudinit_iso = self.prepare_cloudinit(ssh_pubkey) self.vm.add_args('-drive', 'file=%s,format=raw' % cloudinit_iso) - def launch_and_wait(self): + def launch_and_wait(self, set_up_ssh_connection=True): self.vm.set_console() self.vm.launch() console_drainer = datadrainer.LineLogger(self.vm.console_socket.fileno(), @@ -398,3 +398,6 @@ def launch_and_wait(self): console_drainer.start() self.log.info('VM launched, waiting for boot confirmation from guest') cloudinit.wait_for_phone_home(('0.0.0.0', self.phone_home_port), self.name) + if set_up_ssh_connection: + self.log.info('Setting up the SSH connection') + self.ssh_connect(self.username, self.ssh_key) diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index e10a935ac4..e019d3b896 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -136,7 +136,6 @@ def set_up_virtiofs(self): def launch_vm(self): self.launch_and_wait() - self.ssh_connect('root', self.ssh_key) def set_up_nested_mounts(self): scratch_dir = os.path.join(self.shared_dir, 'scratch')
The LinuxTest specifically targets users that need to interact with Linux guests. So, it makes sense to give a connection by default, and avoid requiring it as boiler-plate code. Signed-off-by: Cleber Rosa <crosa@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 5 ++++- tests/acceptance/virtiofs_submounts.py | 1 - 2 files changed, 4 insertions(+), 2 deletions(-)