summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2021-03-11 11:18:50 -0500
committerGitHub <noreply@github.com>2021-03-11 11:18:50 -0500
commit74e1e50d4c3f1d3e3c6973ad74b06919b3738e34 (patch)
treeb7e8db8f1f5655705d24746f95cc7125b050eebc /tests
parent9bd19645a61586b82e86db6f518dd05c3363b17f (diff)
downloadvyos-cloud-init-74e1e50d4c3f1d3e3c6973ad74b06919b3738e34.tar.gz
vyos-cloud-init-74e1e50d4c3f1d3e3c6973ad74b06919b3738e34.zip
integration_tests: mount more paths IN_PLACE (#838)
This mounts the full directories that we install into systems over their corresponding paths within the system under test, getting us slightly closer to testing what a package would install.
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests/clouds.py44
1 files changed, 27 insertions, 17 deletions
diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index 09a44b3c..a6026309 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -1,6 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
from abc import ABC, abstractmethod
import logging
+import os.path
from uuid import UUID
from pycloudlib import (
@@ -262,23 +263,32 @@ class _LxdIntegrationCloud(IntegrationCloud):
@staticmethod
def _mount_source(instance: LXDInstance):
- target_path = '/usr/lib/python3/dist-packages/cloudinit'
- format_variables = {
- 'name': instance.name,
- 'source_path': cloudinit.__path__[0],
- 'container_path': target_path,
- }
- log.info(
- 'Mounting source %(source_path)s directly onto LXD container/vm '
- 'named %(name)s at %(container_path)s',
- format_variables
- )
- command = (
- 'lxc config device add {name} host-cloud-init disk '
- 'source={source_path} '
- 'path={container_path}'
- ).format(**format_variables)
- subp(command.split())
+ cloudinit_path = cloudinit.__path__[0]
+ mounts = [
+ (cloudinit_path, '/usr/lib/python3/dist-packages/cloudinit'),
+ (os.path.join(cloudinit_path, '..', 'config', 'cloud.cfg.d'),
+ '/etc/cloud/cloud.cfg.d'),
+ (os.path.join(cloudinit_path, '..', 'templates'),
+ '/etc/cloud/templates'),
+ ]
+ for (n, (source_path, target_path)) in enumerate(mounts):
+ format_variables = {
+ 'name': instance.name,
+ 'source_path': os.path.realpath(source_path),
+ 'container_path': target_path,
+ 'idx': n,
+ }
+ log.info(
+ 'Mounting source %(source_path)s directly onto LXD'
+ ' container/VM named %(name)s at %(container_path)s',
+ format_variables
+ )
+ command = (
+ 'lxc config device add {name} host-cloud-init-{idx} disk '
+ 'source={source_path} '
+ 'path={container_path}'
+ ).format(**format_variables)
+ subp(command.split())
def _perform_launch(self, launch_kwargs):
launch_kwargs['inst_type'] = launch_kwargs.pop('instance_type', None)