glusterfs
59 строк · 1.6 Кб
1#!/bin/bash
2
3. $(dirname $0)/../../include.rc4. $(dirname $0)/../../volume.rc5. $(dirname $0)/../../fileio.rc6
7cleanup;8
9TEST glusterd
10TEST pidof glusterd
11TEST $CLI volume info;12
13function volinfo_field()14{
15local vol=$1;16local field=$2;17
18$CLI volume info $vol | grep "^$field: " | sed 's/.*: //';19}
20
21TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2;22EXPECT 'Created' volinfo_field $V0 'Status';23
24TEST $CLI volume start $V0;25EXPECT 'Started' volinfo_field $V0 'Status';26
27MOUNTDIR=$M0;28TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR;29TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M1;30
31TEST touch $M0/testfile;32EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M033TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;34
35# open the file with the fd as 4
36TEST fd=`fd_available`;37TEST fd_open $fd 'w' "$M0/testfile";38
39# remove the file from the other mount point. If unlink is sent from
40# $M0 itself, then the file will be actually opened by open-behind which
41# we dont want for this testcase
42TEST rm -f $M1/testfile;43
44# below command opens the file and writes to the file.
45# upon open, open-behind unwinds the open call with success.
46# now when write comes, open-behind actually opens the file
47# and then sends write on the fd. But before sending open itself,
48# the file would have been removed from the mount $M1. open() gets error
49# and the write call which is put into a stub (open had to be sent first)
50# should unwind with the error received in the open call.
51TEST ! fd_write $fd data52
53TEST fd_close $fd;54
55TEST rm -rf $MOUNTDIR/*56
57EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $MOUNTDIR58
59cleanup;60