Skip to content

Commit 1d2e429

Browse files
nix(loadtest): move errors into mixed
Because we separate loadtest results per URL now, we can move the error tests into the regular mixed bag of loadtests - we will be able to tell from the misspelled URLs when we hit a regression in that area. We should be able to do similar things for JWT tests, but we'll need more infrastructure here.
1 parent 3727859 commit 1d2e429

6 files changed

Lines changed: 27 additions & 35 deletions

File tree

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
strategy:
128128
fail-fast: false
129129
matrix:
130-
kind: ['mixed', 'errors', 'jwt-hs', 'jwt-hs-cache', 'jwt-hs-cache-worst', 'jwt-rsa', 'jwt-rsa-cache', 'jwt-rsa-cache-worst']
130+
kind: ['mixed', 'jwt-hs', 'jwt-hs-cache', 'jwt-hs-cache-worst', 'jwt-rsa', 'jwt-rsa-cache', 'jwt-rsa-cache-worst']
131131
name: Loadtest
132132
runs-on: ubuntu-24.04
133133
steps:

nix/tools/loadtest.nix

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let
4646
"ARG_OPTIONAL_SINGLE([testdir], [t], [Directory to load tests and fixtures from], [./test/load])"
4747
"ARG_OPTIONAL_SINGLE([kind], [k], [Kind of loadtest], [mixed])"
4848
"ARG_OPTIONAL_SINGLE([method],, [HTTP method used for the jwt loadtests], [OPTIONS])"
49-
"ARG_TYPE_GROUP_SET([KIND], [KIND], [kind], [mixed,errors,jwt-hs,jwt-hs-cache,jwt-hs-cache-worst,jwt-rsa,jwt-rsa-cache,jwt-rsa-cache-worst])"
49+
"ARG_TYPE_GROUP_SET([KIND], [KIND], [kind], [mixed,jwt-hs,jwt-hs-cache,jwt-hs-cache-worst,jwt-rsa,jwt-rsa-cache,jwt-rsa-cache-worst])"
5050
"ARG_TYPE_GROUP_SET([METHOD], [METHOD], [method], [OPTIONS,GET])"
5151
"ARG_OPTIONAL_SINGLE([monitor], [m], [Monitoring file], [./loadtest/result.csv])"
5252
"ARG_LEFTOVERS([additional vegeta arguments])"
@@ -139,27 +139,19 @@ let
139139
${runner} -lazy -targets gen_targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\""
140140
;;
141141
142+
# here we sleep purposefully to check how much memory does the schema cache consume in the final report
142143
mixed)
143144
# shellcheck disable=SC2145
144145
${withTools.withPg} -f "$_arg_testdir"/fixtures.sql \
145-
${withTools.withPgrst} -m "$_arg_monitor" \
146-
sh -c "cd \"$_arg_testdir\" && \
147-
${runner} -targets targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\""
148-
;;
149-
150-
# here we sleep purposefully to check how much memory does the schema cache consume in the final report
151-
errors)
152-
# shellcheck disable=SC2145
153-
${withTools.withPg} -f "$_arg_testdir"/errors.sql \
154146
${withTools.withPgrst} --timeout 2 --sleep 5 -m "$_arg_monitor" \
155147
sh -c "cd \"$_arg_testdir\" && \
156-
${runner} -targets errors.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\""
148+
${runner} -targets targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\""
157149
;;
158150
esac
159151
160152
${vegeta}/bin/vegeta report -type=text "$_arg_output"
161153
162-
if [ "$_arg_kind" != "errors" ]; then
154+
if [ "$_arg_kind" != "mixed" ]; then
163155
# fail in case 401 happened on jwt loadtests
164156
unauthorized_count="$(${vegeta}/bin/vegeta report -type=json "$_arg_output" \
165157
| ${jq}/bin/jq -r '.status_codes["401"] // 0')"

test/load/errors.http

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/load/errors.sql

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/load/fixtures.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,9 @@ REVOKE ALL PRIVILEGES ON TABLE
4949
FROM postgrest_test_anonymous;
5050

5151
GRANT ALL ON TABLE authors_only TO postgrest_test_author;
52+
53+
SELECT format('CREATE TABLE test.actors_%s ();', n)
54+
FROM generate_series(1, 450) n -- 500 is the upper limit for table not found error hint generation
55+
\gexec
56+
57+
-- TODO add many function for fuzzy search (somehow this is making the loadtest start slow)

test/load/targets.http

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ POST http://postgrest/rpc/call_me
3333
@rpc.json
3434

3535
OPTIONS http://postgrest/actors
36+
37+
# Misspelled relations
38+
GET http://postgrest/actoxs?actor=eq.1
39+
Prefer: tx=commit
40+
41+
# Misspelled relations on embeds
42+
GET http://postgrest/actors?select=*,rolws(*,films(*))
43+
Prefer: tx=commit
44+
45+
# Misspelled function names
46+
GET http://postgrest/rpc/call_me_x?name=John
47+
Prefer: tx=commit
48+
49+
# Permission denied errors
50+
GET http://postgrest/actors_1
51+
Prefer: tx=commit

0 commit comments

Comments
 (0)