Browse Source

tests: --provider default is ENOUGH_PROVIDER

keep-around/e59966cbdea5210f35ad25d6b0e35d093b7a1080
Loïc Dachary 9 months ago
parent
commit
63a1b490e8
Signed by: dachary GPG Key ID: 992D23B392F9E4F2
  1. 4
      conftest.py
  2. 1
      playbooks/conftest.py
  3. 6
      tox.ini

4
conftest.py

@ -1,3 +1,5 @@
import os
from tests.icinga_helper import IcingaHelper
@ -9,6 +11,6 @@ def pytest_addoption(parser):
parser.addoption(
'--provider',
choices=('fuga', 'ovh'),
default='ovh',
default=os.environ.get('ENOUGH_PROVIDER', 'ovh'),
help='Name of the OpenStack provider used for the tests'
)

1
playbooks/conftest.py

@ -96,6 +96,7 @@ def pytest_sessionfinish(session, exitstatus):
def enough_destroy(session):
service_directory = session.config.getoption("--enough-service")
provider = session.config.getoption("--provider")
os.environ['ENOUGH_PROVIDER'] = provider
domain = f'{service_directory}.test'
enough_dot_dir = session.config.cache.makedir('dotenough')
config_dir = make_config_dir(domain, enough_dot_dir)

6
tox.ini

@ -27,16 +27,18 @@ commands = flake8 {posargs}
[testenv:{infrastructure,bind,authorized_keys,backup,certificate,postfix,icinga,openvpn,wekan,misc,pad,firewall,gitlab,api,wazuh,weblate,website,chat,cloud,enough,forum,packages,securedrop,jitsi,wordpress,openedx,psono}]
passenv =
ENOUGH_API_TOKEN
ENOUGH_PROVIDER
PYTEST_ADDOPTS
# REQUESTS_CA_BUNDLE is set in enough/common/data/base.dockerfile but inconvenient in a test environment
commands = env --unset=REQUESTS_CA_BUNDLE {envbindir}/py.test --log-cli-level INFO -s --ssh-identity-file=infrastructure_key --ansible-inventory={envdir}/.pytest_cache/d/dotenough/{envname}.test/inventory {posargs:--provider {env:ENOUGH_PROVIDER:ovh} playbooks/{envname}/tests}
commands = env --unset=REQUESTS_CA_BUNDLE {envbindir}/py.test --log-cli-level INFO -s --ssh-identity-file=infrastructure_key --ansible-inventory={envdir}/.pytest_cache/d/dotenough/{envname}.test/inventory {posargs:playbooks/{envname}/tests}
[testenv:enough_nginx]
passenv =
ENOUGH_API_TOKEN
ENOUGH_PROVIDER
PYTEST_ADDOPTS
# REQUESTS_CA_BUNDLE is set in enough/common/data/base.dockerfile but inconvenient in a test environment
commands = env --unset=REQUESTS_CA_BUNDLE {envbindir}/py.test --log-cli-level INFO -s --ssh-identity-file=infrastructure_key --ansible-inventory={envdir}/.pytest_cache/d/dotenough/enough-nginx.test/inventory {posargs:--provider {env:ENOUGH_PROVIDER:ovh} playbooks/enough-nginx/tests}
commands = env --unset=REQUESTS_CA_BUNDLE {envbindir}/py.test --log-cli-level INFO -s --ssh-identity-file=infrastructure_key --ansible-inventory={envdir}/.pytest_cache/d/dotenough/enough-nginx.test/inventory {posargs:playbooks/enough-nginx/tests}
[testenv:docs]
commands = sphinx-build -W -vvv -b html docs build/html

Loading…
Cancel
Save