From 25fcedf6e77997a864147eb15157daa7050bfd87 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 21 Apr 2023 00:51:37 +0300 Subject: [PATCH] Enable vitastor-cli fix in test --- tests/common.sh | 2 +- tests/test_scrub.sh | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/common.sh b/tests/common.sh index 55feaeb2..5e559a05 100644 --- a/tests/common.sh +++ b/tests/common.sh @@ -7,7 +7,7 @@ fi format_error() { - echo $(echo -n -e "\033[1;31m")"$1"$(echo -n -e "\033[m") + echo $(echo -n -e "\033[1;31m")"$0 $1"$(echo -n -e "\033[m") $ETCDCTL get --prefix /vitastor > ./testdata/etcd-dump.txt exit 1 } diff --git a/tests/test_scrub.sh b/tests/test_scrub.sh index 451b3095..eb1ac7ea 100755 --- a/tests/test_scrub.sh +++ b/tests/test_scrub.sh @@ -44,21 +44,22 @@ if [[ ($SCHEME = replicated && $PG_SIZE < 3) || ($SCHEME != replicated && $((PG_ # Check that objects are marked as inconsistent if 2 replicas or EC/XOR 2+1 build/src/vitastor-cli describe --etcd_address $ETCD_URL --json | jq -e '[ .[] | select(.inconsistent) ] | length == '$((IMG_SIZE * 8 * PG_SIZE / (SCHEME = replicated ? 1 : PG_DATA_SIZE))) - # Fix objects - - # Read everything back + # Fix objects using vitastor-cli fix + build/src/vitastor-cli describe --etcd_address $ETCD_URL --json | \ + jq -s '[ .[0][] | select(.inconsistent and .osd_num == '$ZERO_OSD') ]' | \ + build/src/vitastor-cli fix --etcd_address $ETCD_URL --bad_osds $ZERO_OSD elif [[ ($SCHEME = replicated && $PG_SIZE > 2) || ($SCHEME != replicated && $((PG_SIZE-PG_DATA_SIZE)) > 1) ]]; then # Check that everything heals wait_finish_rebalance 60 build/src/vitastor-cli describe --etcd_address $ETCD_URL --json | jq -e '. | length == 0' - - # Read everything back - qemu-img convert -S 4096 -p \ - -f raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:image=testimg" \ - -O raw ./testdata/read.bin - - diff ./testdata/read.bin ./testdata/mirror.bin fi +# Read everything back +qemu-img convert -S 4096 -p \ + -f raw "vitastor:etcd_host=127.0.0.1\:$ETCD_PORT/v3:image=testimg" \ + -O raw ./testdata/read.bin + +diff ./testdata/read.bin ./testdata/mirror.bin + format_green OK