tox-dev / tox-docker

A tox plugin to run one or more Docker containers during tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make host/port env vars available for substitution in setenv

thenewguy opened this issue · comments

Have had a little bit of a trouble getting elastic/apm-server:7.7.0 image working with tox. One problem I am not able to workaround easily is configuration by environment variables using the variables set by tox-docker.

If the host and port environment variables were available for substitution during setenv it would be helpful:

setenv =
    ...
    ELASTIC_APM_SERVER_URL=http://{env:ELASTIC_APM_SERVER_HOST}:{env:ELASTIC_APM_SERVER_8200_TCP_PORT}

Attempting to set ELASTIC_APM_SERVER_URL to the connection string for apm-server raises tox.exception.MissingSubstitution: MissingSubstitution: ELASTIC_APM_SERVER_HOST.

Here is the relavent configuration to run the apm-server image:

docker =
    ...
    elastic/apm-server:7.7.0
[docker:elastic/apm-server:7.7.0]
healthcheck_cmd = true
healthcheck_interval = 15
healthcheck_timeout = 15
healthcheck_retries = 30
healthcheck_start_period = 10
ports = 8200/tcp

I think this may be really difficult -- pinging @tox-dev/maintainers in case you have any ideas? The values of the env vars isn't known until after tox_runtest_pre runs, which I believe is after all the config value substitution.