Skip to content

Commit c19cdd3

Browse files
authored
Release 4.9.1 (#2047)
* bump to 4.9.1 * include test namespace changes from master * pin pytest-django<8 * pin pytest<8 No-Issue
1 parent ed857eb commit c19cdd3

File tree

9 files changed

+93
-94
lines changed

9 files changed

+93
-94
lines changed

CHANGES.rst

+13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ Changelog
1313

1414
.. towncrier release notes start
1515
16+
4.9.1 (2024-01-30)
17+
==================
18+
19+
Bugfixes
20+
--------
21+
22+
- bump pulp_ansible to enable re-upload of deleted collection version
23+
`AAH-2588 <https://issues.redhat.com/browse/AAH-2588>`_
24+
25+
26+
----
27+
28+
1629
4.9.0 (2023-12-06)
1730
==================
1831

CHANGES/2588.bugfix

-1
This file was deleted.

galaxy_ng/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
sys.modules.setdefault("automated_logging", automated_logging)
55

6-
__version__ = "4.9.0"
6+
__version__ = "4.9.1"
77

88
default_app_config = "galaxy_ng.app.PulpGalaxyPluginAppConfig"

galaxy_ng/app/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class PulpGalaxyPluginAppConfig(PulpPluginAppConfig):
66

77
name = "galaxy_ng.app"
88
label = "galaxy"
9-
version = "4.9.0"
9+
version = "4.9.1"
1010
python_package_name = "galaxy-ng"
1111

1212
def ready(self):

galaxy_ng/tests/integration/api/test_namespace_management.py

+62-88
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
33
See: https://issues.redhat.com/browse/AAH-1303
44
55
"""
6+
from time import sleep
7+
68
import pytest
9+
710
from ansible.errors import AnsibleError
811

12+
from galaxykit.repositories import search_collection
13+
14+
from ..utils.repo_management_utils import upload_new_artifact
15+
from ..utils.iqe_utils import is_stage_environment
916
from ..utils import (
10-
build_collection as galaxy_build_collection,
1117
get_all_namespaces,
1218
get_client,
1319
generate_unused_namespace,
14-
wait_for_all_tasks,
15-
wait_for_task,
1620
)
1721

22+
from ..utils.tasks import wait_for_all_tasks_gk
23+
from ..utils.tools import generate_random_string
24+
1825

1926
pytestmark = pytest.mark.qa # noqa: F821
2027

@@ -173,46 +180,40 @@ def test_namespace_edit_with_user(ansible_config, user_property):
173180

174181
@pytest.mark.namespace
175182
@pytest.mark.all
176-
def test_namespace_edit_logo(ansible_config):
177-
178-
config = ansible_config("admin")
179-
api_client = get_client(config, request_token=True, require_auth=True)
180-
api_prefix = config.get("api_prefix").rstrip("/")
181-
182-
new_namespace = generate_unused_namespace(api_client=api_client)
183-
183+
def test_namespace_edit_logo(galaxy_client):
184+
gc = galaxy_client("admin")
185+
new_namespace = f"ns_test_{generate_random_string()}"
184186
payload = {
185187
'name': new_namespace,
186188
}
187-
my_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/', args=payload, method='POST')
189+
my_namespace = gc.post("_ui/v1/my-namespaces/", body=payload)
188190
assert my_namespace["avatar_url"] == ''
189191

190-
namespaces = api_client(f'{api_prefix}/_ui/v1/my-namespaces/')
191-
192+
namespaces = gc.get('_ui/v1/my-namespaces/')
192193
name = my_namespace["name"]
193194

194195
payload = {
195196
"name": name,
196-
"avatar_url": "http://placekitten.com/400/400"
197+
# "avatar_url": "http://placekitten.com/400/400"
198+
"avatar_url": "https://avatars.githubusercontent.com/u/1869705?v=4"
197199
}
198-
api_client(f'{api_prefix}/_ui/v1/my-namespaces/{name}/', args=payload, method='PUT')
199-
200-
wait_for_all_tasks(api_client)
201-
updated_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/{name}/')
200+
gc.put(f"_ui/v1/my-namespaces/{name}/", body=payload)
201+
wait_for_all_tasks_gk(gc)
202+
updated_namespace = gc.get(f'_ui/v1/my-namespaces/{name}/')
202203
assert updated_namespace["avatar_url"] != ""
203204

204205
payload = {
205206
"name": name,
206-
"avatar_url": "http://placekitten.com/123/456"
207+
# "avatar_url": "http://placekitten.com/123/456"
208+
"avatar_url": "https://avatars.githubusercontent.com/u/481677?v=4"
207209
}
208-
resp = api_client(f'{api_prefix}/_ui/v1/my-namespaces/{name}/', args=payload, method='PUT')
209-
210-
wait_for_all_tasks(api_client)
211-
updated_again_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/{name}/')
210+
gc.put(f"_ui/v1/my-namespaces/{name}/", body=payload)
211+
wait_for_all_tasks_gk(gc)
212+
updated_again_namespace = gc.get(f"_ui/v1/my-namespaces/{name}/")
212213
assert updated_namespace["avatar_url"] != updated_again_namespace["avatar_url"]
213214

214215
# verify no additional namespaces are created
215-
resp = api_client(f'{api_prefix}/_ui/v1/my-namespaces/')
216+
resp = gc.get("_ui/v1/my-namespaces/")
216217
assert resp["meta"]["count"] == namespaces["meta"]["count"]
217218

218219
# verify no side effects
@@ -225,65 +226,47 @@ def test_namespace_edit_logo(ansible_config):
225226
assert my_namespace[field] != updated_again_namespace[field]
226227

227228

228-
def _test_namespace_logo_propagates_to_collections(ansible_config, upload_artifact, is_insights):
229-
admin_config = ansible_config("admin")
230-
api_prefix = admin_config.get("api_prefix").rstrip("/")
231-
api_client = get_client(admin_config, request_token=True, require_auth=True)
232-
233-
namespace_name = generate_unused_namespace(api_client=api_client)
234-
235-
# create empty namespace
229+
def _test_namespace_logo_propagates_to_collections(galaxy_client, is_insights):
230+
gc = galaxy_client("admin")
231+
namespace_name = f"ns_test_{generate_random_string()}"
236232
payload = {
237233
'name': namespace_name
238234
}
239-
my_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/', args=payload, method='POST')
240-
wait_for_all_tasks(api_client)
235+
my_namespace = gc.post("_ui/v1/my-namespaces/", body=payload)
241236
assert my_namespace["avatar_url"] == ''
242237
assert my_namespace["avatar_sha256"] is None
243238
assert my_namespace["metadata_sha256"] is not None
244239

245-
artifact = galaxy_build_collection(namespace=namespace_name)
240+
artifact = upload_new_artifact(
241+
gc, namespace_name, "published", "1.0.1", tags=["application"]
242+
)
243+
if is_stage_environment():
244+
sleep(90)
246245

247-
# upload collection to namespace
248-
upload_task = upload_artifact(admin_config, api_client, artifact)
249-
resp = wait_for_task(api_client, upload_task)
250-
assert resp["state"] == "completed"
246+
resp = search_collection(gc, namespace=namespace_name, name=artifact.name)
251247

252-
# verify cv index is correct
253-
search_url = (
254-
api_prefix
255-
+ '/v3/plugin/ansible/search/collection-versions/'
256-
+ f'?namespace={namespace_name}&name={artifact.name}'
257-
)
258-
resp = api_client.request(search_url)
259248
assert resp['data'][0]['namespace_metadata']["avatar_url"] is None
260249

261250
# upload logo to namespace
262251
payload = {
263252
"name": namespace_name,
264-
"avatar_url": "http://placekitten.com/123/456"
253+
# "avatar_url": "http://placekitten.com/123/456"
254+
"avatar_url": "https://avatars.githubusercontent.com/u/1869705?v=4"
265255
}
266-
api_client(f'{api_prefix}/_ui/v1/my-namespaces/{namespace_name}/', args=payload, method='PUT')
267-
wait_for_all_tasks(api_client)
256+
gc.put(f"_ui/v1/my-namespaces/{namespace_name}/", body=payload)
257+
if is_stage_environment():
258+
sleep(90)
259+
wait_for_all_tasks_gk(gc)
268260

269261
# namespace logo was updated correctly
270-
my_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/{namespace_name}/')
262+
my_namespace = gc.get(f'_ui/v1/my-namespaces/{namespace_name}/')
271263
assert my_namespace["avatar_url"] is not None
272264

273-
search_url = (
274-
api_prefix
275-
+ '/v3/plugin/ansible/search/collection-versions/'
276-
+ f'?namespace={namespace_name}&name={artifact.name}'
277-
)
278-
resp = api_client(search_url)
265+
resp = search_collection(gc, namespace=namespace_name, name=artifact.name)
279266
cv_namespace_metadata = resp['data'][0]['namespace_metadata']
280-
281-
namespace_metadata = api_client(
282-
api_prefix
283-
+ '/pulp/api/v3/content/ansible/namespaces/'
284-
f'?name={namespace_name}&ordering=-pulp_created'
285-
)['results'][0]
286-
267+
resp = gc.get(f"pulp/api/v3/content/ansible/namespaces/"
268+
f"?name={namespace_name}&ordering=-pulp_created")
269+
namespace_metadata = resp['results'][0]
287270
# verify that collection is using latest namespace avatar
288271
assert cv_namespace_metadata['avatar_url'] == namespace_metadata['avatar_url']
289272

@@ -300,36 +283,27 @@ def _test_namespace_logo_propagates_to_collections(ansible_config, upload_artifa
300283
"name": namespace_name,
301284
"description": "hehe hihi haha",
302285
"company": "RedHat Inc.",
303-
"avatar_url": "http://placekitten.com/654/321"
286+
# "avatar_url": "http://placekitten.com/654/321"
287+
"avatar_url": "https://avatars.githubusercontent.com/u/481677?v=4"
304288
}
305-
api_client(
306-
f'{api_prefix}/_ui/v1/my-namespaces/{namespace_name}/',
307-
args=payload,
308-
method='PUT'
309-
)
289+
gc.put(f"_ui/v1/my-namespaces/{namespace_name}/", body=payload)
290+
if is_stage_environment():
291+
sleep(90)
310292
assert my_namespace["avatar_sha256"] is not None
311293
assert my_namespace["metadata_sha256"] is not None
312-
wait_for_all_tasks(api_client)
294+
wait_for_all_tasks_gk(gc)
313295

314-
my_namespace = api_client(f'{api_prefix}/_ui/v1/my-namespaces/{namespace_name}/')
296+
my_namespace = gc.get(f'_ui/v1/my-namespaces/{namespace_name}/')
315297

316298
# verify cv metadata are latest and correct
317-
search_url = (
318-
api_prefix
319-
+ '/v3/plugin/ansible/search/collection-versions/'
320-
+ f'?namespace={namespace_name}&name={artifact.name}'
321-
)
322-
resp = api_client(search_url)
299+
resp = search_collection(gc, namespace=namespace_name, name=artifact.name)
323300
cv_namespace_metadata = resp['data'][0]['namespace_metadata']
324301
assert cv_namespace_metadata["description"] == "hehe hihi haha"
325302
assert cv_namespace_metadata["company"] == "RedHat Inc."
326303

327-
namespace_metadata = api_client(
328-
api_prefix
329-
+ '/pulp/api/v3/content/ansible/namespaces/'
330-
f'?name={namespace_name}&ordering=-pulp_created'
331-
)['results'][0]
332-
304+
resp = gc.get(f"pulp/api/v3/content/ansible/namespaces/"
305+
f"?name={namespace_name}&ordering=-pulp_created")
306+
namespace_metadata = resp["results"][0]
333307
# verify cv idnex is using latest matedata
334308
assert cv_namespace_metadata['avatar_url'] == namespace_metadata['avatar_url']
335309

@@ -340,11 +314,11 @@ def _test_namespace_logo_propagates_to_collections(ansible_config, upload_artifa
340314
@pytest.mark.namespace
341315
@pytest.mark.deployment_community
342316
@pytest.mark.deployment_standalone
343-
def test_namespace_logo_propagates_to_collections(ansible_config, upload_artifact):
344-
_test_namespace_logo_propagates_to_collections(ansible_config, upload_artifact, False)
317+
def test_namespace_logo_propagates_to_collections(galaxy_client):
318+
_test_namespace_logo_propagates_to_collections(galaxy_client, False)
345319

346320

347321
@pytest.mark.namespace
348322
@pytest.mark.deployment_cloud
349-
def test_insights_namespace_logo_propagates_to_collections(ansible_config, upload_artifact):
350-
_test_namespace_logo_propagates_to_collections(ansible_config, upload_artifact, True)
323+
def test_insights_namespace_logo_propagates_to_collections(galaxy_client):
324+
_test_namespace_logo_propagates_to_collections(galaxy_client, True)

galaxy_ng/tests/integration/utils/tasks.py

+12
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ def wait_for_all_tasks(client, timeout=300):
3333
time.sleep(1)
3434

3535

36+
def wait_for_all_tasks_gk(gc, timeout=300):
37+
ready = False
38+
wait_until = time.time() + timeout
39+
while not ready:
40+
if wait_until < time.time():
41+
raise TaskWaitingTimeout()
42+
running_count = gc.get("pulp/api/v3/tasks/?state=running")["count"]
43+
waiting_count = gc.get("pulp/api/v3/tasks/?state=waiting")["count"]
44+
ready = running_count == 0 and waiting_count == 0
45+
time.sleep(1)
46+
47+
3648
def wait_for_task(api_client, resp, task_id=None, timeout=6000, raise_on_error=False):
3749
if task_id:
3850
url = f"v3/tasks/{task_id}/"

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 4.9.0
2+
current_version = 4.9.1
33
commit = False
44
tag = False
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+))?((?P<build>\d+))?

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from setuptools.command.sdist import sdist as _SDistCommand
1414

1515
package_name = os.environ.get("GALAXY_NG_ALTERNATE_NAME", "galaxy-ng")
16-
version = "4.9.0"
16+
version = "4.9.1"
1717

1818

1919
class PrepareStaticCommand(Command):

unittest_requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
mock
22
orionutils
3-
pytest-django
3+
pytest-django<8
4+
pytest<8

0 commit comments

Comments
 (0)