Skip to content

Commit

Permalink
condition to skip test_degraded_volume
Browse files Browse the repository at this point in the history
  • Loading branch information
albinsun committed Aug 28, 2024
1 parent ca2f130 commit ca74ce2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions harvester_e2e_tests/integrations/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@ class ClusterState:

state = ClusterState()

# target version
if request.config.getoption('--upgrade-target-version'):
state.version_verify = True
state.version = request.config.getoption('--upgrade-target-version')
else:
state.version_verify = False
state.version = f"version-{unique_name}"

# cluster size
code, data = api_client.hosts.get()
assert 200 == code, (code, data)
state.size = len(data['data'])

return state


Expand Down Expand Up @@ -205,7 +211,7 @@ def vm_network(api_client, unique_name, wait_timeout, cluster_network, vlan_id,
sleep(3)
else:
raise AssertionError(
f"Failed to remote VM network {unique_name} after {wait_timeout}s\n"
f"Failed to remove VM network {unique_name} after {wait_timeout}s\n"
f"API Status({code}): {data}"
)

Expand Down Expand Up @@ -482,9 +488,8 @@ def test_version_compatibility(
api_client.upgrades.delete(data['metadata']['name'])
api_client.versions.delete(version)

def test_degraded_volume(
self, api_client, wait_timeout, vm_shell_from_host, vm_checker, upgrade_target, stopped_vm
):
def test_degraded_volume(self, api_client, cluster_state, wait_timeout, vm_shell_from_host,
vm_checker, upgrade_target, stopped_vm):
"""
Criteria: create upgrade should fails if there are any degraded volumes
Steps:
Expand All @@ -494,6 +499,9 @@ def test_degraded_volume(
3. Immediately upgrade Harvester.
4. Upgrade should fail.
"""
if cluster_state.size < 3:
pytest.skip(f"Degraded only checked when nodes >= 3, skip for {cluster_state.size}.")

vm_name, ssh_user, pri_key = stopped_vm
vm_started, (code, vmi) = vm_checker.wait_started(vm_name)
assert vm_started, (code, vmi)
Expand Down

0 comments on commit ca74ce2

Please sign in to comment.