|
18 | 18 | from arcticdb_ext.storage import NoDataFoundException
|
19 | 19 |
|
20 | 20 | from arcticdb_ext import set_config_string
|
| 21 | +from arcticdb_ext.storage import KeyType |
21 | 22 | from arcticdb.util.test import create_df, assert_frame_equal
|
22 | 23 |
|
23 | 24 | from arcticdb.storage_fixtures.s3 import MotoNfsBackedS3StorageFixtureFactory
|
@@ -190,3 +191,40 @@ def test_wrapped_s3_storage(lib_name, wrapped_s3_storage_bucket):
|
190 | 191 | # There should be no problems after the failure simulation has been turned off
|
191 | 192 | lib.read("s")
|
192 | 193 | lib.write("s", data=create_df())
|
| 194 | + |
| 195 | + |
| 196 | +@pytest.fixture(scope="session") |
| 197 | +def test_prefix(): |
| 198 | + return "test_bucket_prefix" |
| 199 | + |
| 200 | + |
| 201 | +@pytest.fixture(scope="function", |
| 202 | + params=[MotoNfsBackedS3StorageFixtureFactory, |
| 203 | + MotoS3StorageFixtureFactory]) |
| 204 | +def storage_bucket(test_prefix, request): |
| 205 | + with request.param( |
| 206 | + use_ssl=False, |
| 207 | + ssl_test_support=False, |
| 208 | + bucket_versioning=False, |
| 209 | + default_prefix=test_prefix |
| 210 | + ) as factory: |
| 211 | + with factory.create_fixture() as bucket: |
| 212 | + yield bucket |
| 213 | + |
| 214 | + |
| 215 | +def test_library_get_key_path(lib_name, storage_bucket, test_prefix): |
| 216 | + lib = storage_bucket.create_version_store_factory(lib_name)() |
| 217 | + lib.write("s", data=create_df()) |
| 218 | + lib_tool = lib.library_tool() |
| 219 | + |
| 220 | + keys_count = 0 |
| 221 | + for key_type in KeyType.__members__.values(): |
| 222 | + keys = lib_tool.find_keys(key_type) |
| 223 | + keys_count += len(keys) |
| 224 | + for key in keys: |
| 225 | + path = lib_tool.get_key_path(key) |
| 226 | + assert path != "" |
| 227 | + assert path.startswith(test_prefix) |
| 228 | + |
| 229 | + assert keys_count > 0 |
| 230 | + |
0 commit comments