Skip to content

Commit 79a0480

Browse files
authored
CI: add fsck tests (#5810)
1 parent cdc0619 commit 79a0480

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.github/scripts/command/fsck.sh

+36
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,42 @@ test_sync_dir_stat()
4242
./juicefs info -r /jfs/d | tee info1.log
4343
./juicefs info -r /jfs/d --strict | tee info2.log
4444
diff info1.log info2.log
45+
rm info*.log
46+
./juicefs fsck $META_URL --path / --sync-dir-stat --repair -r
47+
./juicefs info -r /jfs | tee info1.log
48+
./juicefs info -r /jfs --strict | tee info2.log
49+
diff info1.log info2.log
50+
}
51+
52+
test_fsck_with_random_test()
53+
{
54+
prepare_test
55+
./juicefs format $META_URL myjfs
56+
./juicefs mount -d $META_URL /jfs
57+
./random-test runOp -baseDir /jfs/test -files 500000 -ops 5000000 -threads 50 -dirSize 10 -duration 30s -createOp 30,uniform -deleteOp 5,end --linkOp 10,uniform --removeLinkOp 1,end --symlinkOp 20,uniform --setXattrOp 10,uniform --truncateOp 10,uniform
58+
./juicefs fsck $META_URL --path /test --sync-dir-stat --repair -r
59+
./juicefs info -r /jfs | tee info1.log
60+
./juicefs info -r /jfs --strict | tee info2.log
61+
diff info1.log info2.log
62+
}
63+
64+
test_fsck_delete_object()
65+
{
66+
prepare_test
67+
./juicefs format $META_URL myjfs
68+
./juicefs mount -d $META_URL /jfs
69+
echo "test" > /jfs/test.txt
70+
sleep 1
71+
object=$(./juicefs info /jfs/test.txt | grep chunks | awk '{print $4}')
72+
rm /var/jfs/$object
73+
./juicefs fsck $META_URL 2>&1 | tee fsck.log
74+
grep -q "1 objects are lost" fsck.log || exit 1
75+
rm fsck.log
76+
# ./juicefs fsck $META_URL --path / --sync-dir-stat --repair -r 2>&1 | tee fsck.log
77+
# grep -q "1 objects are lost" fsck.log || exit 1
78+
# rm fsck.log
79+
./juicefs rmr /jfs/test.txt --skip-trash
80+
./juicefs fsck $META_URL || { echo "files is deleted, fsck should success"; exit 1; }
4581
}
4682

4783
source .github/scripts/common/run_test.sh && run_test $@

.github/workflows/command.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ jobs:
7676
timeout-minutes: 10
7777
uses: ./.github/actions/build
7878

79+
- name: Download Random Test
80+
run: |
81+
wget https://juicefs-com-static.oss-cn-shanghai.aliyuncs.com/random-test/random-test
82+
chmod +x random-test
83+
7984
- name: Test Gc
8085
timeout-minutes: 10
8186
run: |
@@ -99,7 +104,8 @@ jobs:
99104
- name: Test fsck
100105
timeout-minutes: 10
101106
run: |
102-
sudo META=${{matrix.meta}} .github/scripts/command/fsck.sh
107+
meta=$([ "${{matrix.meta}}" = "mysql" ] && echo "sqlite3" || echo "${{matrix.meta}}")
108+
sudo META=${meta} .github/scripts/command/fsck.sh
103109
104110
- name: Test Gateway
105111
timeout-minutes: 10

0 commit comments

Comments
 (0)