summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests/__init__.py12
-rw-r--r--tests/integration_tests/bugs/test_gh626.py3
-rw-r--r--tests/integration_tests/bugs/test_gh668.py3
-rw-r--r--tests/integration_tests/bugs/test_lp1898997.py3
-rw-r--r--tests/integration_tests/clouds.py12
-rw-r--r--tests/integration_tests/integration_settings.py1
6 files changed, 26 insertions, 8 deletions
diff --git a/tests/integration_tests/__init__.py b/tests/integration_tests/__init__.py
new file mode 100644
index 00000000..e1d4cd28
--- /dev/null
+++ b/tests/integration_tests/__init__.py
@@ -0,0 +1,12 @@
+import random
+
+
+def random_mac_address() -> str:
+ """Generate a random MAC address.
+
+ The MAC address will have a 1 in its least significant bit, indicating it
+ to be a locally administered address.
+ """
+ return "02:00:00:%02x:%02x:%02x" % (random.randint(0, 255),
+ random.randint(0, 255),
+ random.randint(0, 255))
diff --git a/tests/integration_tests/bugs/test_gh626.py b/tests/integration_tests/bugs/test_gh626.py
index 7b0df6eb..dba01b34 100644
--- a/tests/integration_tests/bugs/test_gh626.py
+++ b/tests/integration_tests/bugs/test_gh626.py
@@ -7,11 +7,12 @@ in the /etc/network/interfaces or netplan config.
import pytest
import yaml
+from tests.integration_tests import random_mac_address
from tests.integration_tests.clouds import ImageSpecification
from tests.integration_tests.instances import IntegrationInstance
-MAC_ADDRESS = "de:ad:be:ef:12:34"
+MAC_ADDRESS = random_mac_address()
NETWORK_CONFIG = """\
version: 2
ethernets:
diff --git a/tests/integration_tests/bugs/test_gh668.py b/tests/integration_tests/bugs/test_gh668.py
index 66ee302e..72fe0afc 100644
--- a/tests/integration_tests/bugs/test_gh668.py
+++ b/tests/integration_tests/bugs/test_gh668.py
@@ -7,12 +7,13 @@ for all network configuration outputs.
import pytest
+from tests.integration_tests import random_mac_address
from tests.integration_tests.instances import IntegrationInstance
DESTINATION_IP = "172.16.0.10"
GATEWAY_IP = "10.0.0.100"
-MAC_ADDRESS = "de:ad:be:ef:12:34"
+MAC_ADDRESS = random_mac_address()
NETWORK_CONFIG = """\
version: 2
diff --git a/tests/integration_tests/bugs/test_lp1898997.py b/tests/integration_tests/bugs/test_lp1898997.py
index 54c88d82..90dc17da 100644
--- a/tests/integration_tests/bugs/test_lp1898997.py
+++ b/tests/integration_tests/bugs/test_lp1898997.py
@@ -10,8 +10,9 @@ network configuration, and confirms that the bridge can be used to ping the
default gateway.
"""
import pytest
+from tests.integration_tests import random_mac_address
-MAC_ADDRESS = "de:ad:be:ef:12:34"
+MAC_ADDRESS = random_mac_address()
NETWORK_CONFIG = """\
diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index 9eebb10a..9527a413 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -153,9 +153,8 @@ class IntegrationCloud(ABC):
}
kwargs.update(launch_kwargs)
log.info(
- "Launching instance with launch_kwargs:\n{}".format(
- "\n".join("{}={}".format(*item) for item in kwargs.items())
- )
+ "Launching instance with launch_kwargs:\n%s",
+ "\n".join("{}={}".format(*item) for item in kwargs.items())
)
pycloudlib_instance = self._perform_launch(kwargs)
@@ -245,6 +244,7 @@ class _LxdIntegrationCloud(IntegrationCloud):
integration_instance_cls = IntegrationLxdInstance
def _get_cloud_instance(self):
+ # pylint: disable=no-member
return self.pycloudlib_instance_cls(tag=self.instance_tag)
@staticmethod
@@ -260,8 +260,10 @@ class _LxdIntegrationCloud(IntegrationCloud):
'container_path': target_path,
}
log.info(
- 'Mounting source {source_path} directly onto LXD container/vm '
- 'named {name} at {container_path}'.format(**format_variables))
+ '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} '
diff --git a/tests/integration_tests/integration_settings.py b/tests/integration_tests/integration_settings.py
index 22b4fdda..54d09d9b 100644
--- a/tests/integration_tests/integration_settings.py
+++ b/tests/integration_tests/integration_settings.py
@@ -92,6 +92,7 @@ KEYPAIR_NAME = None
##################################################################
# Bring in any user-file defined settings
try:
+ # pylint: disable=wildcard-import,unused-wildcard-import
from tests.integration_tests.user_settings import * # noqa
except ImportError:
pass