diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7462d6592..189a84fe2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -131,7 +131,7 @@ jobs: strategy: fail-fast: false matrix: - kind: ['mixed', 'jwt-cache', 'jwt-cache-worst'] + kind: ['mixed', 'jwt-cache'] name: Loadtest runs-on: ubuntu-24.04 steps: diff --git a/nix/tools/generate_targets.py b/nix/tools/generate_targets.py index 2c06df1c1..82d273da5 100644 --- a/nix/tools/generate_targets.py +++ b/nix/tools/generate_targets.py @@ -14,7 +14,6 @@ import time import argparse import random import jwcrypto.jwt as jwt -from typing import Optional from pathlib import Path URL = "http://postgrest" @@ -24,7 +23,6 @@ secret_key = "reallyreallyreallyreallyverysafe" def generate_target( now: int, - exp_inc: Optional[int], key: jwt.JWK, ) -> list[str]: """Generate a target using an HS256 or RS256 JWT""" @@ -33,9 +31,6 @@ def generate_target( "iat": now, } - if exp_inc is not None: - headers["exp"] = now + exp_inc - claims = { "role": "postgrest_test_author", } @@ -62,13 +57,6 @@ def main(): help="Path to write the generated files", type=Path, ) - parser.add_argument( - "--worst", - dest="worst", - action=argparse.BooleanOptionalAction, - default=False, - help="Generate worst case targets for a JWT cache", - ) args = parser.parse_args() @@ -98,27 +86,11 @@ def main(): lines = [] - # We want to ensure 401 Unauthorized responses don't happen during - # JWT validation, this can happen when the jwt `exp` is too short. - # At the same time, we want to ensure the `exp` is not too big, - # so expires will occur and postgREST needs to - # clean cached expired JWTs - if args.worst: - # estimated time it takes to run postgrest itself - run_postgrest_time = 2 - - for i in range(ntargets): - target = generate_target( - now, run_postgrest_time + i // 1000, rsa if i % 2 == 0 else hs - ) - lines.extend(target) - - else: - hs_targets = [generate_target(now, None, hs) for _ in range(nsamples)] - rsa_targets = [generate_target(now, None, rsa) for _ in range(nsamples)] - for i in range(ntargets): - target = random.choice(hs_targets if i % 2 == 0 else rsa_targets) - lines.extend(target) + hs_targets = [generate_target(now, hs) for _ in range(nsamples)] + rsa_targets = [generate_target(now, rsa) for _ in range(nsamples)] + for i in range(ntargets): + target = random.choice(hs_targets if i % 2 == 0 else rsa_targets) + lines.extend(target) with open(targets_path, "w") as f: f.write("\n".join(lines)) diff --git a/nix/tools/loadtest.nix b/nix/tools/loadtest.nix index 52cb8b9f0..d2edf7063 100644 --- a/nix/tools/loadtest.nix +++ b/nix/tools/loadtest.nix @@ -76,18 +76,6 @@ let ${runner} -lazy -targets gen_targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\"" ;; - jwt-cache-worst) - export PGRST_JWT_SECRET="@$_arg_testdir/gen_jwks.json" - - ${libfaketime}/bin/faketime '2000-01-01 00:00:00' ${genTargets} --worst "$_arg_testdir" - - # shellcheck disable=SC2145 - ${withTools.withPg} -f "$_arg_testdir"/fixtures.sql \ - ${withTools.withPgrst} --faketime '2000-01-01 00:00:00' -m "$_arg_monitor" \ - sh -c "cd \"$_arg_testdir\" && \ - ${runner} -lazy -targets gen_targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\"" - ;; - # here we sleep purposefully to check how much memory does the schema cache consume in the final report mixed) # shellcheck disable=SC2145