-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes: #94
- Loading branch information
Showing
6 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Install gem client before running the test | ||
SCENARIOS=("pulp" "performance" "azure" "gcp" "s3" "stream" "generate-bindings" "lowerbounds") | ||
if [[ " ${SCENARIOS[*]} " =~ " ${TEST} " ]]; then | ||
cmd_prefix dnf install -yq gem | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added support for pull-through caching. Add a remote to a distribution to enable this feature. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import pytest | ||
import subprocess | ||
from aiohttp.client_exceptions import ClientResponseError | ||
|
||
|
||
def test_pull_through_metadata( | ||
gem_remote_factory, | ||
gem_distribution_factory, | ||
gem_content_api_client, | ||
artifacts_api_client, | ||
http_get, | ||
): | ||
""" | ||
Test that pull-through caching can retrieve metadata files upstream, but does not save them. | ||
""" | ||
artifacts_before = artifacts_api_client.list().count | ||
content_before = gem_content_api_client.list().count | ||
|
||
# Choose a remote source that supports all the different gem repository metadata formats | ||
remote = gem_remote_factory(url="https://rubygems.org") | ||
distribution = gem_distribution_factory(remote=remote.pulp_href) | ||
|
||
urls = [ | ||
"info/pulp_file_client", | ||
"specs.4.8", | ||
"latest_specs.4.8", | ||
"prerelease_specs.4.8", | ||
"quick/Marshal.4.8/pulp_file_client-1.14.0.gemspec.rz", | ||
] | ||
for path in urls: | ||
url = distribution.base_url + path | ||
assert http_get(url) | ||
|
||
artifacts_after = artifacts_api_client.list().count | ||
content_after = gem_content_api_client.list().count | ||
|
||
assert artifacts_before == artifacts_after | ||
assert content_before == content_after | ||
|
||
with pytest.raises(ClientResponseError) as e: | ||
http_get(distribution.base_url + "NOT_A_VALID_LINK") | ||
|
||
assert e.value.status == 404 | ||
|
||
|
||
def test_pull_through_install( | ||
gem_remote_factory, gem_distribution_factory, gem_content_api_client, delete_orphans_pre | ||
): | ||
""" | ||
Test that gem clients can install from a distribution with pull-through caching. | ||
""" | ||
out = subprocess.run(("which", "gem")) | ||
if out.returncode != 0: | ||
pytest.skip("gem not installed on test machine") | ||
content_before = gem_content_api_client.list().count | ||
|
||
remote = gem_remote_factory(url="https://rubygems.org") | ||
distribution = gem_distribution_factory(remote=remote.pulp_href) | ||
|
||
remote2 = gem_remote_factory() | ||
distribution2 = gem_distribution_factory(remote=remote2.pulp_href) | ||
|
||
for dis, gem in zip((distribution, distribution2), ("a", "beryl")): | ||
cmd = ["gem", "i", "--remote", "--clear-sources", "-s", dis.base_url, gem, "-v", "0.1.0"] | ||
|
||
out = subprocess.run(cmd, stdout=subprocess.PIPE) | ||
assert f"Successfully installed {gem}-0.1.0" in out.stdout.decode("utf-8") | ||
|
||
r = gem_content_api_client.list(name=gem, version="0.1.0") | ||
assert r.count == 1 | ||
assert r.results[0].name == gem | ||
assert r.results[0].version == "0.1.0" | ||
|
||
subprocess.run(("gem", "uninstall", gem, "-v", "0.1.0")) | ||
|
||
content_after = gem_content_api_client.list().count | ||
assert content_before + 2 == content_after |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pulpcore>=3.25.0,<3.40 | ||
pulpcore>=3.28.0,<3.40 | ||
rubymarshal==1.0.3 |