Skip to content

Conversation

@MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Jan 23, 2026

Add in-repo Complement tests. This is useful so we can test Synapse specific behaviors like our admin API.

Complement calls these "out-of-repo" tests but it's a bit of a misnomer once they're in your project.

There has been previous desire for this kind of thing but this is spawning from wanting to have some tests for our purge history admin API. There are some Sytest tests (matrix-org/sytest -> tests/48admin.pl#L91-L618) for this already but I'd much rather work in Complement instead of Sytest. I'm wanting these tests to ensure that our new event-cache rust app for Synapse Pro doesn't break these kind of erasure features (https://github.com/element-hq/synapse-rust-apps/issues/366 and https://github.com/element-hq/synapse-rust-apps/issues/153).

Interestingly, there is already matrix-org/complement -> tests/csapi/admin_test.go (added in matrix-org/complement#322) in the Complement repo iteslf that tests the /_synapse/admin/v1/send_server_notice endpoint but it's a bit of an interesting case as Dendrite also supports this endpoint. I don't think it's good practice to continually shove in more and more Synapse-specific behavior into the Complement repo itself.

We already have success with other out-of-repo tests for projects like the SBG, TI-Messenger Proxy, and our Synapse Pro for small hosts.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

env:
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
TEST_ONLY_IGNORE_POETRY_LOCKFILE: 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just aligning to what we already do in .github/workflows/tests.yml

The difference is the TEST_ONLY_IGNORE_POETRY_LOCKFILE here

env:
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
TEST_ONLY_SKIP_DEP_HASH_VERIFICATION: 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just aligning to what we already do in .github/workflows/tests.yml

The difference is the TEST_ONLY_SKIP_DEP_HASH_VERIFICATION here

Comment on lines +733 to +734
- name: Run in-repo Complement Tests
id: run_in_repo_complement_tests
Copy link
Contributor Author

@MadLittleMods MadLittleMods Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new CI step to to run the in-repo Complement tests

Same as other step but we have --in-repo. I wish there was a way to just run everything as a single command/step but it doesn't seem very possible since any kind of finagling the tests together results in directory ... outside main module or its selected dependencies

enable:
- gofmt
- goimports
- golines
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/element-hq/synapse/actions/runs/21303838770/job/61327615707?pr=19406
```
+++ dirname synapse/scripts-dev/complement.sh
++ realpath synapse/scripts-dev/../complement
realpath: synapse/scripts-dev/../complement: No such file or directory
+ in_repo_test_suite=
```
@MadLittleMods MadLittleMods marked this pull request as ready for review January 24, 2026 00:29
@MadLittleMods MadLittleMods requested a review from a team as a code owner January 24, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants