Skip to content

Commit 33fceee

Browse files
Use new security mechanism based on environment variables (#435)
* Use new security mechanism based on environment variables
1 parent a2afeaa commit 33fceee

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tests/integration/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
"""Fixtures for github runner charm integration tests."""
55
import logging
6+
import os
67
import random
78
import secrets
89
import string
@@ -131,7 +132,7 @@ def path(pytestconfig: pytest.Config) -> str:
131132
@pytest.fixture(scope="module")
132133
def token(pytestconfig: pytest.Config) -> str:
133134
"""Configured token setting."""
134-
token = pytestconfig.getoption("--token")
135+
token = pytestconfig.getoption("--token") or os.environ.get("INTEGRATION_TOKEN")
135136
assert token, "Please specify the --token command line option"
136137
tokens = {token.strip() for token in token.split(",")}
137138
random_token = random.choice(list(tokens))
@@ -141,7 +142,7 @@ def token(pytestconfig: pytest.Config) -> str:
141142
@pytest.fixture(scope="module")
142143
def token_alt(pytestconfig: pytest.Config, token: str) -> str:
143144
"""Configured token_alt setting."""
144-
token_alt = pytestconfig.getoption("--token-alt")
145+
token_alt = pytestconfig.getoption("--token-alt") or os.environ.get("INTEGRATION_TOKEN_ALT")
145146
assert token_alt, (
146147
"Please specify the --token-alt command line option with GitHub Personal "
147148
"Access Token value."
@@ -203,6 +204,7 @@ def private_endpoint_config_fixture(pytestconfig: pytest.Config) -> PrivateEndpo
203204
"""The private endpoint configuration values."""
204205
auth_url = pytestconfig.getoption("--openstack-auth-url-amd64")
205206
password = pytestconfig.getoption("--openstack-password-amd64")
207+
password = password or os.environ.get("INTEGRATION_OPENSTACK_PASSWORD_AMD64")
206208
project_domain_name = pytestconfig.getoption("--openstack-project-domain-name-amd64")
207209
project_name = pytestconfig.getoption("--openstack-project-name-amd64")
208210
user_domain_name = pytestconfig.getoption("--openstack-user-domain-name-amd64")

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ commands =
110110
description = Run integration tests
111111
pass_env =
112112
PYTEST_ADDOPTS
113+
INTEGRATION_OPENSTACK_PASSWORD_AMD64
114+
INTEGRATION_TOKEN
115+
INTEGRATION_TOKEN_ALT
113116
deps =
114117
juju3.1: juju==3.1.*
115118
juju3.6: juju==3.6.*

0 commit comments

Comments
 (0)