Skip to content

Commit

Permalink
test: Improve io test perfomance
Browse files Browse the repository at this point in the history
Local test improves performance by 15%.
  • Loading branch information
wolfgangwalther committed Jan 4, 2022
1 parent 06933fd commit c9a6007
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 15 deletions.
3 changes: 0 additions & 3 deletions test/io-tests/configs/app-settings.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
db-pool = 1
db-pool-timeout = 1

app.settings.external_api_secret = "0123456789abcdef"
db-config = false
2 changes: 0 additions & 2 deletions test/io-tests/configs/base64-secret-from-file.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
db-pool = 1

# Read secret from a file: /dev/stdin (alias for standard input)
jwt-secret = "@/dev/stdin"
jwt-secret-is-base64 = true
Expand Down
1 change: 0 additions & 1 deletion test/io-tests/configs/dburi-from-file.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
db-uri = "@/dev/stdin"
db-pool = 1
jwt-secret = "reallyreallyreallyreallyverysafe"
db-config = false
1 change: 0 additions & 1 deletion test/io-tests/configs/role-claim-key.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
db-pool = 1
jwt-role-claim-key = "$(ROLE_CLAIM_KEY)"
jwt-secret = "reallyreallyreallyreallyverysafe"
db-config = false
2 changes: 0 additions & 2 deletions test/io-tests/configs/secret-from-file.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
db-pool = 1

# Read secret from a file: /dev/stdin (alias for standard input)
jwt-secret = "@/dev/stdin"
jwt-secret-is-base64 = false
Expand Down
2 changes: 0 additions & 2 deletions test/io-tests/configs/sigusr2-settings-external-secret.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
db-pool = 1

jwt-secret = "$(JWT_SECRET_FILE)"
jwt-secret-is-base64 = false
db-config = false
1 change: 0 additions & 1 deletion test/io-tests/configs/sigusr2-settings.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
db-schemas = "public"
db-pool = 1

app.settings.name_var = "John"
jwt-secret = "invalidinvalidinvalidinvalidinvalid"
Expand Down
1 change: 0 additions & 1 deletion test/io-tests/configs/simple.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
db-pool = 1
jwt-secret = "reallyreallyreallyreallyverysafe"
db-config = false
6 changes: 4 additions & 2 deletions test/io-tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def dumpconfig(configpath=None, env=None, stdin=None):
def run(configpath=None, stdin=None, env=None, port=None, adminport=None):
"Run PostgREST and yield an endpoint that is ready for connections."
env = env or {}
env["PGRST_DB_POOL"] = "1"
env["PGRST_DB_POOL_TIMEOUT"] = "1"

with tempfile.TemporaryDirectory() as tmpdir:
if port:
Expand Down Expand Up @@ -465,7 +467,7 @@ def test_iat_claim(defaultenv):
response = postgrest.session.get("/authors_only", headers=headers)
assert response.status_code == 200

time.sleep(0.5)
time.sleep(0.1)


def test_app_settings(defaultenv):
Expand Down Expand Up @@ -621,7 +623,7 @@ def test_db_schema_notify_reload(defaultenv):
"/rpc/change_db_schema_and_full_reload", data={"schemas": "v1"}
)

time.sleep(0.5)
time.sleep(0.1)

response = postgrest.session.get("/rpc/get_guc_value?name=search_path")
assert response.text == '"v1, public"'
Expand Down

0 comments on commit c9a6007

Please sign in to comment.