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

Fix non-exited while loop in teardown #1889

Merged
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
9 changes: 7 additions & 2 deletions apiclient/harvester_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ def get_pods(self, name="", namespace=DEFAULT_NAMESPACE):
resp = self._get(path)
return resp.status_code, resp.json()

def get_apps_catalog(self, name="", namespace=DEFAULT_NAMESPACE):
path = f"v1/catalog.cattle.io.apps/{namespace}/{name}"
def get_apps_deployments(self, name="", namespace=DEFAULT_NAMESPACE):
path = f"v1/apps.deployments/{namespace}/{name}"
resp = self._get(path)
return resp.status_code, resp.json()

def get_apps_controllerrevisions(self, namespace=""):
path = f"v1/apps.controllerrevisions/{namespace}"
resp = self._get(path)
return resp.status_code, resp.json()

Expand Down
33 changes: 19 additions & 14 deletions harvester_e2e_tests/integrations/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,13 @@ def cluster_network(vlan_nic, api_client, unique_name, network_checker, wait_tim

# Teardown
endtime = datetime.now() + timedelta(seconds=wait_timeout)
while endtime > datetime.now() and created:
while endtime > datetime.now():
name = created.pop(0)
code, data = api_client.clusternetworks.delete_config(name)
if code != 404:
created.append(name)
if not created:
break
sleep(1)
else:
raise AssertionError(
Expand Down Expand Up @@ -1077,23 +1079,26 @@ def test_verify_deployed_components_version(self, api_client):
engine_image_version_existed = False
longhorn_manager_version_existed = False

# Get except version from apps.catalog.cattle.io/harvester
code, apps = api_client.get_apps_catalog(name="harvester",
namespace=DEFAULT_HARVESTER_NAMESPACE)
assert code == 200 and apps['type'] != "error", (
f"Failed to get apps.catalog.cattle.io/harvester: {apps['message']}")
# Get expected image of kubevirt
code, app = api_client.get_apps_deployments(name="virt-operator",
namespace=DEFAULT_HARVESTER_NAMESPACE)
assert code == 200, (code, app)
kubevirt_operator_image = app['spec']['template']['spec']['containers'][0]['image']

# Get except image of kubevirt and longhorn
kubevirt_operator = (
apps['spec']['chart']['values']['kubevirt-operator']['containers']['operator'])
kubevirt_operator_image = (
f"{kubevirt_operator['image']['repository']}:{kubevirt_operator['image']['tag']}")
# Get except image of longhorn
code, apps = api_client.get_apps_controllerrevisions(namespace=DEFAULT_LONGHORN_NAMESPACE)
assert code == 200, (code, apps)

longhorn = apps['spec']['chart']['values']['longhorn']['image']['longhorn']
longhorn_images = {
"engine-image": f"{longhorn['engine']['repository']}:{longhorn['engine']['tag']}",
"longhorn-manager": f"{longhorn['manager']['repository']}:{longhorn['manager']['tag']}"
"engine-image": "",
"longhorn-manager": ""
}
for lh_app in longhorn_images:
for app in apps['data']:
if app["id"].startswith(f"{DEFAULT_LONGHORN_NAMESPACE}/{lh_app}"):
longhorn_images[lh_app] = (
app["data"]["spec"]["template"]["spec"]["containers"][0]["image"])
break

# Verify kubevirt version
code, pods = api_client.get_pods(namespace=DEFAULT_HARVESTER_NAMESPACE)
Expand Down