Project

Profile

Help

Issue #7739

Requirement.yml code doesn't filter by version

Added by daviddavis 11 months ago. Updated 10 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

If you use this requirements.yml file[0], you will end up with 3 collection versions. However, you should only have 1 as the two releases for testing.ansible_testing_content are 4.0.4 and 4.0.6[1] which don't match ">=1.0.0,<=2.0.0", and there's only one release of testing.k8s_demo_collection[2].

To reproduce this in a test environment, change this line[3] to use assertEqual since ANSIBLE_COLLECTION_FIXTURE_COUNT is 1.

[0] https://github.com/pulp/pulp_ansible/blob/739a5551c87f4fffa9f46bee7fce9975e39020e8/pulp_ansible/tests/functional/constants.py#L83-L88

[1] https://galaxy-dev.ansible.com/api/v2/collections/testing/ansible_testing_content/versions/

[2] https://galaxy.ansible.com/api/v2/collections/testing/k8s_demo_collection/versions/

[3] https://github.com/pulp/pulp_ansible/blob/739a5551c87f4fffa9f46bee7fce9975e39020e8/pulp_ansible/tests/functional/api/collection/v2/test_sync.py#L204


Related issues

Related to Ansible Plugin - Refactor #7777: As a developer I want collections sync machinery easier to maintainCLOSED - CURRENTRELEASE

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Has duplicate Ansible Plugin - Issue #5309: Download only specified version on requirements.ymlCLOSED - DUPLICATE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 2ab95bd8 View on GitHub
Added by bmbouter 10 months ago

Refactors sync to use asyncio more and many tests

The previous sync machinery design was very complicated due to treating the asynchronous coroutines as synchronous code. This rewrites the sync code to have the coroutines track the work instead.

In doing the rewrite several bugs were fixed also:

  • versions in requirements.yml are now respected
  • requirements.yml with different sources are now respected too

It also makes many test improvements:

  • refactors Galaxy V2 sync tests to be bindings based
  • adds may more tests

closes #7739 closes #7741 closes #7777

History

#1 Updated by daviddavis 11 months ago

  • Description updated (diff)

#2 Updated by daviddavis 11 months ago

  • Description updated (diff)

#3 Updated by daviddavis 11 months ago

Here is a test I wrote:

      def test_sync_with_version_requirement(self):
          """Test to sync down a role using a version requirement"""
          requirements_file = "collections:\n  - name: amazon.aws\n    version: \"<0.1.3\""
  
          repo = self.client.post(ANSIBLE_REPO_PATH, gen_repo())
          self.addCleanup(self.client.delete, repo["pulp_href"])
  
          collection_remote = self.client.post(
              ANSIBLE_COLLECTION_REMOTE_PATH,
              gen_ansible_remote(
                  url=ANSIBLE_GALAXY_COLLECTION_URL_V2.rstrip("/"),
                  requirements_file=requirements_file,
              ),
          )
  
          self.addCleanup(self.client.delete, collection_remote["pulp_href"])
  
          sync(self.cfg, collection_remote, repo, mirror=True)
          repo = self.client.get(repo["pulp_href"])
          content_summary = get_content_summary(repo)
          self.assertLess(
              content_summary[ANSIBLE_COLLECTION_CONTENT_NAME], 3
          )

Here's the failure: AssertionError: 10 not less than 3

#4 Updated by fao89 11 months ago

  • Has duplicate Issue #5309: Download only specified version on requirements.yml added

#5 Updated by fao89 11 months ago

  • Parent task set to #7777

#6 Updated by fao89 11 months ago

  • Parent task deleted (#7777)

#7 Updated by fao89 11 months ago

  • Related to Refactor #7777: As a developer I want collections sync machinery easier to maintain added

#8 Updated by bmbouter 10 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to bmbouter

#9 Updated by bmbouter 10 months ago

  • Status changed from ASSIGNED to POST

#10 Updated by bmbouter 10 months ago

  • Status changed from POST to MODIFIED

#11 Updated by fao89 10 months ago

  • Sprint/Milestone set to 0.6.0

#12 Updated by fao89 10 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF