T2: CI runs every test against a throwaway mongod
tools/ci/with-test-mongod.sh starts mongod (or podman's mongo:8) on a random localhost port with a temporary data directory, runs the command, and removes both. build.yml and deploy.yml test through it, so the ~85 integration tests stop being skipped in CI. MongoFixture refuses production's port and data directory, and in CI anything but the wrapper's mongod; with PRIVAPUB_TEST_REQUIRE_MONGOD=1 a missing mongod fails instead of skipping. The deploy now passes the PRIVAPUB_SMOKE_TOKEN secret to the Mastodon smoke check, so its signed-in half runs once the owner creates the persona and the secret. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ELjqpznMFMNrJoJUj6K5p2
This commit is contained in:
1 parent
00b2685cf4
commit
85fdff606d
5 files changed
+110
-9
No files matched your search
@@ -15,5 +15,5 @@ jobs:
|
||||
- name: Build
|
||||
run: dotnet build PrivaPub.sln -c Release
|
||||
|
||||
- name: Test
|
||||
run: dotnet test PrivaPub.sln -c Release --no-build
|
||||
- name: Test (unit and integration, on a throwaway mongod)
|
||||
run: tools/ci/with-test-mongod.sh dotnet test PrivaPub.sln -c Release --no-build
|
||||
@@ -28,8 +28,8 @@ jobs:
|
||||
echo "BUILD_REF=${GITHUB_REF_NAME:-master}" >> "$GITHUB_ENV"
|
||||
echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Test
|
||||
run: dotnet test PrivaPub.sln -c Release
|
||||
- name: Test (unit and integration, on a throwaway mongod)
|
||||
run: tools/ci/with-test-mongod.sh dotnet test PrivaPub.sln -c Release
|
||||
|
||||
- name: Publish
|
||||
run: |
|
||||
@@ -90,6 +90,8 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Verify what is being served
|
||||
env:
|
||||
SMOKE_TOKEN: ${{ secrets.PRIVAPUB_SMOKE_TOKEN }}
|
||||
run: |
|
||||
served=$(curl -fsS "$PUBLIC_URL/build.json" | python3 -c "import json,sys; print(json.load(sys.stdin).get('commit',''))")
|
||||
[ "$served" = "$BUILD_COMMIT" ] || { echo "::error::served build is '$served', expected '$BUILD_COMMIT'"; exit 1; }
|
||||
@@ -104,5 +106,6 @@ jobs:
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/activity+json' \
|
||||
--data '{"type":"Follow","actor":"https://example.org/users/x","object":"'"$PUBLIC_URL"'/peasants/privapub"}' "$PUBLIC_URL/human-centipede")
|
||||
[ "$code" = "401" ] || { echo "::error::an unsigned inbox POST answered $code"; exit 1; }
|
||||
tools/smoke/mastodon-api.sh "$PUBLIC_URL"
|
||||
tools/smoke/mastodon-api.sh "$PUBLIC_URL" "$SMOKE_TOKEN"
|
||||
[ -n "$SMOKE_TOKEN" ] || echo "::warning::PRIVAPUB_SMOKE_TOKEN is not set, so the signed-in API was not checked"
|
||||
echo "::notice::serving $served"
|
||||
Reference in new issue
Block a user