diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index ed26a905..23ff19b4 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -1944,3 +1944,21 @@ jobs: echo "" done + test_nfs_unaligned_append: + runs-on: ubuntu-latest + needs: build + container: ${{env.TEST_IMAGE}}:${{github.sha}} + steps: + - name: Run test + id: test + timeout-minutes: 3 + run: /root/vitastor/tests/test_nfs_unaligned_append.sh + - name: Print logs + if: always() && steps.test.outcome == 'failure' + run: | + for i in /root/vitastor/testdata/*.log /root/vitastor/testdata/*.txt; do + echo "-------- $i --------" + cat $i + echo "" + done + diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 26056604..47b7f6df 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -147,3 +147,4 @@ TEST_NAME=old_csum_4k_dj OLD=1 OSD_ARGS="--data_csum_type crc32c --inmemory_jo TEST_NAME=old_csum_4k OLD=1 OSD_ARGS="--data_csum_type crc32c" OFFSET_ARGS=$OSD_ARGS ./test_heal.sh ./test_nfs.sh +./test_nfs_unaligned_append.sh diff --git a/tests/test_nfs_unaligned_append.sh b/tests/test_nfs_unaligned_append.sh new file mode 100755 index 00000000..e7be4be7 --- /dev/null +++ b/tests/test_nfs_unaligned_append.sh @@ -0,0 +1,25 @@ +#!/bin/bash -ex + +GLOBAL_CONFIG=',"client_enable_writeback":false' +IMMEDIATE_COMMIT=1 +PG_COUNT=16 +. `dirname $0`/run_3osds.sh + +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL create -s 10G fsmeta +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL modify-pool --used-for-app fs:fsmeta testpool +build/src/nfs/vitastor-nfs start --fs fsmeta --etcd_address $ETCD_URL --portmap 0 --port 2050 --foreground 1 --trace 1 >>./testdata/nfs.log 2>&1 & +NFS_PID=$! + +mkdir -p testdata/nfs +sudo mount localhost:/ ./testdata/nfs -o port=2050,mountport=2050,nfsvers=3,soft,nolock,tcp +MNT=$(pwd)/testdata/nfs +trap "sudo umount -f $MNT"' || true; kill -9 $(jobs -p)' EXIT + +dd if=/dev/urandom of=./testdata/ref_data.bin bs=1M count=32 seek=1024B +build/src/cmd/vitastor-cli --etcd_address $ETCD_URL dd if=./testdata/ref_data.bin of=$MNT/testfile oflag=direct bs=1M iodepth=4 seek=1024B skip=1024B +cp $MNT/testfile ./testdata/nfs_data.bin +if ! diff -q ./testdata/ref_data.bin $MNT/testfile; then + format_error 'Data lost during parallel unaligned writes to VitastorFS' +fi + +format_green OK