From d975305ab1c764582bf63bc6f526a2739e2b34eb Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 14 Aug 2018 11:49:50 +0530 Subject: tests: Add thin-arbiter.rc for writing tests for thin-arbiter fixes bz#1615789 Change-Id: I1f42e78fec5ddaf2a425dc4b82c9a20472aa146d Signed-off-by: Pranith Kumar K --- tests/basic/afr/ta.t | 44 ++++++ tests/thin-arbiter.rc | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 472 insertions(+) create mode 100644 tests/basic/afr/ta.t create mode 100644 tests/thin-arbiter.rc (limited to 'tests') diff --git a/tests/basic/afr/ta.t b/tests/basic/afr/ta.t new file mode 100644 index 00000000000..20c29784eaf --- /dev/null +++ b/tests/basic/afr/ta.t @@ -0,0 +1,44 @@ +#!/bin/bash +#Self-heal tests + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../thin-arbiter.rc +cleanup; +TEST ta_create_brick_and_volfile brick0 +TEST ta_create_brick_and_volfile brick1 +TEST ta_create_ta_and_volfile ta +TEST ta_start_brick_process brick0 +TEST ta_start_brick_process brick1 +TEST ta_start_ta_process ta + +TEST ta_create_mount_volfile brick0 brick1 ta +TEST ta_start_mount_process $M0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" ta_up_status $V0 $M0 0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "trusted.afr.patchy-ta-2" ls $B0/ta + +TEST touch $M0/a.txt +TEST ls $B0/brick0/a.txt +TEST ls $B0/brick1/a.txt +TEST ! ls $B0/ta/a.txt + +TEST ta_kill_brick brick0 +EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "0" afr_child_up_status_meta $M0 $V0-replicate-0 0 +TEST touch $M0/b.txt +EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.$V0-client-0 $B0/brick1 +EXPECT "000000010000000200000000" get_hex_xattr trusted.afr.$V0-client-0 $B0/brick1/b.txt +#TODO: New entry mark lead to pending data on the file but no such marking happened on ta +#EXPECT "000000010000000100000001" get_hex_xattr trusted.afr.$V0-client-0 $B0/ta/trusted.afr.patchy-ta-2 +TEST ! ls $B0/brick0/b.txt +TEST ls $B0/brick1/b.txt + +#This is not working as expected +#TEST ta_kill_brick ta +#TEST touch $M0/c.txt +#TEST ! ls $B0/brick0/c.txt +#TEST ! ls $B0/brick1/c.txt + +TEST ta_start_brick_process brick0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_meta $M0 $V0-replicate-0 0 + +cleanup; diff --git a/tests/thin-arbiter.rc b/tests/thin-arbiter.rc new file mode 100644 index 00000000000..8bb888a7471 --- /dev/null +++ b/tests/thin-arbiter.rc @@ -0,0 +1,428 @@ +declare -A PORTMAP +PORTCURR=49152 +function ta_create_ta_and_volfile() +{ + local b=$B0/$1 + mkdir -p $b/.glusterfs/indices +cat > $B0/ta.vol < $B0/${1}.vol < $B0/mount.vol < $B0/${1}.pid + kill -9 $p +} + +function ta_up_status() +{ + local v=$1 + local m=$2 + local replica_id=$3 + grep -E "^up = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'=' +} -- cgit