summaryrefslogtreecommitdiff
path: root/tests/integration_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration_tests')
-rw-r--r--tests/integration_tests/instances.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/tests/integration_tests/instances.py b/tests/integration_tests/instances.py
index a0a5fb6b..033847b8 100644
--- a/tests/integration_tests/instances.py
+++ b/tests/integration_tests/instances.py
@@ -26,8 +26,6 @@ def _get_tmp_path():
class IntegrationInstance:
- use_sudo = True
-
def __init__(self, cloud: 'IntegrationCloud', instance: BaseInstance,
settings=integration_settings):
self.cloud = cloud
@@ -37,11 +35,9 @@ class IntegrationInstance:
def destroy(self):
self.instance.delete()
- def execute(self, command, *, use_sudo=None) -> Result:
+ def execute(self, command, *, use_sudo=True) -> Result:
if self.instance.username == 'root' and use_sudo is False:
raise Exception('Root user cannot run unprivileged')
- if use_sudo is None:
- use_sudo = self.use_sudo
return self.instance.execute(command, use_sudo=use_sudo)
def pull_file(self, remote_path, local_path):
@@ -97,21 +93,21 @@ class IntegrationInstance:
def install_proposed_image(self):
log.info('Installing proposed image')
remote_script = (
- '{sudo} echo deb "http://archive.ubuntu.com/ubuntu '
+ 'echo deb "http://archive.ubuntu.com/ubuntu '
'$(lsb_release -sc)-proposed main" | '
- '{sudo} tee /etc/apt/sources.list.d/proposed.list\n'
- '{sudo} apt-get update -q\n'
- '{sudo} apt-get install -qy cloud-init'
- ).format(sudo='sudo' if self.use_sudo else '')
+ 'tee /etc/apt/sources.list.d/proposed.list\n'
+ 'apt-get update -q\n'
+ 'apt-get install -qy cloud-init'
+ )
self._install_new_cloud_init(remote_script)
def install_ppa(self, repo):
log.info('Installing PPA')
remote_script = (
- '{sudo} add-apt-repository {repo} -y && '
- '{sudo} apt-get update -q && '
- '{sudo} apt-get install -qy cloud-init'
- ).format(sudo='sudo' if self.use_sudo else '', repo=repo)
+ 'add-apt-repository {repo} -y && '
+ 'apt-get update -q && '
+ 'apt-get install -qy cloud-init'
+ ).format(repo=repo)
self._install_new_cloud_init(remote_script)
def install_deb(self):
@@ -122,8 +118,7 @@ class IntegrationInstance:
self.push_file(
local_path=integration_settings.CLOUD_INIT_SOURCE,
remote_path=remote_path)
- remote_script = '{sudo} dpkg -i {path}'.format(
- sudo='sudo' if self.use_sudo else '', path=remote_path)
+ remote_script = 'dpkg -i {path}'.format(path=remote_path)
self._install_new_cloud_init(remote_script)
def __enter__(self):
@@ -151,4 +146,4 @@ class IntegrationOciInstance(IntegrationInstance):
class IntegrationLxdInstance(IntegrationInstance):
- use_sudo = False
+ pass