e5167729a8
docker-compose.multisite-e2e.yml boots two full all-in-one instances (master + spoke, each with bundled slapd) and a client that drives the actual HTTP API: seeds admins, mints a join key, joins the spoke, and verifies the spoke persisted its role across restart, adopted the pre-join catalog, is enforced read-only, and reports WAN health. Verified passing locally. Existing docker-compose.test.yml/e2e.yml split ldap+redis+app into separate containers, which doesn't work here -- POST /api/site/export runs slapcat in-process, so master and spoke each need their own bundled slapd (Dockerfile.openldap), not a shared one.
58 lines
1.9 KiB
Docker
58 lines
1.9 KiB
Docker
# Test-runner image for SSO Manager.
|
|
#
|
|
# Installs all dependencies (including dev) and bundles the app code plus
|
|
# the seed script. The entrypoint waits for LDAP + Redis, seeds the test
|
|
# user, then runs whatever command is given (default: npm test).
|
|
|
|
FROM node:20-alpine
|
|
|
|
# Install OpenLDAP clients (ldapadd, ldapsearch) and bash for the seed script
|
|
RUN apk add --no-cache openldap-clients bash
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy and install dependencies (including devDependencies for jest/supertest)
|
|
COPY nodejs/package*.json ./
|
|
RUN npm ci
|
|
|
|
# Copy the application source
|
|
COPY nodejs/app.js ./
|
|
COPY nodejs/bin ./bin
|
|
COPY nodejs/conf ./conf
|
|
COPY nodejs/controller ./controller
|
|
COPY nodejs/drivers ./drivers
|
|
COPY nodejs/middleware ./middleware
|
|
COPY nodejs/models ./models
|
|
# Without this the discovery/plugin suites cannot even load their subject and
|
|
# fail as "Cannot find module ../plugins/discovery/..." -- plugin code was
|
|
# effectively untested in CI.
|
|
COPY nodejs/plugins ./plugins
|
|
COPY nodejs/routes ./routes
|
|
COPY nodejs/services ./services
|
|
COPY nodejs/utils ./utils
|
|
COPY nodejs/views ./views
|
|
COPY nodejs/public ./public
|
|
COPY nodejs/tests ./tests
|
|
|
|
# SQLite database directory (config/inventory.sqlite for Resource model's ORM)
|
|
RUN mkdir -p /app/config
|
|
|
|
# Files expected at the flattened /app path (see Dockerfile.openldap notes)
|
|
COPY tos.md /tos.md
|
|
COPY README.md /README.md
|
|
COPY CHANGELOG.md /CHANGELOG.md
|
|
COPY API.md /API.md
|
|
COPY directory_spec.md /directory_spec.md
|
|
|
|
# Seed script and utility
|
|
COPY test_seed.js ./test_seed.js
|
|
COPY test/seed-test-user.sh /usr/local/bin/seed-test-user
|
|
RUN chmod +x /usr/local/bin/seed-test-user
|
|
# End-to-end LDAP tunnel test client (docker-compose.e2e.yml)
|
|
COPY test/tunnel_e2e.js ./test/tunnel_e2e.js
|
|
# End-to-end multi-site join test client (docker-compose.multisite-e2e.yml)
|
|
COPY test/multisite_join_e2e.js ./test/multisite_join_e2e.js
|
|
|
|
# Default command: seed the test user, then run the test suite
|
|
CMD ["sh", "-c", "seed-test-user && npm test"]
|