From ebe503e6f84d95fe957101d8cbac0f80ef4b4116 Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Tue, 27 Jun 2023 16:46:03 +0300 Subject: [PATCH] Test cleanup --- compute_tools/src/compute.rs | 13 +++++++----- .../regress/test_download_extensions.py | 21 +++++++++++-------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index a6d12df172..df4bd2e2b4 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -695,11 +695,14 @@ LIMIT 100", } // TODO write a proper test for this - libs_vec.push("test_ext1".to_string()); - info!( - "shared_preload_libraries extra settings set to {:?}", - libs_vec - ); + // Currently pytest doesn't pass cluster settings to compute_ctl + // We need to add this to pytest. + // + // libs_vec.push("test_lib1".to_string()); + // info!( + // "shared_preload_libraries extra settings set to {:?}", + // libs_vec + // ); // download extension control files & shared_preload_libraries let rt = tokio::runtime::Runtime::new().unwrap(); diff --git a/test_runner/regress/test_download_extensions.py b/test_runner/regress/test_download_extensions.py index 84e5259113..e5876da6e6 100644 --- a/test_runner/regress/test_download_extensions.py +++ b/test_runner/regress/test_download_extensions.py @@ -9,7 +9,6 @@ from fixtures.neon_fixtures import ( NeonEnvBuilder, PgBin, RemoteStorageKind, - available_remote_storages, ) from fixtures.pg_version import PgVersion from fixtures.types import TenantId @@ -53,7 +52,7 @@ def prepare_mock_ext_storage( PUB_LIB_ROOT = f"v{pg_version}/lib" PRIVATE_LIB_ROOT = f"v{pg_version}/{private_prefix}/lib" - LOCAL_LIB_ROOT = pg_bin.pg_lib_dir + LOCAL_LIB_ROOT = f"{pg_bin.pg_lib_dir}/postgresql" log.info( f""" @@ -102,6 +101,7 @@ def prepare_mock_ext_storage( cleanup_files += [test_sql_local_path] # upload some fake library files + # TODO change it to test both public and private library paths for i in range(2): lib_filename = f"test_lib{i}.so" TEST_LIB_PATH = f"{PUB_LIB_ROOT}/{lib_filename}" @@ -118,8 +118,7 @@ def prepare_mock_ext_storage( lib_public_remote_path, ) log.info(f"lib_local_path: {lib_local_path}") - # TODO - # cleanup_files += [lib_local_path] + cleanup_files += [lib_local_path] return cleanup_files @@ -130,7 +129,10 @@ def prepare_mock_ext_storage( # Then check that compute nodes can download them and use them # to CREATE EXTENSION and LOAD 'library.so' # -@pytest.mark.parametrize("remote_storage_kind", available_remote_storages()) +# NOTE: you must have appropriate AWS credentials to run REAL_S3 test. +@pytest.mark.parametrize( + "remote_storage_kind", [RemoteStorageKind.MOCK_S3, RemoteStorageKind.REAL_S3] +) def test_remote_extensions( neon_env_builder: NeonEnvBuilder, remote_storage_kind: RemoteStorageKind, @@ -226,11 +228,12 @@ def test_remote_extensions( try: cur.execute("LOAD 'test_lib_fail.so'") except Exception as e: - # expected to fail with - # could not load library ... test_lib_fail.so: file too short - # because test_lib_fail.so is not real library file + # expected to fail because test_lib_fail.so is not found log.info("LOAD test_lib_fail.so failed (expectedly): %s", e) - assert "could not load library" in str(e) + assert ( + """could not access file "test_lib_fail.so": No such file or directory""" + in str(e) + ) finally: # this is important because if the files aren't cleaned up then the test can