Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@
BASIC_LOGGER = logging.getLogger(name="basic")


@pytest.hookimpl(tryfirst=True)
def pytest_configure(config: Config) -> None:
"""Migrate PYTEST_JIRA_TOKEN to PYTEST_JIRA_PASSWORD for Basic Auth compatibility.

The pytest-jira plugin uses PYTEST_JIRA_TOKEN for Bearer auth, which fails on
Atlassian Cloud. Migrating to PYTEST_JIRA_PASSWORD ensures both the plugin and
utilities/jira.py use Basic Auth instead.
"""
jira_token = os.environ.get("PYTEST_JIRA_TOKEN")
if jira_token and not os.environ.get("PYTEST_JIRA_PASSWORD"):
os.environ["PYTEST_JIRA_PASSWORD"] = jira_token
del os.environ["PYTEST_JIRA_TOKEN"]


def pytest_addoption(parser: Parser) -> None:
aws_group = parser.getgroup(name="AWS")
buckets_group = parser.getgroup(name="Buckets")
Expand Down
2 changes: 1 addition & 1 deletion docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ To run tests with admin client only, pass `--tc=use_unprivileged_client:False` t
### jira integration

To skip running tests which have open bugs, [pytest_jira](https://github.com/rhevm-qe-automation/pytest_jira) plugin is used.
To run tests with jira integration, you need to set `PYTEST_JIRA_URL` and `PYTEST_JIRA_TOKEN` environment variables.
To run tests with jira integration, you need to set `PYTEST_JIRA_URL`, `PYTEST_JIRA_USERNAME` and `PYTEST_JIRA_TOKEN` environment variables.
To make a test with jira marker, add: `@pytest.mark.jira(jira_id="RHOAIENG-0000", run=False)` to the test.

### Running containerized tests
Expand Down
2 changes: 1 addition & 1 deletion utilities/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_jira_connection() -> JIRA:
"""
return JIRA(
server=os.getenv("PYTEST_JIRA_URL"),
basic_auth=(os.getenv("PYTEST_JIRA_USERNAME"), os.getenv("PYTEST_JIRA_TOKEN")),
basic_auth=(os.getenv("PYTEST_JIRA_USERNAME"), os.getenv("PYTEST_JIRA_PASSWORD")),
)


Expand Down