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

Test Information #1529

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions apiclient/rancher_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def cluster_version(self):
ver = data['value']
# XXX: fix master-xxx-head to 8.8.8, need the API fix the problem
self._version = parse_version('8.8.8' if 'master' in ver else ver)

self._version.raw = ver
return self._version

def __repr__(self):
Expand Down
23 changes: 16 additions & 7 deletions harvester_e2e_tests/fixtures/rancher_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


@pytest.fixture(scope="session")
def rancher_api_client(request):
def rancher_api_client(request, harvester_metadata):
endpoint = request.config.getoption("--rancher-endpoint")
password = request.config.getoption("--rancher-admin-password")
ssl_verify = request.config.getoption("--ssl_verify", False)
Expand All @@ -17,6 +17,9 @@ def rancher_api_client(request):

api.session.verify = ssl_verify

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

return api


Expand All @@ -42,34 +45,40 @@ def _pickup_k8s_version(versions, target_version):


@pytest.fixture(scope='session')
def rke1_version(request, rancher_api_client):
def rke1_version(request, rancher_api_client, harvester_metadata):
target_ver = request.config.getoption("--k8s-version")

code, data = rancher_api_client.settings.get("k8s-versions-current")
assert 200 == code, (code, data)
supported_vers = data["value"].split(",")

return _pickup_k8s_version(supported_vers, target_ver)
ver = _pickup_k8s_version(supported_vers, target_ver)
harvester_metadata['RKE1 Version'] = ver
return ver


@pytest.fixture(scope="session")
def rke2_version(request, api_client, rancher_api_client):
def rke2_version(request, rancher_api_client, harvester_metadata):
target_ver = request.config.getoption("--k8s-version")

# Ref. https://github.com/rancher/dashboard/blob/master/shell/edit/provisioning.cattle.io.cluster/rke2.vue # noqa
resp = rancher_api_client._get("v1-rke2-release/releases")
assert resp.ok
supported_vers = [r['id'] for r in resp.json()['data']]

return _pickup_k8s_version(supported_vers, target_ver)
ver = _pickup_k8s_version(supported_vers, target_ver)
harvester_metadata['RKE2 Version'] = ver
return ver


@pytest.fixture(scope="session")
def k3s_version(request, api_client, rancher_api_client):
def k3s_version(request, rancher_api_client, harvester_metadata):
target_ver = request.config.getoption("--k8s-version")

resp = rancher_api_client._get("v1-k3s-release/releases")
assert resp.ok
supported_vers = [r['id'] for r in resp.json()['data']]

return _pickup_k8s_version(supported_vers, target_ver)
ver = _pickup_k8s_version(supported_vers, target_ver)
harvester_metadata['K3S Version'] = ver
return ver