Commit Graph
4606 Commits
Author SHA1 Message Date
Wolfgang Walther 66d40c0159 nix(loadtest): merge jwt-rsa-* and jwt-hs-* tests
Instead of creating separate test suites for the key type, the PostgREST
instance now accepts both keys via a JWKSet and the targets are
generated 50/50 for both.

The results are still reported seperately by using a different URL,
which shows up as separate rows in the results.
2026-06-26 19:33:51 +00:00
Wolfgang Walther 2d340e8a8c nix(loadtest): refactor generate_jwt -> generate_target
This makes the next change easier to do, but should be easier to review
step-by-step.
2026-06-26 19:33:51 +00:00
Wolfgang Walther 94be1b7250 nix(loadtest): remove --rsa option from genTargets
The public key is not needed for target generation, only the private
key, so it's enough to pass that.
2026-06-26 19:33:51 +00:00
Wolfgang Walther b32c477b1d nix(loadtest): remove --method argument for JWT loadtests
This is not used by CI and I doubt it's actually used by anyone locally.
2026-06-26 19:33:51 +00:00
Wolfgang Walther e5eb98c8a0 nix(loadtest): fix postgrest-loadtest-report locally
The script currently depends on results from "head" and "main" to be
present to calculate the change ratio. Fallback nicely in case these are
not available, which allows using the same to report URL-by-URL stats
locally.
2026-06-26 19:33:51 +00:00
Taimoor ZaeemandWolfgang Walther bb63c3fade change: use RFC 9535 syntax for jwt-role-claim-key config
BREAKING CHANGE

Breaks the string comparison operators implemented in #3813. Those can
be replaced with regex searches using JSON Path `search()` function.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-26 18:32:05 +00:00
Wolfgang Walther a0bb87d693 nix(loadtest): fix cpu/mem monitoring for tests using libfaketime
Instead of starting a separate process, which would make the pid we
store the one from `faketime` instead of `postgrest`, we can also just
start libfaketime directly via LD_PRELOAD.
2026-06-26 18:30:25 +00:00
Wolfgang Walther ba9336f402 nix: change reference from master to main in README 2026-06-26 18:16:36 +02:00
Wolfgang Walther 5feb55a95b nix: remove PGRST_DELAY AND PGDELAY from README
These had been removed a while ago.
2026-06-26 18:16:25 +02:00
Taimoor Zaeem 67956b3cb1 refactor: log server listening observations after listening socket is ready
Correct behavior is to log this after the listening socket is ready.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-26 16:01:55 +05:00
renovate[bot]andWolfgang Walther a6840f9bf9 chore(deps): update actions/cache action to v6 2026-06-25 20:10:47 +00:00
Taimoor ZaeemandSteve Chavez 081c4c6d70 test(spec): sort imports in SpecHelper.hs
The imports were scattered all around. This commit
sorts and group them.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-25 11:21:28 -05:00
Taimoor ZaeemandSteve Chavez b5f10be167 test: move jwt cache tests from io tests to spec tests
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-25 11:21:28 -05:00
Taimoor ZaeemandSteve Chavez 0bc9fe813f test: move jwt iat claim test from io tests to spec tests
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-25 11:21:28 -05:00
Taimoor ZaeemandSteve Chavez feb4853273 test(io): add test for admin server listening observation
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-25 10:39:16 -05:00
Taimoor Zaeem 9e0f9bc4ee refactor: correct admin server port setting
For admin server, port server-setting was set to the same port as
app server port. This doesn't have any effect because it is overridden
by the already initialized admin server socket, but it's better to
explicitly correct it to avoid anything unexpected.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-23 23:05:02 +05:00
Taimoor Zaeem f5fd2e71b6 test: move jwt error tests from io tests to spec tests
Towards #4946.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-22 23:52:45 +05:00
Taimoor Zaeem ee30bd03ac test(io): remove needless server-timing config coverage tests
These 2 tests don't test any specific behavior - they were added
only to please code coverage.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-22 23:52:45 +05:00
Taimoor Zaeem 1a35af5024 test(spec): rename misleading function name in ErrorSpec.hs
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-22 23:52:45 +05:00
steve-chavez ded9be6774 nix(loadtest): add comment on loadtest-against 2026-06-22 12:55:56 -05:00
Wolfgang Walther ffe4cc6f42 nix(loadtest): allow running multiple postgrest-loadtest in same working directory
There is no need to store the out-links to the various build artifacts
in the current working directory while running postgrest-with-pg, which
is used by postgrest-loadtest. Instead reference the nix store paths
directly.

