Use recorded fixture setup in organizations E2E

This commit is contained in:
jason.woltje committed 2026-11-07 12:54:54 -06:00
1 parent f819c55302
commit d5d00e28df
1 file changed
+1 -22
+1 -22
View File
@@ -183,28 +183,10 @@ check "$TEST_AREA/fixture-init.json" '.principal == "local-dev:local-dev-owner"'
show fixture-status.json mosaic dev fixture status --json
check "$TEST_AREA/fixture-status.json" '.ready == true and .upstream == "none" and .external == false and .health.upstream == "none"' "status ready, upstream none"
# The S0 template (--fixture local) has no plugins, launch or tester flag yet.
# This adds what a worker turn on the fixture needs; it is the only change.
patch_doc() {
"${RUN_ENV[@]}" node --input-type=module -e '
import { readFileSync, writeFileSync } from "node:fs";
const [, provider, file] = process.argv;
const { FIXTURE_ENTRY, FIXTURE_KEY_NAME } = await import(provider);
const doc = JSON.parse(readFileSync(file, "utf8"));
doc.plugins = { channel: ["cli", "webui"], harness: ["pi"], "model-provider": ["fixture"] };
doc.launch = { by: "chief", instances: ["assistant"], models: { [FIXTURE_KEY_NAME]: FIXTURE_ENTRY } };
doc.roles.assistant.vars = { ...(doc.roles.assistant.vars ?? {}), harness: "pi", model: FIXTURE_KEY_NAME, thinking: "off" };
doc.vars = { ...(doc.vars ?? {}), "bus.tester": true };
writeFileSync(file, `${JSON.stringify(doc, null, 2)}\n`, { mode: 0o600 });
' "$REPO/packages/plugins/model-provider/fixture/index.mjs" "$1" || fail "could not patch $1"
}
org_setup() {
local id="$1" doc="$TEST_AREA/$1.json"
step "$id document"
mosaic org template render "$id" --fixture local --output "$doc" | tee "$TEST_AREA/$id-render.out"
patch_doc "$doc"
echo "patched: plugins (channel, harness, model-provider), launch, assistant vars, bus.tester"
check "$doc" ".id == \"$id\" and (.projects.work | type) == \"object\"" "$id document names project work"
if /usr/bin/grep -Eiq '(api[_-]?key|token|secret|password)"[[:space:]]*:' "$doc"; then fail "$doc carries a secret-looking key"; fi
echo "ok: no secret-looking keys in $doc"
@@ -235,10 +217,7 @@ org_setup() {
org_setup alpha
step "alpha bus"
# The bus refuses to start without a notifier config; this instance runs without DMs.
mkdir -p -m 700 "$DATA_ROOT/notify" "$DATA_ROOT/notify/alpha"
(umask 077; printf '{"notifyVersion": 1, "binding": null}\n' >"$DATA_ROOT/notify/alpha/notify.json")
echo "wrote $DATA_ROOT/notify/alpha/notify.json (binding null)"
check "$DATA_ROOT/notify/alpha/notify.json" '.notifyVersion == 1 and .binding == null' "alpha records notifications: none"
"${RUN_ENV[@]}" "$REPO/scripts/mosaic" bus start alpha --dev-local-owner >"$TEST_AREA/bus-alpha.out" 2>&1 &
BUS_PID=$!
netwatch "$BUS_PID" "$TEST_AREA/netwatch" &