Test fixes and tweaks

Fixed issue where tests/framework.py was ignorning DISTRO env
variable.

Added SNAP_FILE env variable, which allows tests to be run on an
abitrary .snap file. For example, one fetch with `snap download`.

Change-Id: Ie6cce841e00d6d56d0525d0a81c4faad3c54e8e8
This commit is contained in:
Pete Vander Giessen 2020-04-02 18:11:56 +00:00
parent 2a0f9c609a
commit f6c44fb77a
2 changed files with 5 additions and 5 deletions

View File

@ -81,8 +81,9 @@ class Host():
self.prefix = []
self.dump_dir = '/tmp'
self.machine = ''
self.distro = 'bionic'
self.snap = 'microstack_stein_amd64.snap'
self.distro = os.environ.get('DISTRO') or 'bionic'
self.snap = os.environ.get('SNAP_FILE') or \
'microstack_stein_amd64.snap'
self.horizon_ip = '10.20.20.1'
self.host_type = 'localhost'
@ -106,11 +107,10 @@ class Host():
def multipass(self):
self.machine = petname.generate()
self.prefix = ['multipass', 'exec', self.machine, '--']
distro = os.environ.get('distro') or self.distro
check('sudo', 'snap', 'install', '--classic', '--edge', 'multipass')
check('multipass', 'launch', '--cpus', '2', '--mem', '8G', distro,
check('multipass', 'launch', '--cpus', '2', '--mem', '8G', self.distro,
'--name', self.machine)
check('multipass', 'copy-files', self.snap, '{}:'.format(self.machine))

View File

@ -8,7 +8,7 @@ install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
setenv =
PATH = /snap/bin:{env:PATH}
passenv = HOME TERM DISTRO INTERACTIVE_DEBUG USER
passenv = HOME TERM DISTRO INTERACTIVE_DEBUG USER SNAP_FILE
whitelist_externals =
sudo
/snap/bin/snapcraft