Skip to content

test: add federation integration tests (Behat, two-instance)#393

Open
miaulalala wants to merge 4 commits into
julien-nc:mainfrom
miaulalala:feat/federation-integration-tests
Open

test: add federation integration tests (Behat, two-instance)#393
miaulalala wants to merge 4 commits into
julien-nc:mainfrom
miaulalala:feat/federation-integration-tests

Conversation

@miaulalala

Copy link
Copy Markdown
Contributor

Sets up the same two-PHP-server pattern used by Deck (PR #7734) and Spreed:

  • run-federation.sh: creates a second NC instance under data/, configures both, starts two PHP built-in servers on :8080/:8280, runs Behat, then tears down

  • FederationContext.php: OCS/Basic-Auth context with steps for server switching, user creation via occ, project creation, federated share/accept/reject/remove, pending-invitation polling with retry, and settings toggle helpers

  • sharing.feature: send invite → pending invite appears → accept → project visible; also tests rejection path

  • unshare.feature: host removes accepted share → remote loses access; host removes pending (never-accepted) share

  • settings.feature: outgoing disabled blocks share creation (400); incoming disabled on remote causes OCM share to be refused (400)

  • integration-federation.yml: GitHub Actions workflow (PHP 8.3, NC master, SQLite) mirroring the Deck federation CI workflow

  • This PR was partly or wholly created by AI

miaulalala and others added 4 commits March 19, 2026 16:46
Sets up the same two-PHP-server pattern used by Deck (PR #7734) and Spreed:
- run-federation.sh: creates a second NC instance under data/, configures both,
  starts two PHP built-in servers on :8080/:8280, runs Behat, then tears down
- FederationContext.php: OCS/Basic-Auth context with steps for server switching,
  user creation via occ, project creation, federated share/accept/reject/remove,
  pending-invitation polling with retry, and settings toggle helpers
- sharing.feature: send invite → pending invite appears → accept → project visible;
  also tests rejection path
- unshare.feature: host removes accepted share → remote loses access;
  host removes pending (never-accepted) share
- settings.feature: outgoing disabled blocks share creation (400);
  incoming disabled on remote causes OCM share to be refused (400)
- integration-federation.yml: GitHub Actions workflow (PHP 8.3, NC master, SQLite)
  mirroring the Deck federation CI workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PHPUnit\Framework\Assert was not found at runtime because phpunit was
missing from tests/integration/composer.json. Add it, and add a
.gitignore so the generated composer.lock and vendor/ are not tracked
(matching the pattern used by nextcloud/deck).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The PHP built-in web server returns 404 for virtual paths like
/.well-known/ocm and /ocm-provider, which breaks OCM discovery
when LOCAL tries to send a federated share to REMOTE.

Add router.php that routes virtual paths through index.php while
correctly forwarding real files and PATH_INFO paths (like
/ocs/v2.php/apps/...) to PHP's default handling.

Also add overwrite.cli.url on both instances so Nextcloud knows
its public URL when generating OCM share callbacks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Nextcloud's getRawPathInfo() uses SCRIPT_NAME to strip the script
path from REQUEST_URI. When the router script includes index.php
without overriding SCRIPT_NAME, getRawPathInfo() throws because
the router.php path doesn't match the request URI.

Set SCRIPT_NAME=/index.php before including index.php so Nextcloud
computes the path info correctly for well-known requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miaulalala miaulalala marked this pull request as ready for review May 20, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant