Skip to content

Commit

Permalink
Add test to run extension installcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Oct 17, 2024
1 parent 98ee56d commit f2d7c15
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/test_server_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import httpx
from edgedb import errors

import edb
from edb import buildmeta
from edb import protocol
from edb.common import devmode
from edb.protocol import protocol as edb_protocol # type: ignore
Expand Down Expand Up @@ -1506,3 +1508,38 @@ def reload_server(self):
json.dump(self.conf, self.conf_file.file)
self.conf_file.file.flush()
self.srv.proc.send_signal(signal.SIGHUP)


class TestPGExtensions(tb.TestCase):
async def test_edb_stat_statements(self):
ext_home = (
pathlib.Path(edb.__file__).parent.parent / 'edb_stat_statements'
).resolve()
if not ext_home.exists():
raise unittest.SkipTest("no source of edb_stat_statements")
with tempfile.TemporaryDirectory() as td:
cluster = await pgcluster.get_local_pg_cluster(td, log_level='s')
cluster.update_connection_params(
user='postgres',
database='template1',
)
self.assertTrue(await cluster.ensure_initialized())
await cluster.start(server_settings={
'edb_stat_statements.track_planning': 'false',
'max_prepared_transactions': '5',
})
try:
pg_config = buildmeta.get_pg_config_path()
env = os.environ.copy()
params = cluster.get_pgaddr()
env['PGHOST'] = params.host
env['PGPORT'] = params.port
env['PGUSER'] = params.user
env['PGDATABASE'] = params.database
subprocess.check_output([
'make',
f'PG_CONFIG={pg_config}',
'installcheck',
], cwd=str(ext_home), env=env)
finally:
await cluster.stop()

0 comments on commit f2d7c15

Please sign in to comment.