summaryrefslogtreecommitdiffstats
path: root/tests/basic/quick-read-with-upcall.t
blob: dfb751dfcdb7da20d3575179d1c36ba196ba092a (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
#!/bin/bash

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

cleanup;

#Basic checks
TEST glusterd
TEST pidof glusterd
TEST $CLI volume info

#Create a distributed volume
TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2};
TEST $CLI volume start $V0

# Mount FUSE without selinux:
TEST glusterfs -s $H0 --volfile-id $V0 --direct-io-mode=enable $M0;
TEST glusterfs -s $H0 --volfile-id $V0 --direct-io-mode=enable $M1;

D0="test-message0";
D1="test-message1";

function write_to()
{
    local file="$1";
    local data="$2";
    echo "$data" > "$file";
}


TEST write_to "$M0/test.txt" "$D0"
EXPECT "$D0" cat $M0/test.txt
EXPECT "$D0" cat $M1/test.txt

TEST write_to "$M0/test.txt" "$D1"
EXPECT "$D1" cat $M0/test.txt
EXPECT "$D0" cat $M1/test.txt

sleep 1

# TODO: This line normally fails
EXPECT "$D1" cat $M1/test.txt

TEST $CLI volume set $V0 features.cache-invalidation on
TEST $CLI volume set $V0 performance.quick-read-cache-timeout 15
TEST $CLI volume set $V0 performance.md-cache-timeout 15

TEST write_to "$M0/test1.txt" "$D0"
EXPECT "$D0" cat $M0/test1.txt
EXPECT "$D0" cat $M1/test1.txt

TEST write_to "$M0/test1.txt" "$D1"
EXPECT "$D1" cat $M0/test1.txt
EXPECT "$D0" cat $M1/test1.txt

sleep 1
EXPECT "$D0" cat $M1/test1.txt

sleep 30
EXPECT "$D1" cat $M1/test1.txt

TEST $CLI volume set $V0 performance.quick-read-cache-invalidation on
TEST $CLI volume set $V0 performance.cache-invalidation on

TEST write_to "$M0/test2.txt" "$D0"
EXPECT "$D0" cat $M0/test2.txt
EXPECT "$D0" cat $M1/test2.txt

TEST write_to "$M0/test2.txt" "$D1"
EXPECT "$D1" cat $M0/test2.txt
EXPECT "$D1" cat $M1/test2.txt