summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/commands/integration
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/commands/integration')
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/acme.py14
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/cs.py13
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py40
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py3
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/nios.py14
-rw-r--r--test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py9
6 files changed, 37 insertions, 56 deletions
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py b/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py
index e8020ca9a9..136c533196 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/acme.py
@@ -8,7 +8,6 @@ from ....config import (
)
from ....containers import (
- CleanupMode,
run_support_container,
)
@@ -22,8 +21,6 @@ from . import (
class ACMEProvider(CloudProvider):
"""ACME plugin. Sets up cloud resources for tests."""
- DOCKER_SIMULATOR_NAME = 'acme-simulator'
-
def __init__(self, args: IntegrationConfig) -> None:
super().__init__(args)
@@ -51,17 +48,18 @@ class ACMEProvider(CloudProvider):
14000, # Pebble ACME CA
]
- run_support_container(
+ descriptor = run_support_container(
self.args,
self.platform,
self.image,
- self.DOCKER_SIMULATOR_NAME,
+ 'acme-simulator',
ports,
- allow_existing=True,
- cleanup=CleanupMode.YES,
)
- self._set_cloud_config('acme_host', self.DOCKER_SIMULATOR_NAME)
+ if not descriptor:
+ return
+
+ self._set_cloud_config('acme_host', descriptor.name)
def _setup_static(self) -> None:
raise NotImplementedError()
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py b/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py
index 0b7ae61d2f..706c8ec19d 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/cs.py
@@ -21,7 +21,6 @@ from ....docker_util import (
)
from ....containers import (
- CleanupMode,
run_support_container,
wait_for_file,
)
@@ -36,8 +35,6 @@ from . import (
class CsCloudProvider(CloudProvider):
"""CloudStack cloud provider plugin. Sets up cloud resources before delegation."""
- DOCKER_SIMULATOR_NAME = 'cloudstack-sim'
-
def __init__(self, args: IntegrationConfig) -> None:
super().__init__(args)
@@ -96,10 +93,8 @@ class CsCloudProvider(CloudProvider):
self.args,
self.platform,
self.image,
- self.DOCKER_SIMULATOR_NAME,
+ 'cloudstack-sim',
ports,
- allow_existing=True,
- cleanup=CleanupMode.YES,
)
if not descriptor:
@@ -107,7 +102,7 @@ class CsCloudProvider(CloudProvider):
# apply work-around for OverlayFS issue
# https://github.com/docker/for-linux/issues/72#issuecomment-319904698
- docker_exec(self.args, self.DOCKER_SIMULATOR_NAME, ['find', '/var/lib/mysql', '-type', 'f', '-exec', 'touch', '{}', ';'], capture=True)
+ docker_exec(self.args, descriptor.name, ['find', '/var/lib/mysql', '-type', 'f', '-exec', 'touch', '{}', ';'], capture=True)
if self.args.explain:
values = dict(
@@ -115,10 +110,10 @@ class CsCloudProvider(CloudProvider):
PORT=str(self.port),
)
else:
- credentials = self._get_credentials(self.DOCKER_SIMULATOR_NAME)
+ credentials = self._get_credentials(descriptor.name)
values = dict(
- HOST=self.DOCKER_SIMULATOR_NAME,
+ HOST=descriptor.name,
PORT=str(self.port),
KEY=credentials['apikey'],
SECRET=credentials['secretkey'],
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py b/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py
index 1391cd8454..ebe8d1ca11 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/galaxy.py
@@ -25,10 +25,10 @@ from . import (
# We add BasicAuthentication, to make the tasks that deal with
# direct API access easier to deal with across galaxy_ng and pulp
-SETTINGS = b'''
-CONTENT_ORIGIN = 'http://ansible-ci-pulp:80'
-ANSIBLE_API_HOSTNAME = 'http://ansible-ci-pulp:80'
-ANSIBLE_CONTENT_HOSTNAME = 'http://ansible-ci-pulp:80/pulp/content'
+SETTINGS = '''
+CONTENT_ORIGIN = 'http://{host}:80'
+ANSIBLE_API_HOSTNAME = 'http://{host}:80'
+ANSIBLE_CONTENT_HOSTNAME = 'http://{host}:80/pulp/content'
TOKEN_AUTH_DISABLED = True
GALAXY_REQUIRE_CONTENT_APPROVAL = False
GALAXY_AUTHENTICATION_CLASSES = [
@@ -97,7 +97,6 @@ class GalaxyProvider(CloudProvider):
super().setup()
galaxy_port = 80
- pulp_host = 'ansible-ci-pulp'
pulp_port = 24817
ports = [
@@ -110,32 +109,31 @@ class GalaxyProvider(CloudProvider):
self.args,
self.platform,
self.pulp,
- pulp_host,
+ 'galaxy-pulp',
ports,
start=False,
- allow_existing=True,
)
if not descriptor:
return
- if not descriptor.running:
- pulp_id = descriptor.container_id
+ pulp_id = descriptor.container_id
- injected_files = {
- '/etc/pulp/settings.py': SETTINGS,
- '/etc/cont-init.d/111-postgres': SET_ADMIN_PASSWORD,
- '/etc/cont-init.d/000-ansible-test-overrides': OVERRIDES,
- }
- for path, content in injected_files.items():
- with tempfile.NamedTemporaryFile() as temp_fd:
- temp_fd.write(content)
- temp_fd.flush()
- docker_cp_to(self.args, pulp_id, temp_fd.name, path)
+ injected_files = {
+ '/etc/pulp/settings.py': SETTINGS.format(host=descriptor.name).encode(),
+ '/etc/cont-init.d/111-postgres': SET_ADMIN_PASSWORD,
+ '/etc/cont-init.d/000-ansible-test-overrides': OVERRIDES,
+ }
- descriptor.start(self.args)
+ for path, content in injected_files.items():
+ with tempfile.NamedTemporaryFile() as temp_fd:
+ temp_fd.write(content)
+ temp_fd.flush()
+ docker_cp_to(self.args, pulp_id, temp_fd.name, path)
- self._set_cloud_config('PULP_HOST', pulp_host)
+ descriptor.start(self.args)
+
+ self._set_cloud_config('PULP_HOST', descriptor.name)
self._set_cloud_config('PULP_PORT', str(pulp_port))
self._set_cloud_config('GALAXY_PORT', str(galaxy_port))
self._set_cloud_config('PULP_USER', 'admin')
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py b/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py
index 85065d6f3b..b3cf2d4905 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py
@@ -13,7 +13,6 @@ from ....config import (
)
from ....containers import (
- CleanupMode,
run_support_container,
)
@@ -62,8 +61,6 @@ class HttptesterProvider(CloudProvider):
'http-test-container',
ports,
aliases=aliases,
- allow_existing=True,
- cleanup=CleanupMode.YES,
env={
KRB5_PASSWORD_ENV: generate_password(),
},
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py b/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py
index a515ae89fa..cc54720836 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/nios.py
@@ -8,7 +8,6 @@ from ....config import (
)
from ....containers import (
- CleanupMode,
run_support_container,
)
@@ -22,8 +21,6 @@ from . import (
class NiosProvider(CloudProvider):
"""Nios plugin. Sets up NIOS mock server for tests."""
- DOCKER_SIMULATOR_NAME = 'nios-simulator'
-
# Default image to run the nios simulator.
#
# The simulator must be pinned to a specific version
@@ -65,17 +62,18 @@ class NiosProvider(CloudProvider):
nios_port,
]
- run_support_container(
+ descriptor = run_support_container(
self.args,
self.platform,
self.image,
- self.DOCKER_SIMULATOR_NAME,
+ 'nios-simulator',
ports,
- allow_existing=True,
- cleanup=CleanupMode.YES,
)
- self._set_cloud_config('NIOS_HOST', self.DOCKER_SIMULATOR_NAME)
+ if not descriptor:
+ return
+
+ self._set_cloud_config('NIOS_HOST', descriptor.name)
def _setup_static(self) -> None:
raise NotImplementedError()
diff --git a/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py b/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py
index ddd434a817..6e8a5e4fdd 100644
--- a/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py
+++ b/test/lib/ansible_test/_internal/commands/integration/cloud/openshift.py
@@ -16,7 +16,6 @@ from ....config import (
)
from ....containers import (
- CleanupMode,
run_support_container,
wait_for_file,
)
@@ -31,8 +30,6 @@ from . import (
class OpenShiftCloudProvider(CloudProvider):
"""OpenShift cloud provider plugin. Sets up cloud resources before delegation."""
- DOCKER_CONTAINER_NAME = 'openshift-origin'
-
def __init__(self, args: IntegrationConfig) -> None:
super().__init__(args, config_extension='.kubeconfig')
@@ -74,10 +71,8 @@ class OpenShiftCloudProvider(CloudProvider):
self.args,
self.platform,
self.image,
- self.DOCKER_CONTAINER_NAME,
+ 'openshift-origin',
ports,
- allow_existing=True,
- cleanup=CleanupMode.YES,
cmd=cmd,
)
@@ -87,7 +82,7 @@ class OpenShiftCloudProvider(CloudProvider):
if self.args.explain:
config = '# Unknown'
else:
- config = self._get_config(self.DOCKER_CONTAINER_NAME, 'https://%s:%s/' % (self.DOCKER_CONTAINER_NAME, port))
+ config = self._get_config(descriptor.name, 'https://%s:%s/' % (descriptor.name, port))
self._write_config(config)