167 lines
8.6 KiB
YAML
167 lines
8.6 KiB
YAML
name: OGL AssetService Cache and Migration Tests
|
|
on:
|
|
push:
|
|
branches: [feature/ogl-assetservice-addon, feature/ogl-assetservice-cutover-benchmarks]
|
|
paths:
|
|
- 'addons/OGLAssetService/**'
|
|
- 'addons/OGLAssetService.Tests/**'
|
|
- 'addons/OGLAssetService.Migration/**'
|
|
- 'OpenSim/Data/IFSAssetData.cs'
|
|
- 'OpenSim/Data/MySQL/MySQLFSAssetData.cs'
|
|
- 'OpenSim/Data/PGSQL/PGSQLFSAssetData.cs'
|
|
- 'OpenSim/Services/FSAssetService/FSAssetService.cs'
|
|
- '.github/workflows/ogl-assetservice-tests.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'addons/OGLAssetService/**'
|
|
- 'addons/OGLAssetService.Tests/**'
|
|
- 'addons/OGLAssetService.Migration/**'
|
|
- '.github/workflows/ogl-assetservice-tests.yml'
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
smoke:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
services:
|
|
mariadb:
|
|
image: mariadb:11
|
|
env:
|
|
MARIADB_ROOT_PASSWORD: ogl-test-only
|
|
ports:
|
|
- 3306:3306
|
|
options: >-
|
|
--health-cmd="healthcheck.sh --connect --innodb_initialized"
|
|
--health-interval=5s --health-timeout=5s --health-retries=20
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_PASSWORD: ogl-test-only
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd="pg_isready -U postgres"
|
|
--health-interval=5s --health-timeout=5s --health-retries=20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
- name: Build isolated cache and migration tests
|
|
run: dotnet build addons/OGLAssetService.Tests/OGLAssetService.Tests.csproj --configuration Release
|
|
- name: Build standalone migration CLI
|
|
run: dotnet build addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj --configuration Release
|
|
- name: Verify patched native SQLite dependency for isolated tools
|
|
run: python3 tools/ci/verify_sqlite_native_dependency.py
|
|
- name: CLI dry-run and verified copy
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p "$RUNNER_TEMP/fsassets-source/nested"
|
|
printf 'test-asset' > "$RUNNER_TEMP/fsassets-source/nested/data.bin"
|
|
dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- "$RUNNER_TEMP/fsassets-source" "$RUNNER_TEMP/fsassets-target"
|
|
test ! -e "$RUNNER_TEMP/fsassets-target"
|
|
dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- "$RUNNER_TEMP/fsassets-source" "$RUNNER_TEMP/fsassets-target" --copy
|
|
cmp "$RUNNER_TEMP/fsassets-source/nested/data.bin" "$RUNNER_TEMP/fsassets-target/nested/data.bin"
|
|
- name: Verify metadata audit CLI requires row count
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p "$RUNNER_TEMP/metadata-empty"
|
|
: > "$RUNNER_TEMP/metadata-empty.tsv"
|
|
if dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$RUNNER_TEMP/metadata-empty" "$RUNNER_TEMP/metadata-empty.tsv"; then
|
|
echo "ERROR: audit accepted missing expected row count"
|
|
exit 1
|
|
fi
|
|
if dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$RUNNER_TEMP/metadata-empty" "$RUNNER_TEMP/metadata-empty.tsv" --expected-rows 1; then
|
|
echo "ERROR: audit accepted incomplete export"
|
|
exit 1
|
|
fi
|
|
- name: Verify metadata audit positive CLI path
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
base="$RUNNER_TEMP/metadata-valid"
|
|
mkdir -p "$base"
|
|
printf 'ogl-metadata-fixture' > "$RUNNER_TEMP/asset-payload"
|
|
hash="$(sha256sum "$RUNNER_TEMP/asset-payload" | cut -d ' ' -f 1)"
|
|
folder="$base/${hash:0:2}/${hash:2:2}/${hash:4:2}/${hash:6:4}"
|
|
mkdir -p "$folder"
|
|
cp "$RUNNER_TEMP/asset-payload" "$folder/$hash"
|
|
printf '123e4567-e89b-12d3-a456-426614174000\t%s\n' "$hash" > "$RUNNER_TEMP/metadata-valid.tsv"
|
|
dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$base" "$RUNNER_TEMP/metadata-valid.tsv" --expected-rows 1
|
|
- name: Migrate verified SQL/FSAssets snapshot into OGL SQLite and immutable blobs
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
base="$RUNNER_TEMP/metadata-valid"
|
|
spool="$RUNNER_TEMP/parallel-spool"
|
|
index="$RUNNER_TEMP/ogl-new-index/locations.sqlite"
|
|
objects="$RUNNER_TEMP/ogl-new-objects"
|
|
mkdir -p "$spool"
|
|
command=(dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --parallel-snapshot "$base" "$spool" "$RUNNER_TEMP/metadata-valid.tsv" "$objects" "$index" --expected-rows 1)
|
|
"${command[@]}"
|
|
test ! -e "$index" && test ! -e "$objects"
|
|
if "${command[@]}" --copy; then
|
|
echo "ERROR: migration accepted --copy without offline snapshot acknowledgement"
|
|
exit 1
|
|
fi
|
|
"${command[@]}" --copy --offline-snapshot-confirmed
|
|
"${command[@]}" --copy --offline-snapshot-confirmed
|
|
python3 - "$objects" "$index" "$RUNNER_TEMP/asset-payload" <<'PY'
|
|
import hashlib, pathlib, sqlite3, sys
|
|
objects, index, payload = pathlib.Path(sys.argv[1]), sys.argv[2], pathlib.Path(sys.argv[3]).read_bytes()
|
|
digest = hashlib.sha256(payload).hexdigest()
|
|
with sqlite3.connect(index) as db:
|
|
row = db.execute("SELECT content_hash FROM ogl_asset_locations WHERE asset_id = ?",
|
|
("123e4567-e89b-12d3-a456-426614174000",)).fetchone()
|
|
assert row == (digest,), row
|
|
assert (objects / digest[:2] / digest[2:4] / digest).read_bytes() == payload
|
|
PY
|
|
- name: Reject corrupt and duplicate metadata fixtures
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
base="$RUNNER_TEMP/metadata-valid"
|
|
good="$RUNNER_TEMP/metadata-valid.tsv"
|
|
cp "$good" "$RUNNER_TEMP/metadata-duplicate.tsv"
|
|
cat "$good" >> "$RUNNER_TEMP/metadata-duplicate.tsv"
|
|
if dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$base" "$RUNNER_TEMP/metadata-duplicate.tsv" --expected-rows 2; then
|
|
echo "ERROR: duplicate UUID accepted"
|
|
exit 1
|
|
fi
|
|
printf 'invalid-row\\n' > "$RUNNER_TEMP/metadata-invalid.tsv"
|
|
if dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$base" "$RUNNER_TEMP/metadata-invalid.tsv" --expected-rows 1; then
|
|
echo "ERROR: invalid row accepted"
|
|
exit 1
|
|
fi
|
|
hash="$(sha256sum "$RUNNER_TEMP/asset-payload" | cut -d ' ' -f 1)"
|
|
printf '123e4567-e89b-12d3-a456-426614174000\\t%s\\n' "$hash" > "$RUNNER_TEMP/metadata-missing.tsv"
|
|
rm "$base/${hash:0:2}/${hash:2:2}/${hash:4:2}/${hash:6:4}/$hash"
|
|
if dotnet run --project addons/OGLAssetService.Migration/OGLAssetService.Migration.csproj -c Release --no-build -- --verify-metadata "$base" "$RUNNER_TEMP/metadata-missing.tsv" --expected-rows 1; then
|
|
echo "ERROR: missing payload accepted"
|
|
exit 1
|
|
fi
|
|
- name: Install database backup clients
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y -qq mariadb-client postgresql-client
|
|
- name: SQL metadata roundtrip MariaDB
|
|
env:
|
|
MYSQL_PWD: ogl-test-only
|
|
run: bash addons/OGLAssetService.Migration/test-sql-roundtrip.sh mysql
|
|
- name: SQL metadata roundtrip PostgreSQL
|
|
env:
|
|
PGPASSWORD: ogl-test-only
|
|
run: bash addons/OGLAssetService.Migration/test-sql-roundtrip.sh postgres
|
|
- name: Verify atomic SQL compare-and-swap under concurrent writers (MariaDB)
|
|
env:
|
|
MYSQL_PWD: ogl-test-only
|
|
run: bash addons/OGLAssetService.Migration/test-atomic-cas.sh mysql
|
|
- name: Verify atomic SQL compare-and-swap under concurrent writers (PostgreSQL)
|
|
env:
|
|
PGPASSWORD: ogl-test-only
|
|
run: bash addons/OGLAssetService.Migration/test-atomic-cas.sh postgres
|
|
- name: Run isolated cache and migration tests
|
|
run: dotnet run --project addons/OGLAssetService.Tests/OGLAssetService.Tests.csproj --configuration Release --no-build
|