summaryrefslogtreecommitdiffstats
path: root/tests/bugs/distribute/bug-1190734.t
blob: 9256088f7a019d30d025db1cdad9390e4fea9c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash

. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc
. $(dirname $0)/../../nfs.rc

#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST

BRICK_COUNT=3
FILE_COUNT=100
FILE_COUNT_TIME=5

function create_files {
    rm -rf $2
    mkdir $2
    for i in `seq 1 $1`; do
        touch $2/file_$i
    done
}

function get_file_count {
    ls $1/file_[0-9]* | wc -l
}

function reset {
    $CLI volume stop $V0
    ${UMOUNT_F} $1
    $CLI volume delete $V0
}

function start_mount_fuse {
    $CLI volume start $V0
    [ $? -ne 0 ] && return 1

    $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
    [ $? -ne 0 ] && return 1

    create_files $FILE_COUNT $M0/$1
    [ $? -ne 0 ] && return 1

    return 0
}

function start_mount_nfs {
    $CLI volume start $V0
    [ $? -ne 0 ] && return 1

    sleep 3
    mount_nfs $H0:/$V0 $N0
    [ $? -ne 0 ] && return 1

    create_files $FILE_COUNT $N0/$1
    [ $? -ne 0 ] && return 1

    return 0
}

cleanup

TEST glusterd
TEST pidof glusterd

# Test 1-2 Create repliacted volume

TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 \
    $H0:$B0/${V0}2 $H0:$B0/${V0}3 $H0:$B0/${V0}4 $H0:$B0/${V0}5
TEST $CLI volume set $V0 nfs.disable false

# ------- test 1: AFR, fuse + remove bricks

TEST start_mount_fuse test1
EXPECT_WITHIN $FILE_COUNT_TIME $FILE_COUNT get_file_count $M0/test1
TEST $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}{2,3} start
EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0" "$H0:$B0/${V0}2  $H0:$B0/${V0}3"
TEST $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}{2,3} commit
EXPECT_WITHIN $FILE_COUNT_TIME $FILE_COUNT get_file_count $M0/test1
reset $M0

# ------- test 2: AFR, nfs + remove bricks

TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 \
    $H0:$B0/${V0}2 $H0:$B0/${V0}3 $H0:$B0/${V0}4 $H0:$B0/${V0}5
TEST $CLI volume set $V0 nfs.disable false

TEST start_mount_nfs test2
EXPECT_WITHIN $FILE_COUNT_TIME $FILE_COUNT get_file_count $N0/test2
TEST $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}2  $H0:$B0/${V0}3 start
EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0" "$H0:$B0/${V0}2  $H0:$B0/${V0}3"
TEST $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}{2,3} commit
EXPECT_WITHIN $FILE_COUNT_TIME $FILE_COUNT get_file_count $N0/test2
reset $N0

cleanup