mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-10-26 02:16:15 +03:00
CI: Test against PostgreSQL 16.
This changes our test configuration to use the PostgreSQL 16 image from `postgis/postgis`. In addition, it bumps PostGIS to v3.4 (from v3.3). PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10361 GitOrigin-RevId: 883c96d8453efb42b226f849891488382a99c80c
This commit is contained in:
parent
0ed57aa340
commit
cca591a7f9
@ -2,7 +2,7 @@ version: "3.6"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgis/postgis:15-3.3-alpine
|
||||
image: postgis/postgis:16-3.4-alpine
|
||||
platform: linux/amd64
|
||||
command:
|
||||
- -F # turn fsync off for speed
|
||||
|
@ -137,7 +137,7 @@ let
|
||||
freetdsWithODBC
|
||||
pkgs.libmysqlclient
|
||||
pkgs.mariadb
|
||||
pkgs.postgresql_15
|
||||
pkgs.postgresql_16
|
||||
unixODBC
|
||||
msodbcsql
|
||||
]
|
||||
|
@ -17,7 +17,7 @@ fi
|
||||
|
||||
PG_PASSWORD=postgres
|
||||
PG_VOLUME_NAME='hasura-dev-postgres'
|
||||
PG_CONTAINER_IMAGE='postgis/postgis:15-3.3-alpine'
|
||||
PG_CONTAINER_IMAGE='postgis/postgis:16-3.4-alpine'
|
||||
PG_CONTAINER_NAME="hasura-dev-postgres-$PG_PORT"
|
||||
PG_DB_URL="postgresql://postgres:$PG_PASSWORD@127.0.0.1:$PG_PORT/postgres"
|
||||
PG_DOCKER="docker exec -u postgres $PG_CONTAINER_NAME psql $PG_DB_URL"
|
||||
|
@ -47,7 +47,7 @@ dbContainer :: TC.Network -> TC.TestContainer Database
|
||||
dbContainer network = do
|
||||
container <-
|
||||
TC.run
|
||||
$ TC.containerRequest (TC.fromTag ("postgis/postgis:15-3.3-alpine"))
|
||||
$ TC.containerRequest (TC.fromTag ("postgis/postgis:16-3.4-alpine"))
|
||||
& TC.setSuffixedName "hge-test-upgrade-db"
|
||||
& TC.withNetwork network
|
||||
& TC.withNetworkAlias "db"
|
||||
|
@ -45,13 +45,12 @@ execPGDump ::
|
||||
PG.ConnInfo ->
|
||||
m BL.ByteString
|
||||
execPGDump b ci = do
|
||||
eOutput <- liftIO $ try execProcess
|
||||
output <- onLeft eOutput throwException
|
||||
onLeft output $ \err ->
|
||||
RTE.throw500 $ "error while executing pg_dump: " <> err
|
||||
eOutput <- liftIO $ try @IOException execProcess
|
||||
output <- eOutput `onLeft` (throwException "internal exception while executing pg_dump" . show)
|
||||
output `onLeft` throwException "error while executing pg_dump"
|
||||
where
|
||||
throwException :: (MonadError RTE.QErr m) => IOException -> m a
|
||||
throwException _ = RTE.throw500 "internal exception while executing pg_dump"
|
||||
throwException :: (MonadError RTE.QErr m, ToJSON e) => Text -> e -> m a
|
||||
throwException text err = throwError (RTE.err500 RTE.Unexpected text) {RTE.qeInternal = Just (RTE.ExtraInternal (toJSON err))}
|
||||
|
||||
execProcess = do
|
||||
(exitCode, stdOut, stdErr) <- readProcessWithExitCode "pg_dump" opts ""
|
||||
|
@ -1,12 +1,10 @@
|
||||
import pytest
|
||||
import os
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
yaml=YAML(typ='safe', pure=True)
|
||||
|
||||
@pytest.mark.usefixtures('per_method_tests_db_state')
|
||||
class TestPGDump:
|
||||
|
||||
def test_pg_dump_for_public_schema(self, hge_ctx):
|
||||
query_file = self.dir() + '/pg_dump_public.yaml'
|
||||
with open(query_file, 'r') as stream:
|
||||
@ -14,12 +12,10 @@ class TestPGDump:
|
||||
headers = q['headers'] or {}
|
||||
if hge_ctx.hge_key is not None:
|
||||
headers['x-hasura-admin-secret'] = hge_ctx.hge_key
|
||||
resp = hge_ctx.http.post(hge_ctx.hge_url + q['url'], json=q['query'], headers=headers)
|
||||
body = resp.text
|
||||
assert resp.status_code == q['status']
|
||||
print(body)
|
||||
print(q['expected_response'])
|
||||
assert body == q['expected_response']
|
||||
response = hge_ctx.http.post(hge_ctx.hge_url + q['url'], json=q['query'], headers=headers)
|
||||
body = response.text
|
||||
assert response.status_code == q['status'], f'Response body: {body}'
|
||||
assert body == q['expected_response'], f'Response body: {body}'
|
||||
|
||||
def test_pg_dump_for_public_schema_for_user_role(self, hge_ctx):
|
||||
query_file = self.dir() + '/pg_dump_public.yaml'
|
||||
|
Loading…
Reference in New Issue
Block a user