From bfd670b9a7dcdbd8ecf0564775caf5422f85ce2a Mon Sep 17 00:00:00 2001 From: Alek Westover Date: Tue, 20 Jun 2023 21:24:51 -0400 Subject: [PATCH] fixed an issue with the wrong path --- alek/env.txt | 2 +- alek/test_ext.control | 2 +- alek/win.txt | 2 +- control_plane/src/bin/neon_local.rs | 2 +- .../regress/test_download_extensions.py | 27 +++++++++++++------ 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/alek/env.txt b/alek/env.txt index adaea2e185..ac0ed63fcb 100644 --- a/alek/env.txt +++ b/alek/env.txt @@ -1 +1 @@ -{'repo_dir': PosixPath('/home/alek/Desktop/neonX/test_output/test_file_download[debug-pg14]/repo'), 'rust_log_override': None, 'port_distributor': , 's3_mock_server': , 'neon_cli': , 'endpoints': , 'safekeepers': [Safekeeper(env=, port=SafekeeperPort(pg=15004, http=15005), id=1, running=True), Safekeeper(env=, port=SafekeeperPort(pg=15006, http=15007), id=2, running=True), Safekeeper(env=, port=SafekeeperPort(pg=15008, http=15009), id=3, running=True)], 'broker': NeonBroker(logfile=PosixPath('/home/alek/Desktop/neonX/test_output/test_file_download[debug-pg14]/repo/storage_broker.log'), port=15001, neon_binpath=PosixPath('/home/alek/Desktop/neonX/target/debug'), handle=), 'remote_storage': S3Storage(bucket_name='test_file_download', bucket_region='us-east-1', access_key='test', secret_key='test', endpoint='http://127.0.0.1:15000', prefix_in_bucket=None), 'remote_storage_users': , 'pg_version': '14', 'neon_binpath': PosixPath('/home/alek/Desktop/neonX/target/debug'), 'pg_distrib_dir': PosixPath('/home/alek/Desktop/neonX/pg_install'), 'endpoint_counter': 0, 'initial_tenant': `TenantId("15347163e7f9bb87079f0afbe58b2c5a"), 'initial_timeline': TimelineId("ac505335c89aa4e6c2e5b5660be3edd4"), 'pageserver': } \ No newline at end of file +{'repo_dir': PosixPath('/home/alek/Desktop/neonX/test_output/test_file_download[debug-pg14]/repo'), 'rust_log_override': None, 'port_distributor': , 's3_mock_server': , 'neon_cli': , 'endpoints': , 'safekeepers': [Safekeeper(env=, port=SafekeeperPort(pg=15004, http=15005), id=1, running=True), Safekeeper(env=, port=SafekeeperPort(pg=15006, http=15007), id=2, running=True), Safekeeper(env=, port=SafekeeperPort(pg=15008, http=15009), id=3, running=True)], 'broker': NeonBroker(logfile=PosixPath('/home/alek/Desktop/neonX/test_output/test_file_download[debug-pg14]/repo/storage_broker.log'), port=15001, neon_binpath=PosixPath('/home/alek/Desktop/neonX/target/debug'), handle=), 'remote_storage': S3Storage(bucket_name='test_file_download', bucket_region='us-east-1', access_key='test', secret_key='test', endpoint='http://127.0.0.1:15000', prefix_in_bucket=None), 'remote_storage_users': , 'pg_version': '14', 'neon_binpath': PosixPath('/home/alek/Desktop/neonX/target/debug'), 'pg_distrib_dir': PosixPath('/home/alek/Desktop/neonX/pg_install'), 'endpoint_counter': 0, 'initial_tenant': `TenantId("a44445be5a0a92eba8f870768ca18ae8"), 'initial_timeline': TimelineId("704923c28b34c445b3b4e2b75f468d00"), 'pageserver': } \ No newline at end of file diff --git a/alek/test_ext.control b/alek/test_ext.control index 771b4a6f21..7d9064cbbe 100644 --- a/alek/test_ext.control +++ b/alek/test_ext.control @@ -1,5 +1,5 @@ # mock extension -comment = 'Mock extension' +comment = 'This is a mock extension' default_version = '1.0' module_pathname = '$libdir/test_ext' relocatable = true diff --git a/alek/win.txt b/alek/win.txt index 745bda1b66..2888dba728 100644 --- a/alek/win.txt +++ b/alek/win.txt @@ -1 +1 @@ -[('neon_utils', '1.0', None, 'neon_utils - small useful functions'), ('pg_buffercache', '1.3', None, 'examine the shared buffer cache'), ('pageinspect', '1.9', None, 'inspect the contents of database pages at a low level'), ('neon', '1.0', None, 'cloud storage for PostgreSQL'), ('test_load', '1.0', None, 'Mock extension'), ('plpgsql', '1.0', '1.0', 'PL/pgSQL procedural language'), ('neon_test_utils', '1.0', None, 'helpers for neon testing and debugging'), ('pg_prewarm', '1.2', None, 'prewarm relation data'), ('hnsw', '0.1.0', None, 'hNsw index')] \ No newline at end of file +['neon_utils', 'pg_buffercache', 'pageinspect', 'neon', 'test_load', 'plpgsql', 'test_ext', 'neon_test_utils', 'pg_prewarm', 'hnsw'] \ No newline at end of file diff --git a/control_plane/src/bin/neon_local.rs b/control_plane/src/bin/neon_local.rs index e10ef69cb9..380fdbc87c 100644 --- a/control_plane/src/bin/neon_local.rs +++ b/control_plane/src/bin/neon_local.rs @@ -694,7 +694,7 @@ fn handle_endpoint(ep_match: &ArgMatches, env: &local_env::LocalEnv) -> Result<( .copied() .unwrap_or(false); - // TODO maybe this is the place + // TODO alek maybe this is the place to pass args if let Some(endpoint) = endpoint { match (&endpoint.mode, hot_standby) { (ComputeMode::Static(_), true) => { diff --git a/test_runner/regress/test_download_extensions.py b/test_runner/regress/test_download_extensions.py index 730e417932..914411732a 100644 --- a/test_runner/regress/test_download_extensions.py +++ b/test_runner/regress/test_download_extensions.py @@ -26,6 +26,7 @@ from fixtures.utils import wait_until from prometheus_client.samples import Sample import json +import requests def test_file_download(neon_env_builder: NeonEnvBuilder): @@ -57,9 +58,12 @@ def test_file_download(neon_env_builder: NeonEnvBuilder): resp = neon_env_builder.remote_storage_client.get_object( Bucket=neon_env_builder.remote_storage.bucket_name, Key=TEST_EXT_PATH ) + # UPDATE: this is the wrong place to install it response = resp["Body"] - with open("pg_install/v15/lib/test_ext.control", "wb") as f: - f.write(response.read()) + for pgres_version in ("v15", "v14"): + fname = f"pg_install/{pgres_version}/share/postgresql/extension/test_ext.control" + with open(fname, "wb") as f: + f.write(response.read()) tenant, _ = env.neon_cli.create_tenant() env.neon_cli.create_timeline("test_file_download", tenant_id=tenant) @@ -75,21 +79,28 @@ def test_file_download(neon_env_builder: NeonEnvBuilder): endpoint = env.endpoints.create_start( "test_file_download", tenant_id=tenant, remote_ext_config=remote_ext_config ) + + # step 5 attempt 2 + # TODO: I'm not even remotely confident this is the correct port + # response = requests.post("http://localhost:15000/extension_server/postgis-3.so") + # print(response) + with closing(endpoint.connect()) as conn: with conn.cursor() as cur: + # test query: insert some values and select them cur.execute("CREATE TABLE t(key int primary key, value text)") for i in range(100): cur.execute(f"insert into t values({i}, {2*i})") cur.execute("select * from t") - x = cur.fetchall() - log.info(x) + log.info(cur.fetchall()) - # TODO: we should see the test_ext extension here + # the real test query: check that test_ext is present cur.execute("SELECT * FROM pg_available_extensions") - x = cur.fetchall() + all_extensions = [x[0] for x in cur.fetchall()] with open("alek/win.txt", "w") as f: - f.write(str(x)) - log.info(x) + f.write(str(all_extensions)) + log.info(all_extensions) + assert "test_ext" in all_extensions endpoint.stop() env.pageserver.http_client().tenant_detach(tenant)