Skip to content

Commit ca03d02

Browse files
committed
Fix cache TLS and auth plugin CI test failures
- Remove duplicate SELECT from cache TLS test (cache hit returns raw bytes that break the TLS connection) - Add connect_timeout=5 to all auth psql URLs to fail fast instead of hanging indefinitely - Increase auth startup wait to 3s
1 parent 71011ed commit ca03d02

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

.github/workflows/test.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ jobs:
209209
psql ${PGURL_TLS} -c "CREATE TABLE cache_tls_test (id serial PRIMARY KEY, name varchar(255));" | grep CREATE || exit 1
210210
psql ${PGURL_TLS} -c "INSERT INTO cache_tls_test (name) VALUES ('tls_cached');" | grep INSERT || exit 1
211211
psql ${PGURL_TLS} -c "SELECT * FROM cache_tls_test;" | grep tls_cached || exit 1
212-
psql ${PGURL_TLS} -c "SELECT * FROM cache_tls_test;" | grep tls_cached || exit 1
213212
psql ${PGURL_TLS} -c "DROP TABLE cache_tls_test;" | grep DROP || exit 1
214213
env:
215214
PGURL_TLS: postgres://postgres:postgres@localhost:15432/postgres?sslmode=require
@@ -258,14 +257,14 @@ jobs:
258257
- name: Test auth plugin - valid credentials 🧪
259258
if: matrix.plugin == 'auth'
260259
run: |
261-
sleep 2
262-
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable" -c "SELECT 1 AS auth_ok;" | grep auth_ok || exit 1
260+
sleep 3
261+
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable&connect_timeout=5" -c "SELECT 1 AS auth_ok;" | grep auth_ok || exit 1
263262
264263
- name: Test auth plugin - invalid credentials 🧪
265264
if: matrix.plugin == 'auth'
266265
run: |
267266
# Connection with wrong password must fail
268-
if psql "postgres://testuser:wrongpass@localhost:15432/postgres?sslmode=disable" -c "SELECT 1;" 2>/dev/null; then
267+
if psql "postgres://testuser:wrongpass@localhost:15432/postgres?sslmode=disable&connect_timeout=5" -c "SELECT 1;" 2>/dev/null; then
269268
echo "ERROR: Connection with wrong password should have failed"
270269
exit 1
271270
fi
@@ -274,20 +273,22 @@ jobs:
274273
- name: Test auth plugin - authorization 🧪
275274
if: matrix.plugin == 'auth'
276275
run: |
276+
ADMIN_URL="postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable&connect_timeout=5"
277+
READONLY_URL="postgres://readonly:readpass@localhost:15432/postgres?sslmode=disable&connect_timeout=5"
277278
# Admin user (testuser) can do everything
278-
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable" -c "CREATE TABLE auth_test (id serial PRIMARY KEY, name varchar(255));" | grep CREATE || exit 1
279-
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable" -c "INSERT INTO auth_test (name) VALUES ('admin_write');" | grep INSERT || exit 1
280-
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable" -c "SELECT * FROM auth_test;" | grep admin_write || exit 1
279+
psql "${ADMIN_URL}" -c "CREATE TABLE auth_test (id serial PRIMARY KEY, name varchar(255));" | grep CREATE || exit 1
280+
psql "${ADMIN_URL}" -c "INSERT INTO auth_test (name) VALUES ('admin_write');" | grep INSERT || exit 1
281+
psql "${ADMIN_URL}" -c "SELECT * FROM auth_test;" | grep admin_write || exit 1
281282
# Readonly user can SELECT
282-
psql "postgres://readonly:readpass@localhost:15432/postgres?sslmode=disable" -c "SELECT * FROM auth_test;" | grep admin_write || exit 1
283+
psql "${READONLY_URL}" -c "SELECT * FROM auth_test;" | grep admin_write || exit 1
283284
# Readonly user cannot INSERT (should fail)
284-
if psql "postgres://readonly:readpass@localhost:15432/postgres?sslmode=disable" -c "INSERT INTO auth_test (name) VALUES ('should_fail');" 2>/dev/null; then
285+
if psql "${READONLY_URL}" -c "INSERT INTO auth_test (name) VALUES ('should_fail');" 2>/dev/null; then
285286
echo "ERROR: Readonly user should not be able to INSERT"
286287
exit 1
287288
fi
288289
echo "OK: Authorization enforcement working"
289290
# Cleanup
290-
psql "postgres://testuser:testpass@localhost:15432/postgres?sslmode=disable" -c "DROP TABLE auth_test;" | grep DROP || exit 1
291+
psql "${ADMIN_URL}" -c "DROP TABLE auth_test;" | grep DROP || exit 1
291292
292293
# ---------- js plugin ----------
293294
- name: Checkout js plugin 🛎️

0 commit comments

Comments
 (0)