summaryrefslogtreecommitdiffstats
path: root/tests/bugs/distribute/bug-1543279.t
blob: 67cc0f50c2fae97ef932a1a815e640bfffe6bfe8 (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
#!/bin/bash

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

TESTS_EXPECTED_IN_LOOP=44
SCRIPT_TIMEOUT=600

rename_files() {
    MOUNT=$1
    ITERATIONS=$2
    for i in $(seq 1 $ITERATIONS); do uuid="`uuidgen`"; echo "some data" > $MOUNT/test$uuid; mv $MOUNT/test$uuid $MOUNT/test -f || return $?; done
}

run_test_for_volume() {
    VOLUME=$1
    ITERATIONS=$2
    TEST_IN_LOOP $CLI volume start $VOLUME

    TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M0
    TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M1
    TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M2
    TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M3

    rename_files $M0 $ITERATIONS &
    M0_RENAME_PID=$!

    rename_files $M1 $ITERATIONS &
    M1_RENAME_PID=$!

    rename_files $M2 $ITERATIONS &
    M2_RENAME_PID=$!

    rename_files $M3 $ITERATIONS &
    M3_RENAME_PID=$!

    TEST_IN_LOOP wait $M0_RENAME_PID
    TEST_IN_LOOP wait $M1_RENAME_PID
    TEST_IN_LOOP wait $M2_RENAME_PID
    TEST_IN_LOOP wait $M3_RENAME_PID

    TEST_IN_LOOP $CLI volume stop $VOLUME
    TEST_IN_LOOP $CLI volume delete $VOLUME
    umount $M0 $M1 $M2 $M3
}

cleanup

TEST glusterd
TEST pidof glusterd

TEST $CLI volume create $V0 $H0:$B0/${V0}{0..8} force
run_test_for_volume $V0 200

TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/${V0}{0..8} force
run_test_for_volume $V0 200

TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0..8} force
run_test_for_volume $V0 200

TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} force
run_test_for_volume $V0 200

cleanup