Resolves #5028
2026-06-21 12:56:42 +02:00
renovate[bot]andWolfgang Walther 79e9e77e46 chore(deps): update vmactions/freebsd-vm action to v1.4.8 2026-06-20 21:57:24 +00:00
renovate[bot]andWolfgang Walther 87b480bc0a chore(deps): update actions/checkout action to v7 2026-06-19 19:09:44 +00:00
renovate[bot]andWolfgang Walther 336d32d1ce chore(deps): update nixbuild/nix-quick-install-action action to v35 2026-06-19 19:09:02 +00:00
renovate[bot]andWolfgang Walther 9aef6f30a8 chore(deps): update vmactions/freebsd-vm action to v1.4.7 2026-06-19 19:08:17 +00:00
Taimoor ZaeemandSteve Chavez 242e5ba87e chore(cabal): explain performance related build flags
These flags were added in 9f97147cc3. Adding
a comment to clarify the use.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-17 14:15:45 -05:00
Michał KłeczekandTaimoor Zaeem 9f97147cc3 perf: add ghc 9.12 options -fexpose-overloaded-unfoldings -fspecialise-aggressively
Before 9.12.1 it was necessary to mark functions as INLINABLE or INLINE to make GHC consider cross-module specialization of polymorphic functions.
9.12 added a new -fexpose-overloaded-unfoldings flag that exposes optimized polymorphic functions in interface files. -fspecialise-aggressively then makes GHC apply aggresive specialization.
2026-06-17 13:13:48 +05:00
Taimoor ZaeemandSteve Chavez 9048332b0e test(io): clarify test names
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-16 13:13:51 -05:00
Taimoor ZaeemandSteve Chavez b6c12abf0e test: move http header related tests from io tests to spec tests
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-16 13:13:51 -05:00
Michał KłeczekandSteve Chavez 8fa26ee865 fix: Start listening after schema cache load
This change ensures PostgREST starts listening on a server socket only after it loaded the schema cache and is ready to handle requests. It is no longer going to return 503 errors during startup until the schema cache is loaded.
2026-06-16 12:30:51 -05:00
Michał KłeczekandWolfgang Walther fae6253932 refactor: make nextListenerDelay local to Listener module
Right now stateNextListenerDelay is only used in Listener module.
This change is a small refactoring moving nextListenerDelay to Listener to increase cohesion and decrease coupling.
2026-06-14 18:39:59 +00:00
Wolfgang Walther 2976eb047b add: support running admin server on unix socket
This is useful when multiple instances run on the same machine, for
example behind a proxy. Unix sockets for web and admin servers can then
be put in the same folder for each instance.

Can be helpful when writing tests as well.
2026-06-14 17:18:37 +00:00
Wolfgang Walther f24bc7092f test(io): fix UnboundLocalError
The `if response` check a few rows down would not actually work without
initializing the variable first. It'd throw:

