Skip to content

Commit

Permalink
#114 Understanding the lock on deleted files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed Apr 22, 2024
1 parent ae58eb6 commit 16bee3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
3 changes: 2 additions & 1 deletion test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Tuple,
Union,
)
from exasol.bucketfs._shared import _build_url

import pytest
import requests
Expand All @@ -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
Expand Down
55 changes: 26 additions & 29 deletions test/integration/test_bucket_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand All @@ -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'
Expand All @@ -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)
)

0 comments on commit 16bee3f

Please sign in to comment.