Skip to content

Commit

Permalink
Merge branch 'master' into snapshot-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchiu authored Mar 1, 2024
2 parents 7b77cb9 + 76f9406 commit 20c7bb7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion e2e/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions manager/integration/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
24 changes: 21 additions & 3 deletions manager/integration/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions manager/integration/tests/test_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions test_framework/scripts/longhorn-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}


Expand Down

0 comments on commit 20c7bb7

Please sign in to comment.