diff --git a/e2e/requirements.txt b/e2e/requirements.txt index 2963efe495..dc39de7348 100644 --- a/e2e/requirements.txt +++ b/e2e/requirements.txt @@ -4,5 +4,5 @@ directio==1.3 flake8 kubernetes==27.2.0 requests==2.31.0 -boto3==1.34.49 +boto3==1.34.51 pyyaml==6.0.1 diff --git a/manager/integration/tests/test_basic.py b/manager/integration/tests/test_basic.py index 619e5ee420..d6acfd7faa 100644 --- a/manager/integration/tests/test_basic.py +++ b/manager/integration/tests/test_basic.py @@ -101,6 +101,7 @@ from common import create_and_wait_deployment from common import get_custom_object_api_client from common import RETRY_COUNTS_SHORT +from common import scale_up_engine_image_daemonset from backupstore import backupstore_delete_volume_cfg_file from backupstore import backupstore_cleanup @@ -4426,10 +4427,7 @@ def test_backuptarget_available_during_engine_image_not_ready(client, apps_api): common.wait_for_backup_target_available(client, False) # Scale up the engine image DaemonSet - body = [{"op": "remove", - "path": "/spec/template/spec/nodeSelector/foo"}] - apps_api.patch_namespaced_daemon_set( - name=ds_name, namespace='longhorn-system', body=body) + scale_up_engine_image_daemonset(client) common.wait_for_backup_target_available(client, True) # Sleep 1 second to prevent the same time diff --git a/manager/integration/tests/test_metric.py b/manager/integration/tests/test_metric.py index 5223c70abe..217fc24486 100644 --- a/manager/integration/tests/test_metric.py +++ b/manager/integration/tests/test_metric.py @@ -8,6 +8,7 @@ from common import client, core_api, volume_name # NOQA from common import delete_replica_processes +from common import check_volume_data from common import create_pv_for_volume from common import create_pvc_for_volume from common import create_snapshot @@ -194,6 +195,21 @@ def filter_metric_by_labels(metrics, labels): assert total_metrics["value"] >= 0.0 +def wait_for_metric_volume_actual_size(core_api, metric_name, metric_labels, actual_size): # NOQA + for _ in range(RETRY_COUNTS): + time.sleep(RETRY_INTERVAL) + + try: + check_metric(core_api, metric_name, + metric_labels, actual_size) + return + except AssertionError: + continue + + check_metric(core_api, metric_name, + metric_labels, actual_size) + + def wait_for_metric_count_all_nodes(client, core_api, metric_name, metric_labels, expected_count): # NOQA for _ in range(RETRY_COUNTS): time.sleep(RETRY_INTERVAL) @@ -271,7 +287,8 @@ def test_volume_metrics(client, core_api, volume_name, pvc_namespace): # NOQA volume = client.by_id_volume(volume_name) volume.attach(hostId=lht_hostId) volume = wait_for_volume_healthy(client, volume_name) - write_volume_random_data(volume) + data = write_volume_random_data(volume) + check_volume_data(volume, data) volume = client.by_id_volume(volume_name) actual_size = float(volume.controllers[0].actualSize) capacity_size = float(volume.size) @@ -284,8 +301,9 @@ def test_volume_metrics(client, core_api, volume_name, pvc_namespace): # NOQA } # check volume metric basic - check_metric(core_api, "longhorn_volume_actual_size_bytes", - metric_labels, actual_size) + wait_for_metric_volume_actual_size(core_api, + "longhorn_volume_actual_size_bytes", + metric_labels, actual_size) check_metric(core_api, "longhorn_volume_capacity_bytes", metric_labels, capacity_size) check_metric(core_api, "longhorn_volume_read_throughput", diff --git a/manager/integration/tests/test_scheduling.py b/manager/integration/tests/test_scheduling.py index e6ffacd7c5..c95ce6101e 100644 --- a/manager/integration/tests/test_scheduling.py +++ b/manager/integration/tests/test_scheduling.py @@ -463,6 +463,7 @@ def test_replica_rebuild_per_volume_limit(client, core_api, storage_class, sts_n vol = common.wait_for_volume_replicas_mode(client, vol_name, 'RW', replica_count=r_count) + wait_for_volume_healthy(client, vol_name) # Delete 4 volume replicas del vol.replicas[0] diff --git a/test_framework/scripts/longhorn-setup.sh b/test_framework/scripts/longhorn-setup.sh index 8f7e3aa873..db4519ad27 100755 --- a/test_framework/scripts/longhorn-setup.sh +++ b/test_framework/scripts/longhorn-setup.sh @@ -341,6 +341,9 @@ run_longhorn_upgrade_test(){ # get upgrade test junit xml report kubectl cp ${LONGHORN_UPGRADE_TEST_POD_NAME}:${LONGHORN_JUNIT_REPORT_PATH} "${TF_VAR_tf_workspace}/${LONGHORN_UPGRADE_TEST_POD_NAME}-junit-report.xml" -c longhorn-test-report + + # delete upgrade test pod + kubectl delete -f ${LONGHORN_UPGRADE_TESTS_MANIFEST_FILE_PATH} }