fixed an issue with the wrong path

This commit is contained in:
Alek Westover
2023-06-20 21:24:51 -04:00
parent 5e96ab43ea
commit bfd670b9a7
5 changed files with 23 additions and 12 deletions

View File

@@ -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)