You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
244 lines
7.7 KiB
244 lines
7.7 KiB
name: "Rust Volume Server Tests"
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths:
|
|
- 'seaweed-volume/**'
|
|
- 'test/volume_server/**'
|
|
- 'weed/pb/volume_server.proto'
|
|
- 'weed/pb/volume_server_pb/**'
|
|
- '.github/workflows/rust-volume-server-tests.yml'
|
|
push:
|
|
branches: [ master, main ]
|
|
paths:
|
|
- 'seaweed-volume/**'
|
|
- 'test/volume_server/**'
|
|
- 'weed/pb/volume_server.proto'
|
|
- 'weed/pb/volume_server_pb/**'
|
|
- '.github/workflows/rust-volume-server-tests.yml'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
GO_VERSION: '1.24'
|
|
|
|
jobs:
|
|
rust-unit-tests:
|
|
name: Rust Unit Tests
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install protobuf compiler
|
|
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-
|
|
|
|
- name: Build Rust volume server
|
|
run: cd seaweed-volume && cargo build --release
|
|
|
|
- name: Run Rust unit tests
|
|
run: cd seaweed-volume && cargo test
|
|
|
|
rust-integration-tests:
|
|
name: Rust Integration Tests
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install protobuf compiler
|
|
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-
|
|
|
|
- name: Build Go weed binary
|
|
run: |
|
|
cd weed
|
|
go build -o weed .
|
|
chmod +x weed
|
|
./weed version
|
|
|
|
- name: Build Rust volume binary
|
|
run: cd seaweed-volume && cargo build --release
|
|
|
|
- name: Run integration tests
|
|
env:
|
|
WEED_BINARY: ${{ github.workspace }}/weed/weed
|
|
RUST_VOLUME_BINARY: ${{ github.workspace }}/seaweed-volume/target/release/seaweed-volume
|
|
run: |
|
|
echo "Running Rust volume server integration tests..."
|
|
go test -v -count=1 -timeout=15m ./test/volume_server/rust/...
|
|
|
|
- name: Collect logs on failure
|
|
if: failure()
|
|
run: |
|
|
mkdir -p /tmp/rust-volume-server-it-logs
|
|
find /tmp -maxdepth 1 -type d -name "seaweedfs_volume_server_it_*" -print -exec cp -r {} /tmp/rust-volume-server-it-logs/ \; || true
|
|
|
|
- name: Archive logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rust-volume-server-integration-test-logs
|
|
path: /tmp/rust-volume-server-it-logs/
|
|
if-no-files-found: warn
|
|
retention-days: 7
|
|
|
|
- name: Test summary
|
|
if: always()
|
|
run: |
|
|
echo "## Rust Volume Server Integration Test Summary" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- Suite: test/volume_server/rust" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- Command: go test -v -count=1 -timeout=15m ./test/volume_server/rust/..." >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
rust-volume-go-tests:
|
|
name: Go Tests with Rust Volume (${{ matrix.test-type }} - Shard ${{ matrix.shard }})
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 45
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test-type: [grpc, http]
|
|
shard: [1, 2, 3]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Install protobuf compiler
|
|
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-
|
|
|
|
- name: Build Go weed binary
|
|
run: |
|
|
cd weed
|
|
go build -o weed .
|
|
chmod +x weed
|
|
./weed version
|
|
|
|
- name: Build Rust volume binary
|
|
run: cd seaweed-volume && cargo build --release
|
|
|
|
- name: Run volume server integration tests with Rust volume
|
|
env:
|
|
WEED_BINARY: ${{ github.workspace }}/weed/weed
|
|
RUST_VOLUME_BINARY: ${{ github.workspace }}/seaweed-volume/target/release/seaweed-volume
|
|
VOLUME_SERVER_IMPL: rust
|
|
run: |
|
|
if [ "${{ matrix.test-type }}" == "grpc" ]; then
|
|
if [ "${{ matrix.shard }}" == "1" ]; then
|
|
TEST_PATTERN="^Test[A-H]"
|
|
elif [ "${{ matrix.shard }}" == "2" ]; then
|
|
TEST_PATTERN="^Test[I-S]"
|
|
else
|
|
TEST_PATTERN="^Test[T-Z]"
|
|
fi
|
|
else
|
|
if [ "${{ matrix.shard }}" == "1" ]; then
|
|
TEST_PATTERN="^Test[A-G]"
|
|
elif [ "${{ matrix.shard }}" == "2" ]; then
|
|
TEST_PATTERN="^Test[H-R]"
|
|
else
|
|
TEST_PATTERN="^Test[S-Z]"
|
|
fi
|
|
fi
|
|
echo "Running Go volume server tests with Rust volume for ${{ matrix.test-type }} (Shard ${{ matrix.shard }}, pattern: ${TEST_PATTERN})..."
|
|
go test -v -count=1 -timeout=30m ./test/volume_server/${{ matrix.test-type }}/... -run "${TEST_PATTERN}"
|
|
|
|
- name: Collect logs on failure
|
|
if: failure()
|
|
run: |
|
|
mkdir -p /tmp/rust-volume-go-test-logs
|
|
find /tmp -maxdepth 1 -type d -name "seaweedfs_volume_server_it_*" -print -exec cp -r {} /tmp/rust-volume-go-test-logs/ \; || true
|
|
|
|
- name: Archive logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rust-volume-go-test-logs-${{ matrix.test-type }}-shard${{ matrix.shard }}
|
|
path: /tmp/rust-volume-go-test-logs/
|
|
if-no-files-found: warn
|
|
retention-days: 7
|
|
|
|
- name: Test summary
|
|
if: always()
|
|
run: |
|
|
if [ "${{ matrix.test-type }}" == "grpc" ]; then
|
|
if [ "${{ matrix.shard }}" == "1" ]; then
|
|
TEST_PATTERN="^Test[A-H]"
|
|
elif [ "${{ matrix.shard }}" == "2" ]; then
|
|
TEST_PATTERN="^Test[I-S]"
|
|
else
|
|
TEST_PATTERN="^Test[T-Z]"
|
|
fi
|
|
else
|
|
if [ "${{ matrix.shard }}" == "1" ]; then
|
|
TEST_PATTERN="^Test[A-G]"
|
|
elif [ "${{ matrix.shard }}" == "2" ]; then
|
|
TEST_PATTERN="^Test[H-R]"
|
|
else
|
|
TEST_PATTERN="^Test[S-Z]"
|
|
fi
|
|
fi
|
|
echo "## Rust Volume - Go Test Summary (${{ matrix.test-type }} - Shard ${{ matrix.shard }})" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- Suite: test/volume_server/${{ matrix.test-type }} (Pattern: ${TEST_PATTERN})" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "- Volume server: Rust (VOLUME_SERVER_IMPL=rust)" >> "$GITHUB_STEP_SUMMARY"
|