Skip to content

Commit 59f4dc0

Browse files
sij411claude
andcommitted
Harden smoke test orchestrator and provisioning
- Use shared setup-mise action instead of inlining jdx/mise-action - Validate required env vars at startup with clear error messages - Derive harness host from HARNESS_ORIGIN instead of hardcoding - Pass HARNESS_ORIGIN as env var in provision.sh to avoid shell expansion in Ruby heredoc Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6abf878 commit 59f4dc0

3 files changed

Lines changed: 25 additions & 18 deletions

File tree

.github/workflows/smoke-mastodon.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828

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
29+
- uses: ./.github/actions/setup-mise
3430

3531
- name: Generate Mastodon secrets
3632
run: |

test/smoke/mastodon/provision.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,21 @@ echo "→ Pre-registering Fedify remote account in Mastodon..."
5858
# Insert the remote account directly into Mastodon's database with values
5959
# matching the harness actor dispatcher configuration.
6060
HARNESS_ORIGIN="http://fedify-harness:3001"
61-
$COMPOSE exec -T mastodon-web bin/rails runner - <<RUBY
61+
$COMPOSE exec -T -e HARNESS_ORIGIN="$HARNESS_ORIGIN" \
62+
mastodon-web bin/rails runner - <<'RUBY'
63+
origin = ENV.fetch('HARNESS_ORIGIN')
6264
account = Account.find_or_initialize_by(
6365
username: 'testuser',
6466
domain: 'fedify-harness:3001'
6567
)
6668
account.update!(
6769
protocol: :activitypub,
68-
uri: '$HARNESS_ORIGIN/users/testuser',
69-
url: '$HARNESS_ORIGIN/users/testuser',
70-
inbox_url: '$HARNESS_ORIGIN/users/testuser/inbox',
71-
shared_inbox_url: '$HARNESS_ORIGIN/inbox',
72-
outbox_url: '$HARNESS_ORIGIN/users/testuser/outbox',
73-
followers_url: '$HARNESS_ORIGIN/users/testuser/followers',
70+
uri: "#{origin}/users/testuser",
71+
url: "#{origin}/users/testuser",
72+
inbox_url: "#{origin}/users/testuser/inbox",
73+
shared_inbox_url: "#{origin}/inbox",
74+
outbox_url: "#{origin}/users/testuser/outbox",
75+
followers_url: "#{origin}/users/testuser/followers",
7476
display_name: 'Fedify Smoke Test User',
7577
note: '',
7678
actor_type: 'Person'

test/smoke/orchestrator.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@
1010
* HARNESS_BASE_URL, HARNESS_ORIGIN, SERVER_INTERNAL_HOST
1111
*/
1212

13-
const SERVER_URL = Deno.env.get("SERVER_BASE_URL")!;
14-
const SERVER_TOKEN = Deno.env.get("SERVER_ACCESS_TOKEN")!;
15-
const HARNESS_URL = Deno.env.get("HARNESS_BASE_URL")!;
16-
const SERVER_INTERNAL_HOST = Deno.env.get("SERVER_INTERNAL_HOST")!;
13+
function requireEnv(name: string): string {
14+
const value = Deno.env.get(name);
15+
if (!value) throw new Error(`Missing required env var: ${name}`);
16+
return value;
17+
}
18+
19+
const SERVER_URL = requireEnv("SERVER_BASE_URL");
20+
const SERVER_TOKEN = requireEnv("SERVER_ACCESS_TOKEN");
21+
const HARNESS_URL = requireEnv("HARNESS_BASE_URL");
22+
const HARNESS_ORIGIN = requireEnv("HARNESS_ORIGIN");
23+
const SERVER_INTERNAL_HOST = requireEnv("SERVER_INTERNAL_HOST");
24+
25+
const HARNESS_HOST = new URL(HARNESS_ORIGIN).host;
1726

1827
const POLL_INTERVAL_MS = 2_000;
1928
const POLL_TIMEOUT_MS = 90_000;
@@ -98,7 +107,7 @@ let fedifyAccountId: string | undefined;
98107
async function lookupFedifyAccount(): Promise<string> {
99108
if (fedifyAccountId) return fedifyAccountId;
100109

101-
const handle = `testuser@fedify-harness:3001`;
110+
const handle = `testuser@${HARNESS_HOST}`;
102111

103112
const searchResult = await poll("Fedify user resolvable", async () => {
104113
const results = await serverGet(
@@ -244,7 +253,7 @@ async function testCreateNote(): Promise<void> {
244253
async function testReply(): Promise<void> {
245254
await harnessPost("/_test/reset");
246255

247-
const handle = `@testuser@fedify-harness:3001`;
256+
const handle = `@testuser@${HARNESS_HOST}`;
248257
const replyContent = `Reply smoke test ${Date.now()} ${handle}`;
249258

250259
await serverPost("/api/v1/statuses", {

0 commit comments

Comments
 (0)