Skip to content

Commit

Permalink
Allow core/<3.70.
Browse files Browse the repository at this point in the history
fixes #3620.

(cherry picked from commit 1c36b39)
  • Loading branch information
ggainey authored and dralley committed Jun 21, 2024
1 parent 777fc84 commit e3e96ea
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 82 deletions.
1 change: 1 addition & 0 deletions CHANGES/3620.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Declared compatibility against pulpcore<3.70.
8 changes: 4 additions & 4 deletions pulp_rpm/tests/functional/api/test_character_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@


def test_upload_non_ascii(
tmp_path, artifacts_api_client, rpm_package_api, monitor_task, delete_orphans_pre
tmp_path, pulpcore_bindings, rpm_package_api, monitor_task, delete_orphans_pre
):
"""Test whether one can upload an RPM with non-ascii metadata."""
temp_file = tmp_path / str(uuid.uuid4())
temp_file.write_bytes(requests.get(RPM_WITH_NON_ASCII_URL).content)
artifact = artifacts_api_client.create(temp_file)
artifact = pulpcore_bindings.ArtifactsApi.create(temp_file)
response = rpm_package_api.create(
artifact=artifact.pulp_href,
relative_path=RPM_WITH_NON_ASCII_NAME,
Expand All @@ -39,12 +39,12 @@ def test_upload_non_ascii(


def test_upload_non_utf8(
tmp_path, artifacts_api_client, rpm_package_api, monitor_task, delete_orphans_pre
tmp_path, pulpcore_bindings, rpm_package_api, monitor_task, delete_orphans_pre
):
"""Test whether an exception is raised when non-utf-8 is uploaded."""
temp_file = tmp_path / str(uuid.uuid4())
temp_file.write_bytes(requests.get(RPM_WITH_NON_UTF_8_URL).content)
artifact = artifacts_api_client.create(temp_file)
artifact = pulpcore_bindings.ArtifactsApi.create(temp_file)
with pytest.raises(PulpTaskError) as ctx:
response = rpm_package_api.create(
artifact=artifact.pulp_href,
Expand Down
8 changes: 4 additions & 4 deletions pulp_rpm/tests/functional/api/test_consume_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ def test_package_manager_consume(
dnf_config_add_repo,
dnf_install_rpm,
create_distribution,
artifacts_api_client,
pulpcore_bindings,
delete_orphans_pre,
):
"""Verify whether package manager can consume content from Pulp."""
before_sync_artifact_count = artifacts_api_client.list().count
before_sync_artifact_count = pulpcore_bindings.ArtifactsApi.list().count

autopublish = sync_policy != "mirror_complete"
distribution = create_distribution(
Expand All @@ -126,7 +126,7 @@ def test_package_manager_consume(
sync_policy=sync_policy,
)

before_consumption_artifact_count = artifacts_api_client.list().count
before_consumption_artifact_count = pulpcore_bindings.ArtifactsApi.list().count
# sync=mirror_complete creates new Artifacts for the metadata even w/ on_demand & streamed
# sync!=mirror_complete sets autopublish=True so new Artifacts will also be created
assert before_consumption_artifact_count > before_sync_artifact_count
Expand All @@ -144,7 +144,7 @@ def test_package_manager_consume(
)
assert rpm_name == rpm[0]

after_consumption_artifact_count = artifacts_api_client.list().count
after_consumption_artifact_count = pulpcore_bindings.ArtifactsApi.list().count
if policy == "immediate" or policy == "streamed":
assert before_consumption_artifact_count == after_consumption_artifact_count
elif policy == "on_demand":
Expand Down
6 changes: 3 additions & 3 deletions pulp_rpm/tests/functional/api/test_distribution_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def test_remove_repo_with_distribution_tree(
init_and_sync,
rpm_repository_api,
rpm_content_distribution_trees_api,
orphans_cleanup_api_client,
pulpcore_bindings,
monitor_task,
):
"""Sync repository with distribution tree and remove the repository."""
response = orphans_cleanup_api_client.cleanup({"orphan_protection_time": 0})
response = pulpcore_bindings.OrphansCleanupApi.cleanup({"orphan_protection_time": 0})
monitor_task(response.task)

num_repos_start = rpm_repository_api.list().count
Expand All @@ -159,6 +159,6 @@ def test_remove_repo_with_distribution_tree(

assert rpm_repository_api.list().count == num_repos_start
# Remove orphans and check if distribution tree was removed.
response = orphans_cleanup_api_client.cleanup({"orphan_protection_time": 0})
response = pulpcore_bindings.OrphansCleanupApi.cleanup({"orphan_protection_time": 0})
monitor_task(response.task)
assert rpm_content_distribution_trees_api.list().count == num_disttrees_start
35 changes: 17 additions & 18 deletions pulp_rpm/tests/functional/api/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


def test_domain_create(
domains_api_client,
pulpcore_bindings,
gen_object_with_cleanup,
monitor_task,
rpm_package_api,
Expand All @@ -34,7 +34,7 @@ def test_domain_create(
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)
domain_name = domain.name

# create and sync in default domain (not specified)
Expand All @@ -53,7 +53,7 @@ def test_domain_create(

def test_domain_sync(
cleanup_domains,
domains_api_client,
pulpcore_bindings,
gen_object_with_cleanup,
monitor_task,
rpm_advisory_api,
Expand All @@ -72,7 +72,7 @@ def test_domain_sync(
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)
domain_name = domain.name

# create and sync in the newly-created domain
Expand Down Expand Up @@ -130,15 +130,15 @@ def test_domain_sync(

@pytest.mark.parallel
def test_object_creation(
domains_api_client, gen_object_with_cleanup, rpm_repository_api, rpm_rpmremote_api
pulpcore_bindings, gen_object_with_cleanup, rpm_repository_api, rpm_rpmremote_api
):
"""Test basic object creation in a separate domain."""
body = {
"name": str(uuid.uuid4()),
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)
domain_name = domain.name

repo_body = {"name": str(uuid.uuid4())}
Expand Down Expand Up @@ -175,35 +175,34 @@ def test_object_creation(

@pytest.mark.parallel
def test_artifact_from_file(
domains_api_client,
pulpcore_bindings,
gen_object_with_cleanup,
rpm_artifact_factory,
artifacts_api_client,
):
"""Test uploading artifacts in separate domains."""
body = {
"name": str(uuid.uuid4()),
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain1 = gen_object_with_cleanup(domains_api_client, body)
domain1 = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)

body = {
"name": str(uuid.uuid4()),
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain2 = gen_object_with_cleanup(domains_api_client, body)
domain2 = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)

# Create as-artifact in domain1
domain1_artifact = rpm_artifact_factory(pulp_domain=domain1.name)
artifacts = artifacts_api_client.list(pulp_domain=domain1.name)
artifacts = pulpcore_bindings.ArtifactsApi.list(pulp_domain=domain1.name)
assert artifacts.count == 1
assert domain1_artifact.pulp_href == artifacts.results[0].pulp_href

# Create as-artifact in domain2
domain2_artifact = rpm_artifact_factory(pulp_domain=domain2.name)
artifacts = artifacts_api_client.list(pulp_domain=domain2.name)
artifacts = pulpcore_bindings.ArtifactsApi.list(pulp_domain=domain2.name)
assert artifacts.count == 1
assert domain2_artifact.pulp_href == artifacts.results[0].pulp_href

Expand All @@ -225,7 +224,7 @@ def test_artifact_from_file(
@pytest.mark.parallel
def test_rpm_from_file(
cleanup_domains,
domains_api_client,
pulpcore_bindings,
rpm_package_factory,
gen_object_with_cleanup,
rpm_package_api,
Expand All @@ -236,7 +235,7 @@ def test_rpm_from_file(
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)

try:
default_content = rpm_package_factory()
Expand All @@ -253,7 +252,7 @@ def test_rpm_from_file(
@pytest.mark.parallel
def test_content_promotion(
cleanup_domains,
domains_api_client,
pulpcore_bindings,
download_content_unit,
rpm_repository_api,
rpm_rpmremote_factory,
Expand All @@ -268,7 +267,7 @@ def test_content_promotion(
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)

try:
# Sync task
Expand Down Expand Up @@ -314,15 +313,15 @@ def test_content_promotion(

@pytest.mark.parallel
def test_domain_rbac(
cleanup_domains, domains_api_client, gen_user, gen_object_with_cleanup, rpm_repository_api
cleanup_domains, pulpcore_bindings, gen_user, gen_object_with_cleanup, rpm_repository_api
):
"""Test domain level-roles."""
body = {
"name": str(uuid.uuid4()),
"storage_class": "pulpcore.app.models.storage.FileSystem",
"storage_settings": {"MEDIA_ROOT": "/var/lib/pulp/media/"},
}
domain = gen_object_with_cleanup(domains_api_client, body)
domain = gen_object_with_cleanup(pulpcore_bindings.DomainsApi, body)

try:
rpm_viewer = "rpm.rpmrepository_viewer"
Expand Down
Loading

0 comments on commit e3e96ea

Please sign in to comment.