test(federation): M2 integration tests (FED-M2-09) #499
Reference in New Issue
Block a user
Delete Branch "feat/federation-m2-integration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Integration tests for the Mosaic federation M2 milestone (FED-M2-09).
Closes #461
Tests covered
createGrantwrites apendingrow to DB; scope and status verified (FEDERATED_INTEGRATION=1)clientKeyPemstored in DB is a sealed ciphertext, not a PEM (FEDERATED_INTEGRATION=1)createGrantrejects scope with unknown resource type withFederationScopeError(FEDERATED_INTEGRATION=1)listGrantsreturns accurate status for pending/revoked grants; peer list correct (FEDERATED_INTEGRATION=1)EnrollmentService.redeemreturns a valid PEM certificate via real Step-CA (STEP_CA_AVAILABLE=1)EnrollmentService.redeemwith the same token throwsGoneException(STEP_CA_AVAILABLE=1)Gate env vars
DB-only tests (#1, #5, #7, #8):
FEDERATED_INTEGRATION=1Step-CA tests (#2, #3) additional vars:
STEP_CA_AVAILABLE=1STEP_CA_URL=https://localhost:9000STEP_CA_PROVISIONER_KEY_JSON— fromdocker exec $(docker ps -qf name=step-ca) cat /home/step/secrets/mosaic-fed.jsonSTEP_CA_ROOT_CERT_PATH=/tmp/step-ca-root.crt— copy fromdocker cp $(docker ps -qf name=step-ca):/home/step/certs/root_ca.crt /tmp/step-ca-root.crtHow to run
Prerequisites:
docker compose -f docker-compose.federated.yml --profile federated up -dDB-only:
FEDERATED_INTEGRATION=1 pnpm --filter @mosaicstack/gateway test src/__tests__/integration/federation-m2.integration.test.tsDesign notes
useValuein DB-only tests so Step-CA env vars are not requiredRUN_IDUUID prefixcreateDb/DbHandlefrom@mosaicstack/db(avoids direct drizzle-orm/postgres-js import)