test(e2e): run Playwright against an isolated Compose stand
This commit is contained in:
1 parent
7a5105acc7
commit
4cd7d060bd
23 files changed
+431
-41
No files matched your search
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "${POSTGRES_EXPORTER_USER:-}" && -z "${POSTGRES_EXPORTER_PASSWORD:-}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
: "${POSTGRES_EXPORTER_USER:?POSTGRES_EXPORTER_USER and POSTGRES_EXPORTER_PASSWORD must both be set}"
|
||||
: "${POSTGRES_EXPORTER_PASSWORD:?POSTGRES_EXPORTER_USER and POSTGRES_EXPORTER_PASSWORD must both be set}"
|
||||
|
||||
psql \
|
||||
--username "$POSTGRES_USER" \
|
||||
--dbname "$POSTGRES_DB" \
|
||||
--set=exporter_user="$POSTGRES_EXPORTER_USER" \
|
||||
--set=exporter_password="$POSTGRES_EXPORTER_PASSWORD" <<'SQL'
|
||||
SELECT format('CREATE ROLE %I LOGIN PASSWORD %L', :'exporter_user', :'exporter_password')
|
||||
WHERE NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = :'exporter_user')
|
||||
\gexec
|
||||
|
||||
GRANT pg_monitor TO :"exporter_user";
|
||||
SQL
|
||||
@@ -0,0 +1,38 @@
|
||||
-- Creates the optional PostgreSQL metrics login on first volume
|
||||
-- initialization. The image entrypoint runs *.sql files with psql
|
||||
-- (ON_ERROR_STOP=1, as POSTGRES_USER in POSTGRES_DB), independent of file
|
||||
-- mode, unlike *.sh files, which it executes or sources depending on the
|
||||
-- executable bit reported by the bind mount. \getenv needs psql 15 or newer.
|
||||
--
|
||||
-- Both credentials empty or unset: nothing happens. Exactly one set: the
|
||||
-- initialization fails. Both set: the role is created if missing and gets
|
||||
-- pg_monitor.
|
||||
|
||||
\getenv exporter_user POSTGRES_EXPORTER_USER
|
||||
\getenv exporter_password POSTGRES_EXPORTER_PASSWORD
|
||||
\if :{?exporter_user}
|
||||
\else
|
||||
\set exporter_user ''
|
||||
\endif
|
||||
\if :{?exporter_password}
|
||||
\else
|
||||
\set exporter_password ''
|
||||
\endif
|
||||
|
||||
SELECT :'exporter_user' <> '' AS has_exporter_user,
|
||||
:'exporter_password' <> '' AS has_exporter_password
|
||||
\gset
|
||||
|
||||
\if :has_exporter_user
|
||||
\if :has_exporter_password
|
||||
SELECT format('CREATE ROLE %I LOGIN PASSWORD %L', :'exporter_user', :'exporter_password')
|
||||
WHERE NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = :'exporter_user')
|
||||
\gexec
|
||||
|
||||
GRANT pg_monitor TO :"exporter_user";
|
||||
\else
|
||||
DO $$ BEGIN RAISE EXCEPTION 'POSTGRES_EXPORTER_USER and POSTGRES_EXPORTER_PASSWORD must both be set'; END $$;
|
||||
\endif
|
||||
\elif :has_exporter_password
|
||||
DO $$ BEGIN RAISE EXCEPTION 'POSTGRES_EXPORTER_USER and POSTGRES_EXPORTER_PASSWORD must both be set'; END $$;
|
||||
\endif
|
||||
Reference in new issue
Block a user