Skip to content

Backports for v1.0.5 #985

Backports for v1.0.5

Backports for v1.0.5 #985

Workflow file for this run

name: "sync-test"
on:
push:
branches:
- 'release-**'
paths-ignore:
- 'docs/**'
pull_request:
#The branches below must be a subset of the branches above
branches:
- 'release-**'
paths-ignore:
- 'docs/**'
workflow_dispatch:
jobs:
compare-with-rsync:
runs-on: ubuntu-latest
services:
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Build linux target
run: make juicefs
- name: Checkout source code for test
uses: actions/checkout@v2
with:
repository: juicedata/juicefs
path: jfs_source
- name: Test Sync
run: |
meta_url=redis://127.0.0.1/1
mount_point=/tmp/sync-test/
./juicefs format --trash-days 0 $meta_url sync-test
./juicefs mount --no-usage-report $meta_url $mount_point -d
./juicefs sync jfs_source/ $mount_point
for source_dir in "$mount_point" "jfs_source/" ; do
while IFS=, read -r jfs_option rsync_option status; do
printf '\n%s, %s, %s\n' "$jfs_option" "$rsync_option" "$status"
status=$(echo $status| xargs)
if [[ -z "$status" || "$status" = "disable" ]]; then
continue
fi
if [ "$source_dir" = "$mount_point" ]; then
jfs_option="--exclude .stats --exclude .config $jfs_option "
rsync_option="--exclude .stats --exclude .config $rsync_option "
fi
test -d rsync_dir/ && rm rsync_dir/ -rf
mkdir rsync_dir
set -o noglob
rsync -a $source_dir rsync_dir/ $rsync_option
test -d jfs_sync_dir/ && rm jfs_sync_dir/ -rf
mkdir jfs_sync_dir/
./juicefs sync $source_dir jfs_sync_dir/ $jfs_option
set -u noglob
printf ’juicefs sync %s %s %s\n‘ "$source_dir" "jfs_sync_dir/" "$jfs_option"
printf ’rsync %s %s %s\n‘ "$source_dir" "rsync_dir/" "$rsync_option"
printf ‘diff between juicefs sync and rsync:\n’
diff -ur jfs_sync_dir rsync_dir
done < .github/workflows/resources/sync-options.txt
done
- name: Log
if: ${{ always() }}
run: |
echo "juicefs log"
sudo tail -n 1000 ~/.juicefs/juicefs.log
grep "<FATAL>:" ~/.juicefs/juicefs.log && exit 1 || true
- name: Send Slack Notification
if: ${{ failure() }}
uses: juicedata/slack-notify-action@main
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}"
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}"
- name: Setup upterm session
if: ${{ failure() }}
uses: lhotari/action-upterm@v1
file-head-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18.x'
- name: Build linux target
run: |
make juicefs
# wget -q https://github.com/juicedata/juicefs/releases/download/v1.0.0-beta3/juicefs-1.0.0-beta3-linux-amd64.tar.gz
# tar -zxf juicefs-1.0.0-beta3-linux-amd64.tar.gz
- name: Checkout source code for test
uses: actions/checkout@v2
with:
repository: juicedata/juicefs
path: jfs_source
- name: Test
run: |
# issue link: https://github.com/juicedata/juicefs/issues/2125
meta_url=sqlite3://test.db
mount_point=/tmp/sync-test/
./juicefs format --trash-days 0 $meta_url sync-test
./juicefs mount --no-usage-report $meta_url $mount_point -d
mkdir $mount_point/jfs_source/
./juicefs sync jfs_source/ $mount_point/jfs_source/ -u=true --perms=true --check-all=true --bwlimit=81920 --dirs=true --threads=30 --debug
echo "test" > jfs_source/test_file
mkdir jfs_source/test_dir
./juicefs sync jfs_source/ $mount_point/jfs_source/ -u=true --perms=true --check-all=true --bwlimit=81920 --dirs=true --threads=30 --debug
diff -ur jfs_source/ $mount_point/jfs_source
- name: Log
if: ${{ always() }}
run: |
echo "juicefs log"
sudo tail -n 1000 ~/.juicefs/juicefs.log
grep "<FATAL>:" ~/.juicefs/juicefs.log && exit 1 || true
- name: Send Slack Notification
if: ${{ failure() }}
uses: juicedata/slack-notify-action@main
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}"
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}"
- name: Setup upterm session
if: ${{ failure() }}
uses: lhotari/action-upterm@v1