Skip to content

Commit 8594554

Browse files
shellcheck linter: use bash tests/basic/ec/gfapi-ec-open-truncate.sh
This commit changes the shell to #!/usr/bin/env bash. This series aim to reduce the shellcheck logs. Signed-off-by: Thales Antunes de Oliveira Barretto <[email protected]>
1 parent 4d427ac commit 8594554

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
3+
. "$(dirname "${0}")"/../../include.rc
4+
. "$(dirname "${0}")"/../../volume.rc
5+
6+
#This .t tests the functionality of open-fd-heal when opened with O_TRUNC.
7+
#If re-open is not done with O_TRUNC then the test will pass.
8+
9+
cleanup
10+
11+
TEST glusterd
12+
13+
TEST "${CLI}" volume create "${V0}" disperse 3 "${H0}":"${B0}"/brick{1,2,3}
14+
EXPECT 'Created' volinfo_field "${V0}" 'Status'
15+
#Disable heals to prevent any chance of heals masking the problem
16+
TEST "${CLI}" volume set "${V0}" disperse.background-heals 0
17+
TEST "${CLI}" volume set "${V0}" disperse.heal-wait-qlength 0
18+
TEST "${CLI}" volume set "${V0}" performance.write-behind off
19+
20+
#We need truncate fop to go through before pre-op completes for the write-fop
21+
#which triggers open-fd heal. Otherwise truncate won't be allowed on 'bad' brick
22+
TEST "${CLI}" volume set "${V0}" delay-gen posix
23+
TEST "${CLI}" volume set "${V0}" delay-gen.enable fxattrop
24+
TEST "${CLI}" volume set "${V0}" delay-gen.delay-percentage 100
25+
TEST "${CLI}" volume set "${V0}" delay-gen.delay-duration 1000000
26+
27+
TEST "${CLI}" volume heal "${V0}" disable
28+
29+
TEST "${CLI}" volume start "${V0}"
30+
TEST "${CLI}" volume profile "${V0}" start
31+
EXPECT 'Started' volinfo_field "${V0}" 'Status'
32+
TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s "${H0}" --volfile-id "${V0}" "${M0}"
33+
EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count "${V0}" 0
34+
TEST touch "${M0}"/a
35+
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount "${M0}"
36+
37+
TEST kill_brick "${V0}" "${H0}" "${B0}"/brick1
38+
logdir=$(gluster --print-logdir)
39+
40+
TEST build_tester "$(dirname "${0}")"/gfapi-ec-open-truncate.c -lgfapi
41+
42+
TEST "${CLI}" volume profile "${V0}" info clear
43+
TEST ./"$(dirname "${0}")"/gfapi-ec-open-truncate "${H0}" "${V0}" "${logdir}"/gfapi-ec-open-truncate.log
44+
45+
EXPECT "^2$" echo "$("${CLI}" volume profile "${V0}" info incremental | grep -i truncate | wc -l)"
46+
cleanup_tester "$(dirname "${0}")"/gfapi-ec-open-truncate
47+
48+
cleanup

0 commit comments

Comments
 (0)