Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/integration_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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))
3 changes: 2 additions & 1 deletion tests/integration_tests/bugs/test_gh626.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
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:
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/bugs/test_gh668.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

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
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_tests/bugs/test_lp1898997.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
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 = """\
Expand Down
12 changes: 7 additions & 5 deletions tests/integration_tests/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ def launch(self, user_data=None, launch_kwargs=None,
}
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)
Expand Down Expand Up @@ -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
Expand All @@ -260,8 +260,10 @@ def _mount_source(instance: LXDInstance):
'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} '
Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/integration_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
##################################################################
# 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
Expand Down