Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] add metadata expose to test report #1109

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all 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
20 changes: 19 additions & 1 deletion harvester_e2e_tests/fixtures/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,22 @@


@pytest.fixture(scope="session")
def api_client(request):
def harvester_metadata(pytestconfig):
''' be used to store harvester's metadata and expose into html report. '''
# ref: https://github.com/pytest-dev/pytest-html/blob/4.1.1/src/pytest_html/basereport.py#L71
try:
from pytest_metadata.plugin import metadata_key
metadata = pytestconfig.stash[metadata_key]
except ImportError:
metadata = pytestconfig._metadata

harv = dict()
metadata["Harvester"] = harv
return harv


@pytest.fixture(scope="session")
def api_client(request, harvester_metadata):
endpoint = request.config.getoption("--endpoint")
username = request.config.getoption("--username")
password = request.config.getoption("--password")
Expand All @@ -29,6 +44,9 @@ def api_client(request):

api.session.verify = ssl_verify

harvester_metadata['Cluster Endpoint'] = endpoint
harvester_metadata['Cluster Version'] = api.cluster_version.raw

return api


Expand Down
Loading