Skip to content

Commit

Permalink
fixup: cleanup and autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-psb committed Nov 26, 2024
1 parent 5d8a3e7 commit 5594395
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
1 change: 0 additions & 1 deletion pulp_file/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,3 @@ def _generate_server_and_remote(*, manifest_path, policy):
return server, remote

yield _generate_server_and_remote

1 change: 0 additions & 1 deletion pulp_file/tests/functional/api/test_acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
)



@pytest.mark.parallel
def test_acs_validation_and_update(
file_bindings,
Expand Down
34 changes: 10 additions & 24 deletions pulpcore/tests/functional/api/using_plugin/test_content_delivery.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
"""Tests related to content delivery."""

import hashlib
import random
import select
import subprocess
import uuid
from contextlib import contextmanager
from multiprocessing import Process, Queue
from urllib.parse import urljoin

import pytest
import requests
from aiohttp.client_exceptions import ClientPayloadError, ClientResponseError

from pulpcore.client.pulp_file import RepositorySyncURL
Expand Down Expand Up @@ -143,8 +138,7 @@ def test_remote_content_changed_with_on_demand(
download_file(get_url)

# Assert again with curl just to be sure.
result = subprocess.run(["curl", "-v", get_url],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = subprocess.run(["curl", "-v", get_url], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
assert result.returncode == 18
assert b"* Closing connection 0" in result.stderr
assert b"curl: (18) transfer closed with outstanding read data remaining" in result.stderr
Expand All @@ -160,7 +154,7 @@ def test_handling_remote_artifact_on_demand_streaming_failure(
monitor_task_group,
file_distribution_factory,
gen_object_with_cleanup,
generate_server_and_remote
generate_server_and_remote,
):
"""
GIVEN A content synced with on-demand which has 2 RemoteArtifacts (Remote + ACS).
Expand All @@ -175,12 +169,10 @@ def test_handling_remote_artifact_on_demand_streaming_failure(

# Plumbing
def create_simple_remote(manifest_path):
remote = file_remote_factory(
manifest_path=manifest_path, policy="on_demand")
remote = file_remote_factory(manifest_path=manifest_path, policy="on_demand")
body = RepositorySyncURL(remote=remote.pulp_href)
monitor_task(
file_bindings.RepositoriesFileApi.sync(
file_repo_with_auto_publish.pulp_href, body).task
file_bindings.RepositoriesFileApi.sync(file_repo_with_auto_publish.pulp_href, body).task
)
return remote

Expand All @@ -190,27 +182,22 @@ def create_acs_remote(manifest_path):
)
acs = gen_object_with_cleanup(
file_bindings.AcsFileApi,
{"remote": acs_remote.pulp_href,
"paths": [], "name": str(uuid.uuid4())},
{"remote": acs_remote.pulp_href, "paths": [], "name": str(uuid.uuid4())},
)
monitor_task_group(file_bindings.AcsFileApi.refresh(
acs.pulp_href).task_group)
monitor_task_group(file_bindings.AcsFileApi.refresh(acs.pulp_href).task_group)
return acs

def sync_publish_and_distribute(remote):
body = RepositorySyncURL(remote=remote.pulp_href)
monitor_task(
file_bindings.RepositoriesFileApi.sync(
file_repo_with_auto_publish.pulp_href, body).task
file_bindings.RepositoriesFileApi.sync(file_repo_with_auto_publish.pulp_href, body).task
)
repo = file_bindings.RepositoriesFileApi.read(
file_repo_with_auto_publish.pulp_href)
repo = file_bindings.RepositoriesFileApi.read(file_repo_with_auto_publish.pulp_href)
distribution = file_distribution_factory(repository=repo.pulp_href)
return distribution

def refresh_acs(acs):
monitor_task_group(file_bindings.AcsFileApi.refresh(
acs.pulp_href).task_group)
monitor_task_group(file_bindings.AcsFileApi.refresh(acs.pulp_href).task_group)
return acs

def get_original_content_info(remote):
Expand All @@ -225,8 +212,7 @@ def download_from_distribution(content, distribution):
return actual_checksum

# GIVEN
basic_manifest_path = write_3_iso_file_fixture_data_factory(
"basic", seed=123)
basic_manifest_path = write_3_iso_file_fixture_data_factory("basic", seed=123)
acs_manifest_path = write_3_iso_file_fixture_data_factory("acs", seed=123)
remote = create_simple_remote(basic_manifest_path)
distribution = sync_publish_and_distribute(remote)
Expand Down

0 comments on commit 5594395

Please sign in to comment.