summaryrefslogtreecommitdiffstats
path: root/tests/basic/ctime/ctime-heal-symlinks.t
blob: 3922b12546d80cfa37f003e68f93c4750f2ceb38 (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
#!/bin/bash
. $(dirname $0)/../../include.rc
. $(dirname $0)/../../volume.rc
. $(dirname $0)/../../afr.rc
cleanup;

###############################################################################
TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
TEST $CLI volume set $V0 performance.stat-prefetch off
TEST $CLI volume set $V0 ctime on
TEST $CLI volume set $V0 utime on
TEST $CLI volume start $V0

TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;

cd $M0
TEST "echo hello_world > FILE"
TEST ln -s FILE SOFTLINK

# Remove symlink only (not the .glusterfs entry) and trigger named heal.
TEST rm -f $B0/${V0}2/SOFTLINK
TEST stat SOFTLINK

# To heal and clear new-entry mark on source bricks.
TEST $CLI volume heal $V0
EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0

EXPECT 2 stat -c %h  $B0/${V0}2/SOFTLINK
EXPECT "hello_world" cat $B0/${V0}2/SOFTLINK

cd -
cleanup
###############################################################################

TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 disperse 3 redundancy 1  $H0:$B0/${V0}{0,1,2}
TEST $CLI volume set $V0 performance.stat-prefetch off
TEST $CLI volume set $V0 ctime on
TEST $CLI volume set $V0 utime on
TEST $CLI volume start $V0

TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;

cd $M0
TEST "echo hello_world > FILE"
TEST ln -s FILE SOFTLINK

# Remove symlink only (not the .glusterfs entry) and trigger named heal.
TEST rm -f $B0/${V0}2/SOFTLINK
TEST stat SOFTLINK

# To heal and clear new-entry mark on source bricks.
TEST $CLI volume heal $V0
EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0

EXPECT 2 stat -c %h  $B0/${V0}2/SOFTLINK
TEST kill_brick $V0 $H0 $B0/${V0}0
cd -
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
cd $M0
EXPECT "hello_world" cat SOFTLINK

cd -
cleanup
###############################################################################