Skip to content

Commit

Permalink
test evict with writeback
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoucheng361 committed Jan 9, 2025
1 parent 15c54a1 commit f9078d6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/scripts/cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ test_batch_warmup(){
grep "(0.0%)" warmup.log || (echo "warmup failed, expect 0.0% warmup" && exit 1)
}

test_evict_with_writeback(){
prepare_test
./juicefs format $META_URL myjfs --trash-days 0
./juicefs mount $META_URL /tmp/jfs -d --writeback --upload-delay 5s
dd if=/dev/urandom of=/tmp/test bs=1M count=$TEST_FILE_SIZE
cp /tmp/test /tmp/jfs/test
./juicefs warmup /tmp/jfs/test --evict
wait_stage_uploaded
compare_md5sum /tmp/test /tmp/jfs/test
}

test_disk_failover()
{
prepare_test
Expand Down Expand Up @@ -65,6 +76,22 @@ prepare_test()
rm -rf /var/jfsCache/myjfs || true
}

wait_stage_uploaded()
{
echo "wait stage upload"
for i in {1..30}; do
stageBlocks=$(grep "stageBlocks:" /tmp/jfs/.stats | awk '{print $2}')
if [ "$stageBlocks" -eq 0 ]; then
echo "stageBlocks is now 0"
break
fi
echo "wait stage upload $i" && sleep 1
done
if [ "$stageBlocks" -ne 0 ]; then
echo "stage blocks have not uploaded: $stageBlocks" && exit 1
fi
}

mount_jfsCache1(){
/etc/init.d/redis-server start
timeout 30s bash -c 'until nc -zv localhost 6379; do sleep 1; done'
Expand Down

0 comments on commit f9078d6

Please sign in to comment.