Skip to content

Commit

Permalink
Fixup: be more explicit about overwriting files in remote server fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-psb committed Nov 21, 2024
1 parent 1b43d4b commit 9fe9421
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
10 changes: 0 additions & 10 deletions pulp_file/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ def basic_manifest_path(write_3_iso_file_fixture_data_factory):
return write_3_iso_file_fixture_data_factory("basic")


@pytest.fixture
def basic_manifest_path_overwrite(write_3_iso_file_fixture_data_factory):
"""After the first call, subsequent calls to build will overwrite the fixture content."""

def build():
return write_3_iso_file_fixture_data_factory("basic", overwrite=True)

return build


@pytest.fixture
def copy_manifest_only_factory(file_fixtures_root):
def _copy_manifest_only(name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ def test_remote_artifact_url_update(

@pytest.mark.parallel
def test_remote_content_changed_with_on_demand(
basic_manifest_path_overwrite,
write_3_iso_file_fixture_data_factory,
file_repo_with_auto_publish,
file_remote_ssl_factory,
file_bindings,
basic_manifest_path,
monitor_task,
file_distribution_factory,
):
Expand All @@ -122,7 +121,8 @@ def test_remote_content_changed_with_on_demand(
Then:
3. Get fileA from content app will cause a connection-close/incomplete-response.
"""
# Create a remote that points to a repository that only has the manifest, but no content
# Create a remote that points to a file repository with 3 iso files
basic_manifest_path = write_3_iso_file_fixture_data_factory("basic")
remote = file_remote_ssl_factory(manifest_path=basic_manifest_path, policy="on_demand")

# Sync from the remote
Expand All @@ -138,8 +138,8 @@ def test_remote_content_changed_with_on_demand(
# Download the manifest from the remote
expected_file_list = list(get_files_in_manifest(remote.url))

# Overwrite files in remote_server (change digest but keep name)
basic_manifest_path_overwrite()
# Overwrite the 3 iso files to have different content/digest
write_3_iso_file_fixture_data_factory("basic", overwrite=True)

# Assert response is incomplete
get_url = urljoin(distribution.base_url, expected_file_list[0][0])
Expand Down

0 comments on commit 9fe9421

Please sign in to comment.