diff --git a/src/PostgREST/AppState.hs b/src/PostgREST/AppState.hs index 50c8b006ed..7f4ac565ce 100644 --- a/src/PostgREST/AppState.hs +++ b/src/PostgREST/AppState.hs @@ -273,6 +273,7 @@ internalConnectionWorker appState = work where work = do AppConfig{..} <- getConfig appState + logWithZTime appState $ "Starting PostgREST " <> T.decodeUtf8 prettyVersion <> "..." logWithZTime appState "Attempting to connect to the database..." connected <- establishConnection appState case connected of diff --git a/test/io/postgrest.py b/test/io/postgrest.py index 0dccb41b6e..90babd7cbd 100644 --- a/test/io/postgrest.py +++ b/test/io/postgrest.py @@ -64,6 +64,7 @@ def run( host=None, wait_for_readiness=True, no_pool_connection_available=False, + no_startup_stdout=True, ): "Run PostgREST and yield an endpoint that is ready for connections." @@ -104,7 +105,8 @@ def run( if wait_for_readiness: wait_until_ready(adminurl + "/ready") - process.stdout.read() + if no_startup_stdout: + process.stdout.read() if no_pool_connection_available: sleep_pool_connection(baseurl, 10) diff --git a/test/io/test_io.py b/test/io/test_io.py index da6e5eb573..ff4538f5c5 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -1039,3 +1039,15 @@ def test_get_pgrst_version_with_keyval_connection_string(defaultenv): "postgrest/", "PostgREST " ) assert response.text == version + + +def test_log_postgrest_version(defaultenv): + "Should show the PostgREST version in the logs" + + with run(env=defaultenv, no_startup_stdout=False) as postgrest: + version = postgrest.session.head("/").headers["Server"].split("/")[1] + + assert ( + "Starting PostgREST %s..." % version + in postgrest.process.stdout.readline().decode() + )