3ad38ddde7
Close the two coverage gaps in the external-mounts feature — the admin REST surface and the admin UI tab both previously had no automated tests. Backend (hurl): - tests/api/external_mounts.hurl — black-box coverage of the admin mount endpoints (list / create / delete): input validation (empty name, non-existent host path → 400), create → 201 with the full view, the mount appears in the list, delete → 204 then 404, and the /api/admin middleware denies a non-admin on every verb → 403. - server.env: enable OXICLOUD_ENABLE_EXTERNAL_MOUNTS for the test server; run.sh: register the new scenario. Frontend (vitest): - admin/page.test.ts — opening the mounts tab loads + lists mounts, the create form calls createExternalMount, and delete goes through the confirm modal to deleteExternalMount. Tooling: - devenv.nix: add b3sum (used by tests/api/run.sh's storage-integrity check).
111 lines
5.1 KiB
Bash
111 lines
5.1 KiB
Bash
# Shared test-server environment variables.
|
|
# Sourced by tests/api/run.sh (shell) and read by tests/e2e/playwright.config.ts (Node).
|
|
# Do NOT include OXICLOUD_SERVER_PORT or OXICLOUD_STORAGE_PATH here —
|
|
# each test suite sets those to avoid port/directory conflicts.
|
|
|
|
DATABASE_URL=postgres://oxicloud_test:oxicloud_test@localhost:5433/oxicloud_test
|
|
OXICLOUD_DB_CONNECTION_STRING=postgres://oxicloud_test:oxicloud_test@localhost:5433/oxicloud_test
|
|
OXICLOUD_STATIC_PATH=./static
|
|
OXICLOUD_JWT_SECRET=test-secret-do-not-use-in-prod-minimum-32-chars
|
|
OXICLOUD_ENABLE_AUTH=true
|
|
OXICLOUD_ENABLE_TRASH=true
|
|
OXICLOUD_ENABLE_SEARCH=true
|
|
OXICLOUD_ENABLE_FILE_SHARING=true
|
|
OXICLOUD_ENABLE_MUSIC=true
|
|
# External file mounts — enabled so external_mounts.hurl can exercise the
|
|
# admin CRUD endpoints against a live mount registry.
|
|
OXICLOUD_ENABLE_EXTERNAL_MOUNTS=true
|
|
OXICLOUD_EXPOSE_SYSTEM_USERS=true
|
|
OXICLOUD_WOPI_ENABLED=true
|
|
# Fixed secret so the Hurl WOPI test can hand-craft valid access
|
|
# tokens with a known signing key. Prod deployments MUST override
|
|
# this to a random per-deployment value.
|
|
OXICLOUD_WOPI_SECRET=test-wopi-secret-do-not-use-in-prod-do-not-use-in-prod
|
|
# Discovery URL points at a black hole — VERB endpoints don't need
|
|
# discovery, and the WOPI Hurl suite deliberately does NOT touch
|
|
# `/api/wopi/editor-url` (the only path that would fetch it), so
|
|
# an unreachable URL keeps startup fast and hermetic.
|
|
OXICLOUD_WOPI_DISCOVERY_URL=http://127.0.0.1:9100/discovery.xml
|
|
OXICLOUD_WOPI_TOKEN_TTL_SECS=3600
|
|
OXICLOUD_OIDC_ENABLED=false
|
|
|
|
OXICLOUD_NEXTCLOUD_ENABLED=true
|
|
|
|
# Test-only sweep triggers (`/api/admin/internal/trigger-sweep`,
|
|
# `/api/admin/internal/trigger-gc`). Off by default in production;
|
|
# the Hurl suite needs them to assert post-delete quota convergence
|
|
# without waiting out the 600 s reconciliation tick.
|
|
OXICLOUD_ENABLE_ADMIN_INTERNAL_ENDPOINTS=true
|
|
|
|
RUST_LOG="warn,audit=info,sqlx::migrate=info"
|
|
#RUST_LOG="warn,audit=info,oxicloud::quota=debug"
|
|
#RUST_LOG=debug
|
|
#RUST_LOG=info
|
|
|
|
# Per-chunk upload cap, exercised by chunked_upload_cap.hurl.
|
|
# 4 MiB: lets the existing grants.hurl single-chunk test (2.76 MB) pass
|
|
# under the cap, while the cap test sends a 5 MiB fixture to trigger 413.
|
|
OXICLOUD_CHUNK_MAX_BYTES=4194304
|
|
|
|
# Direct-PUT (non-chunked) cap, exercised by chunked_upload_cap.hurl.
|
|
# 4 MiB: same threshold as the chunked cap so the existing 5 MiB
|
|
# fixture (chunk-over-cap-5mb.bin) can prove BOTH caps with one
|
|
# generated file. All existing direct-PUT tests
|
|
# (test_dedup_webdav_multichunk.sh = 2.76 MB, _ref_count = ~66 KB,
|
|
# _nextcloud_put_blake3 = 32 B) stay safely under this cap.
|
|
OXICLOUD_DIRECT_PUT_MAX_BYTES=4194304
|
|
|
|
# grow up limits for tests
|
|
OXICLOUD_RATE_LIMIT_REFRESH_MAX=3600
|
|
OXICLOUD_RATE_LIMIT_LOGIN_MAX=3600
|
|
OXICLOUD_RATE_LIMIT_REGISTER_MAX=3600
|
|
|
|
# Magic-link / external-users flow (PR 9). The mock SMTP captures every
|
|
# outbound message in-process so external_users.hurl can retrieve the
|
|
# invitation body and follow the magic-link URL. The `SMTP_FROM` value
|
|
# is required so the mock can build a valid Message; host/port are
|
|
# irrelevant in mock mode but kept set for completeness.
|
|
OXICLOUD_SMTP_MOCK=true
|
|
OXICLOUD_SMTP_HOST=localhost
|
|
OXICLOUD_SMTP_PORT=25
|
|
OXICLOUD_SMTP_FROM='OxiCloud Tests <test@oxicloud.local>'
|
|
OXICLOUD_SMTP_TLS=none
|
|
OXICLOUD_ALLOW_EXTERNAL_USERS=true
|
|
|
|
# Public-registration email-domain allowlist. Exercised by
|
|
# `registration.hurl` step "off-domain rejection" (attempts to
|
|
# register with @nowhere.invalid and asserts 403
|
|
# `RegistrationDomainNotAllowed`). Contains BOTH `example.com` (Hurl
|
|
# fixtures use it — charlie@example.com etc.) AND `example.test` (E2E
|
|
# login.spec uses it — reg-*@example.test). Every legitimate test
|
|
# path stays inside the allowlist; the rejection test picks a domain
|
|
# outside it deliberately.
|
|
OXICLOUD_REGISTRATION_ALLOWED_EMAIL_DOMAINS=example.com,example.test
|
|
|
|
# Auth-policy vector. Enables the "magic-link login is allowed for
|
|
# accounts that also have a password" branch — required by
|
|
# auth_magic_link_login.hurl (alice has a password AND requests a
|
|
# magic-link login). Inert for every other test: `has_password`
|
|
# refusal only fires when the endpoint is called, and no other file
|
|
# calls `magic-link/send` for a password-holding account.
|
|
OXICLOUD_AUTH_POLICIES=permit_magic_link_for_password_users
|
|
OXICLOUD_AUTH_METHODS=password,magic_link
|
|
# Explicit pin — `--config` now overrides shell env (main.rs uses
|
|
# `from_filename_override`), but pinning here documents the intended
|
|
# test-env state. Flip to true for the deferred `tests/verify_email/`
|
|
# suite; leaving false here keeps every other suite on the "verified
|
|
# email not required" path (charlie's classic register+login etc.).
|
|
OXICLOUD_REQUIRE_VERIFIED_EMAIL=false
|
|
|
|
# PR 12 — magic-link rate-limit caps lowered so external_users.hurl can
|
|
# exercise the cap behaviour with a small, deterministic request count.
|
|
# Production defaults are 50 / 5 / 200 respectively (see example.env).
|
|
OXICLOUD_MAGIC_LINK_INVITE_PER_CALLER_PER_HOUR=3
|
|
OXICLOUD_MAGIC_LINK_SEND_PER_EMAIL_PER_HOUR=2
|
|
OXICLOUD_MAGIC_LINK_SEND_PER_IP_PER_HOUR=50
|
|
|
|
# permits IP spoofing for tests
|
|
OXICLOUD_TRUST_PROXY_CIDR=0.0.0.0/0
|
|
|
|
OXICLOUD_ENABLE_ADMIN_INTERNAL_ENDPOINTS=true
|