diff --git a/.github/workflows/test-base.yml b/.github/workflows/test-base.yml index 39ea91f78f..4fe20c5424 100644 --- a/.github/workflows/test-base.yml +++ b/.github/workflows/test-base.yml @@ -39,10 +39,6 @@ jobs: PGPASSWORD: postgres PGHOST: localhost PGVERSION: ${{ matrix.postgres-version}} - ROOT_DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres - TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/graphileengine_test - TEST_PG_URL: postgres://postgres:postgres@localhost:5432/postgraphile_test - LDS_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/lds_test TEST_SIMPLIFY_DATABASE_URL: postgres://postgres:postgres@localhost:5432/pg_simplify_inflectors TERM: xterm FORCE_COLOR: 1 diff --git a/grafast/dataplan-pg/scripts/runExampleSchema.mjs b/grafast/dataplan-pg/scripts/runExampleSchema.mjs index 59761c7419..28491c7971 100755 --- a/grafast/dataplan-pg/scripts/runExampleSchema.mjs +++ b/grafast/dataplan-pg/scripts/runExampleSchema.mjs @@ -12,8 +12,13 @@ import JSON5 from "json5"; import { schema } from "./exampleSchemaExport.mjs"; -const connectionString = - process.env.TEST_DATABASE_URL || "postgres:///graphile_crystal"; +const databaseName = "graphilecrystaltest"; +const host = process.env.PGHOST ?? "localhost"; +const connectionString = host.includes("/") + ? `socket://graphilecrystaltest:test@${host}?db=${encodeURIComponent( + databaseName, + )}` + : `postgres://graphilecrystaltest:test@${host}/${databaseName}`; const pgService = makePgService({ connectionString }); const preset = { plugins: [PgContextPlugin], diff --git a/grafast/dataplan-pg/serve-example-schema.js b/grafast/dataplan-pg/serve-example-schema.js index 7a249830b9..8d577d62ea 100644 --- a/grafast/dataplan-pg/serve-example-schema.js +++ b/grafast/dataplan-pg/serve-example-schema.js @@ -5,8 +5,7 @@ const { createWithPgClient } = require("./dist/adaptors/pg"); const schema = makeExampleSchema(); const withPgClient = createWithPgClient({ - connectionString: - process.env.TEST_DATABASE_URL || "postgres:///graphile_crystal", + connectionString: "postgres:///graphilecrystaltest", }); const serv = grafserv({ preset: { grafast: { context: { withPgClient }, explain: true } }, diff --git a/scripts/pretest b/scripts/pretest index 6a8466deb4..9d770d13db 100755 --- a/scripts/pretest +++ b/scripts/pretest @@ -11,6 +11,7 @@ fi; SERVER_VERSION_NUM=$(psql -XAqtv ON_ERROR_STOP=1 -d "${OWNER_DATABASE:-postgres}" -c "show server_version_num;") +psql -Xqv ON_ERROR_STOP=1 -d "${OWNER_DATABASE:-postgres}" -c "drop database graphilecrystaltest;" || true for DBNAME in $(psql -XAqtv ON_ERROR_STOP=1 -d "${OWNER_DATABASE:-postgres}" -c "select datname from pg_database where datname like 'gctestdb_%' and datname = format('%I', datname);"); do echo "DEL $DBNAME" psql -Xqv ON_ERROR_STOP=1 -d "${OWNER_DATABASE:-postgres}" -c "drop database $DBNAME;" @@ -57,5 +58,7 @@ PGPASSWORD=test psql -Xqv ON_ERROR_STOP=1 -d "graphilecrystaltest_template" -U g #HERE #psql -X1v ON_ERROR_STOP=1 -v VERBOSITY=verbose -d lds_test -f utils/lds/__tests__/schema.sql +psql -Xqv ON_ERROR_STOP=1 -d "${OWNER_DATABASE:-postgres}" -c "create database graphilecrystaltest with template = graphilecrystaltest_template owner = graphilecrystaltest;" + clear echo "Database reset successfully ✅"