Skip to content

Commit

Permalink
QA-176 --debug-owner option adds label to ADCM docker container (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sealwing authored Jul 12, 2021
1 parent 369ccbf commit f1e693b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
packages=find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True,
version="4.4.3",
version="4.4.4",
# the following makes a plugin available to pytest
entry_points={"pytest11": ["adcm_pytest_plugin = adcm_pytest_plugin.plugin"]},
# custom PyPI classifier for pytest plugins
Expand Down
18 changes: 10 additions & 8 deletions src/adcm_pytest_plugin/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def image(request, cmd_opts, adcm_api_credentials, additional_adcm_init_config):
def _adcm(image, cmd_opts, request, adcm_api_credentials, upgradable=False) -> Generator[ADCM, None, None]:
repo, tag = image
labels = {"pytest_node_id": request.node.nodeid}
# this option can be passed from private adcm-pytest-tools (check it's README.md for more info)
if hasattr(cmd_opts, "debug_owner") and cmd_opts.debug_owner:
labels["debug_owner"] = cmd_opts.debug_owner
docker_url = None
if cmd_opts.remote_docker:
docker_url = f"tcp://{cmd_opts.remote_docker}"
Expand All @@ -149,14 +152,13 @@ def _adcm(image, cmd_opts, request, adcm_api_credentials, upgradable=False) -> G
else:
dw = DockerWrapper()
ip = _get_connection_ip(cmd_opts.remote_executor_host) if cmd_opts.remote_executor_host else None
if ip and is_docker():
if _get_if_type(ip) == "0":
raise EnvironmentError(
"You are using network interface with 'bridge' "
"type while running inside container."
"There is no obvious way to get external ip in this case."
"Try running container with pytest with --net=host option"
)
if ip and is_docker() and _get_if_type(ip) == "0":
raise EnvironmentError(
"You are using network interface with 'bridge' "
"type while running inside container."
"There is no obvious way to get external ip in this case."
"Try running container with pytest with --net=host option"
)
volumes = {}
if upgradable:
volume_name = str(uuid.uuid4())[-12:]
Expand Down

0 comments on commit f1e693b

Please sign in to comment.