* Add database namespacing for unit tests
Background: Running `go test ./...` will run tests in different packages concurrently.
This can be stopped or limited by using `-p 1` (no concurrency). We want concurrency,
but this causes problems when running Postgres DBs in CI. The problem is that, in CI,
we have 1x postgres server exposing 1x postgres DB, which we wipe clean at the end of
each test via `defer close()`. When tests run concurrently, calls to `close()` will
delete data/tables which other tests are currently using, causing havoc.
Fix this by:
- Creating a database per package.
- Namespacing the database name by a hash of the current working directory (the directory containing those `_test.go` files)
This is exactly what SQLite does, quite unintentionally, via the use of `file:dendrite_test.db`,
which dumps the file into the current working directory which is the package running the tests,
hence deleting the file is safe when running concurrently.
* Linting
* Don't create the database in a txn
* dupe db is not an error
* syncapi: add more tests; fix more bugs
bugfixes:
- The postgres impl of TopologyTable.SelectEventIDsInRange did not use the provided txn
- The postgres impl of EventsTable.SelectEvents did not preserve the ordering of the input event IDs in the output events slice
- The sqlite impl of EventsTable.SelectEvents did not use a bulk `IN ($1)` query.
Added tests:
- `TestGetEventsInRangeWithTopologyToken`
- `TestOutputRoomEventsTable`
- `TestTopologyTable`
* -p 1 for now
* Add test infrastructure code for dendrite unit/integ tests
Start re-enabling some syncapi storage tests in the process.
* Linting
* Add postgres service to unit tests
* dendrite not syncv3
* Skip test which doesn't work
* Linting
* Add `jetstream.PrepareForTests`
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
* Upload Docker images for releases to both Docker Hub and GitHub Container Registry
* Build current images on `:main` tag
* Use Dendrite flow to trigger Docker flow for `:main`
* Tweaks
* Fix references to `env.GHCR_NAMESPACE`
* Initial test
* Move CI to GHA
* Naming
* Always report all linter issues
* Remove if true
* Test complement in different variations
* Try again
* Move Complement back after initial tests and readd timeout
Make linting fail further checks
Remove CodeQL
* Update and rename tests.yml to dendrite.yml
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
* Only include go-sqlite3 on the relevant binaries
* The driver name is always sqlite3 now
* Update to matrix-org/go-sqlite3-js@e537baa
* Add initial Wasm test harness
* Upgrade go-sqlite3-js
This fixes an error about semicolons in single statements.
* Add browser-like WebSocket API for testing
* Upgrade go-sqlite3-js
This upgrade includes printing panic messages next to stacks.
* Run for all PRs targeting any branch
* Use manual Node caching
* Temporarily run for all pushes
* Use npm ci instead of install
* Use HTTPS auth for repo packages
* Match path style from build.sh
* update utp
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
Squashed commit of the following:
commit 4a61aa711473deece2adf415cfd65501dbca63b2
Author: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Mon Jan 18 12:19:24 2021 +0000
Set back to matrixdotorg on published releases
commit 6d1ac53f2c0c9b30e1e70c0bb1559e1b8ec874a2
Author: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Mon Jan 18 11:55:28 2021 +0000
Rename
commit 258999f7fb7b655b3a02a06a7ea05e66fb7740fb
Author: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Mon Jan 18 11:52:26 2021 +0000
Refactor multi-stage builds
commit c7ab8e476939899571e7b5668860dec372b9b60f
Author: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Mon Jan 18 11:13:19 2021 +0000
Let's try this again
* Create docker-build-and-push.yml
* Switched to using official Docker buildx action
* Added comment to docker-build-and-push.yml
In case something needs to be tweaked in the future, the link
contains some examples and explanations which would be useful
* Run only on release (and produce release tags)
As this workflow takes quite a lot of time, and [pushing to master happens frequently](https://github.com/matrix-org/dendrite/pull/1613#issuecomment-746086980), the container will now only be built when a release is created, and the builds will also be correctly tagged.
* Add latest tag, test at neilalexander/dendrite*
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
* Replace all usages of txn.Stmt with sqlutil.TxStmt
Signed-off-by: Sam Day <me@samcday.com>
* Fix sign off link in PR template.
Signed-off-by: Sam Day <me@samcday.com>
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
* Use absolute links in pull request template
Relative links don't work in most places
Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Use matrix.to (for now) instead of linking to riot.im/develop
Signed-off-by: Aaron Raimist <aaron@raim.ist>