Display an actual TCP port app is bound to (#3034)

This commit is contained in:
Andrei Dziahel
2023-11-23 18:17:16 -05:00
committed by GitHub
parent 1c60b50e2e
commit df97a5071f
10 changed files with 152 additions and 143 deletions
+7
View File
@@ -197,6 +197,13 @@ def test_flush_pool_no_interrupt(defaultenv):
t.join()
def test_random_port_bound(defaultenv):
"PostgREST should bind to a random port when PGRST_SERVER_PORT is 0."
with run(env=defaultenv, port="0") as postgrest:
assert True # liveness check is done by run(), so we just need to check that it doesn't fail
def test_app_settings_reload(tmp_path, defaultenv):
"App settings should be reloaded from file when PostgREST is sent SIGUSR2."
config = (CONFIGSDIR / "sigusr2-settings.config").read_text()
+3 -2
View File
@@ -74,11 +74,12 @@ main = do
-- cached schema cache so most tests run fast
baseSchemaCache <- loadSchemaCache pool testCfg
sockets <- AppState.initSockets testCfg
let
-- For tests that run with the same refSchemaCache
app config = do
appState <- AppState.initWithPool pool config
appState <- AppState.initWithPool sockets pool config
AppState.putPgVersion appState actualPgVersion
AppState.putSchemaCache appState (Just baseSchemaCache)
return ((), postgrest config appState $ pure ())
@@ -86,7 +87,7 @@ main = do
-- For tests that run with a different SchemaCache(depends on configSchemas)
appDbs config = do
customSchemaCache <- loadSchemaCache pool config
appState <- AppState.initWithPool pool config
appState <- AppState.initWithPool sockets pool config
AppState.putPgVersion appState actualPgVersion
AppState.putSchemaCache appState (Just customSchemaCache)
return ((), postgrest config appState $ pure ())