```
E       UnboundLocalError: cannot access local variable 'response' where
it is not associated with a value
```
2026-06-14 17:18:37 +00:00
Wolfgang Walther 6d87fc5879 test(io): move some tests to unix sockets
No need to run these with TCP and freeport, I believe.
2026-06-14 17:18:37 +00:00
Michał KłeczekandSteve Chavez 54430c3a2c fix: Do not clear the schema cache during retries
retryingSchemaCacheLoad should not clear existing schema cache upon failure - there is no reason to do that. If there is a communication issue with the database server or db is down, clients are going to get 502 anyway. If it was a glitch when loading the schema cache - the clients are going to use old (stale) schema cache for some time until next retry re-loads it successfully.
2026-06-11 13:14:37 -05:00
Taimoor Zaeem e9a016670f Revert "add: string slicing operator for jwt-role-claim-key"
This reverts commit fe0386e9c4.

As discussed in https://github.com/PostgREST/postgrest/pull/4984#issuecomment-4652725178.
2026-06-11 23:07:05 +05:00
steve-chavez 1ebf480258 amend: required membership for postgrest_test_anonymous
Previous test correction required GRANTing membership for
postgrest_test_anonymous.
2026-06-11 12:00:02 -05:00
steve-chavez e7c8d70333 test: correct test_admin_ready_includes_schema_cache_state
There was an oversight on d556cea, `timeout_authenticator` doesn't have
any privileges on the tables so it shouldn't be making requests to the
API server or it will end up with 401 responses.
2026-06-11 11:51:14 -05:00
Wolfgang Walther 9097752888 ci(release): lowercase ghcr repo
ghcr does not support uppercase letters, which was not a problem when
testing in my fork. But the PostgREST org's name obviously has uppercase
letters in it, so we need to lowercase these for the ghcr namespace.
2026-06-10 14:18:12 +02:00
Wolfgang Walther 62503466a0 Revert "ci(ci): avoid running build jobs twice on pushes to main"
This reverts commit 840d3f99ed.

This was a nice idea in theory, but in practice this means that the
build jobs do not run at all on the default branch anymore. This means
the caches they push to won't be used by any other jobs, neither on the
tag pipelines, nor on PRs. This in turn makes all of these jobs really
slow.

Not helpful!
2026-06-10 14:04:59 +02:00
Wolfgang Walther 1560078ce2 ci: push container images to ghcr.io
Resolves #2836
2026-06-10 13:17:37 +02:00
Taimoor ZaeemandWolfgang Walther 8bde0ad474 test: move cors related tests from io tests to spec tests
Towards #4946.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-10 10:27:49 +00:00
Taimoor ZaeemandWolfgang Walther 21433d10c2 refactor(config): use correct data type for server-cors-allowed-origins
Replaces the `Maybe [Text]` with `[Text]`. The `Maybe` is unnecessary
because we handle `Just []` and `Nothing` the same way.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-09 12:35:47 +00:00
Wolfgang Walther 044d623424 ci(test): fail loadtest correctly
Previously this would only fail if *each* row had `:x:` in it, which was
never the case, because the header never has it. It is supposed to fail
when *at least one* row has an .
2026-06-09 12:35:25 +00:00
renovate[bot]andWolfgang Walther 0b5655b9d3 chore(deps): update codecov/codecov-action action to v7 2026-06-07 11:01:07 +00:00
steve-chavez 4df0654998 docs: add how-to for Query Identifier 2026-06-06 06:47:33 -05:00
steve-chavez ad790baefb test: explain verbose reveals query identifier
This also requires enabling shared_preload_libraries=pg_stat_statements.
Really we only need compute_query_id=on, but pg_stat_statements is
useful for other tests and it already enables compute_query_id (since
it's `auto` by default).
2026-06-06 06:47:33 -05:00
Wolfgang Walther cb6fc55a2d chore(deps): update nixpkgs, stackage and hackage pins 2026-06-05 20:29:48 +00:00
Wolfgang Walther b114bb9395 nix: replace silver-searcher with fd
The former has been removed from Nixpkgs and won't be available on the
next bump.
2026-06-05 20:29:48 +00:00
Taimoor ZaeemandSteve Chavez da8738b88e chore: add changelog entry for v14.13
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
2026-06-05 13:30:59 -05:00