Skip to content

Commit 6abf878

Browse files
sij411claude
andcommitted
Add interoperability smoke tests for Mastodon
Add an end-to-end smoke test suite that spins up a Mastodon instance via Docker Compose and verifies that Fedify can correctly exchange ActivityPub messages with it. The suite includes a lightweight Fedify test harness that runs inside the Docker network alongside Mastodon, and an orchestrator that drives six scenarios through the Mastodon API and harness backdoor endpoints: - Mastodon → Fedify (Follow) - Fedify → Mastodon (Follow) - Fedify → Mastodon (Create Note) - Mastodon → Fedify (Reply) - Mastodon → Fedify (Unfollow) - Fedify → Mastodon (Unfollow) Each follow scenario includes precondition checks (ensureNotFollowing / assertNotFollowing) to verify the relationship starts clean. Mastodon-specific files live in test/smoke/mastodon/ to support adding other server targets (e.g. Misskey) in sibling directories later. See: #481 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8b21c62 commit 6abf878

14 files changed

Lines changed: 1567 additions & 2268 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
#
3+
# Interoperability smoke tests.
4+
# Spins up a Mastodon instance via Docker Compose and verifies that Fedify
5+
# can correctly exchange ActivityPub messages with it.
6+
# See: https://github.com/fedify-dev/fedify/issues/481
7+
name: smoke-mastodon
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
- next
14+
- "*.*-maintenance"
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
smoke:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 25
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
# Only need mise for Deno (orchestrator); skip full workspace build
30+
- uses: jdx/mise-action@v2
31+
with:
32+
version: 2025.12.12
33+
install: true
34+
35+
- name: Generate Mastodon secrets
36+
run: |
37+
IMAGE=ghcr.io/mastodon/mastodon:v4.3.9
38+
docker pull "$IMAGE"
39+
40+
SECRET1=$(docker run --rm "$IMAGE" bundle exec rails secret)
41+
SECRET2=$(docker run --rm "$IMAGE" bundle exec rails secret)
42+
43+
{
44+
echo "SECRET_KEY_BASE=$SECRET1"
45+
echo "OTP_SECRET=$SECRET2"
46+
docker run --rm "$IMAGE" bundle exec rails mastodon:webpush:generate_vapid_key \
47+
| grep -E '^[A-Z_]+=.+'
48+
docker run --rm "$IMAGE" bundle exec rails db:encryption:init \
49+
| grep -E '^[A-Z_]+=.+'
50+
} >> test/smoke/mastodon/mastodon.env
51+
52+
- name: Start database and redis
53+
run: |
54+
docker compose -f test/smoke/mastodon/docker-compose.yml up -d db redis
55+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T db \
56+
sh -c 'until pg_isready -U mastodon; do sleep 1; done'
57+
58+
- name: Run DB setup and migrations
59+
run: |
60+
docker compose -f test/smoke/mastodon/docker-compose.yml run --rm -T \
61+
mastodon-web bundle exec rails db:setup
62+
timeout-minutes: 5
63+
64+
- name: Start Mastodon stack
65+
run: docker compose -f test/smoke/mastodon/docker-compose.yml up --wait
66+
timeout-minutes: 12
67+
68+
- name: Provision Mastodon
69+
run: bash test/smoke/mastodon/provision.sh
70+
71+
- name: Verify connectivity
72+
run: |
73+
echo "=== Harness health (from mastodon-web) ==="
74+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T mastodon-web \
75+
curl -sf http://fedify-harness:3001/_test/health && echo " OK" || echo " FAIL"
76+
77+
echo "=== Harness health (from mastodon-sidekiq) ==="
78+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T mastodon-sidekiq \
79+
curl -sf http://fedify-harness:3001/_test/health && echo " OK" || echo " FAIL"
80+
81+
- name: Run smoke tests
82+
run: |
83+
set -a && source test/smoke/.env.test && set +a
84+
deno run --allow-net --allow-env --unstable-temporal \
85+
test/smoke/orchestrator.ts
86+
87+
- name: Collect logs on failure
88+
if: failure()
89+
run: |
90+
echo "=== Docker Compose logs ==="
91+
docker compose -f test/smoke/mastodon/docker-compose.yml logs --tail=500
92+
93+
- name: Teardown
94+
if: always()
95+
run: docker compose -f test/smoke/mastodon/docker-compose.yml down -v

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ dist/
66
node_modules/
77
package-lock.json
88
repomix-output.xml
9+
test/smoke/.env.test
10+
test/smoke/mastodon/mastodon.env
11+
smoke.log
912
t.ts
1013
t2.ts
1114
plan.md

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"./packages/webfinger",
3030
"./examples/astro",
3131
"./examples/fresh",
32-
"./examples/hono-sample"
32+
"./examples/hono-sample",
33+
"./test/smoke/harness"
3334
],
3435
"imports": {
3536
"@cloudflare/workers-types": "npm:@cloudflare/workers-types@^4.20250529.0",

0 commit comments

Comments
 (0)