From 16bee3fe6f444662f0316e323a609887c215186a Mon Sep 17 00:00:00 2001 From: mibe Date: Mon, 22 Apr 2024 18:10:45 +0100 Subject: [PATCH] #114 Understanding the lock on deleted files. --- test/integration/conftest.py | 3 +- test/integration/test_bucket_path.py | 55 +++++++++++++--------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/test/integration/conftest.py b/test/integration/conftest.py index 99a0ed57..01691c8b 100644 --- a/test/integration/conftest.py +++ b/test/integration/conftest.py @@ -7,6 +7,7 @@ Tuple, Union, ) +from exasol.bucketfs._shared import _build_url import pytest import requests @@ -32,7 +33,7 @@ def delete_file( service: str, bucket: str, username: str, password: str, filename: str ) -> Tuple[str, str]: auth = HTTPBasicAuth(username, password) - url = f"{service.rstrip('/')}/{bucket}/{filename}" + url = _build_url(service_url=service, bucket=bucket, path=filename) response = requests.delete(url, auth=auth) response.raise_for_status() return filename, url diff --git a/test/integration/test_bucket_path.py b/test/integration/test_bucket_path.py index 03ed13ce..114a969b 100644 --- a/test/integration/test_bucket_path.py +++ b/test/integration/test_bucket_path.py @@ -35,7 +35,7 @@ def _collect_all_names(path: PathLike) -> set[str]: def test_write_read_back_onprem(test_config, children_poem): - base_path = build_path(system=SystemType.onprem, url=test_config.url, + base_path = build_path(system=SystemType.onprem, url=test_config.url, verify_ca=False, username=test_config.username, password=test_config.password) file_name = 'my_poems/children/little_star.txt' poem_path = base_path / file_name @@ -46,20 +46,19 @@ def test_write_read_back_onprem(test_config, children_poem): assert data_back == children_poem finally: # cleanup - pass - # delete_file( - # test_config.url, - # 'default', - # test_config.username, - # test_config.password, - # file_name - # ) + delete_file( + test_config.url, + 'default', + test_config.username, + test_config.password, + file_name + ) def test_write_list_files_onprem(test_config, children_poem, classic_poem): base_path = build_path(system=SystemType.onprem, url=test_config.url, path='my_poems', - username=test_config.username, password=test_config.password) + verify_ca=False, username=test_config.username, password=test_config.password) poem_path1 = base_path / 'children/little_star.txt' poem_path2 = base_path / 'classic/highlands.txt' @@ -70,20 +69,19 @@ def test_write_list_files_onprem(test_config, children_poem, classic_poem): assert _collect_all_names(base_path) == expected_names finally: # cleanup - pass - # for poem_path in [poem_path1, poem_path2]: - # delete_file( - # test_config.url, - # 'default', - # test_config.username, - # test_config.password, - # str(poem_path) - # ) + for poem_path in [poem_path1, poem_path2]: + delete_file( + test_config.url, + 'default', + test_config.username, + test_config.password, + str(poem_path) + ) def test_write_delete_onprem(test_config, children_poem, classic_poem): - base_path = build_path(system=SystemType.onprem, url=test_config.url, + base_path = build_path(system=SystemType.onprem, url=test_config.url, verify_ca=False, username=test_config.username, password=test_config.password) poems_root = base_path / 'my_poems' poem_path1 = poems_root / 'children/little_star.txt' @@ -97,12 +95,11 @@ def test_write_delete_onprem(test_config, children_poem, classic_poem): assert _collect_all_names(poems_root) == expected_names finally: # cleanup - pass - # for poem_path in [poem_path1, poem_path2]: - # delete_file( - # test_config.url, - # 'default', - # test_config.username, - # test_config.password, - # str(poem_path) - # ) + for poem_path in [poem_path1, poem_path2]: + delete_file( + test_config.url, + 'default', + test_config.username, + test_config.password, + str(poem_path) + )