Skip to content

[DNM] add content guard test#74

Closed
bbezak wants to merge 1 commit into
full-parallelfrom
full-parallel-content-guard-test
Closed

[DNM] add content guard test#74
bbezak wants to merge 1 commit into
full-parallelfrom
full-parallel-content-guard-test

Conversation

@bbezak
Copy link
Copy Markdown
Member

@bbezak bbezak commented May 12, 2026

just to test if it works

Signed-off-by: Bartosz Bezak <bartosz@stackhpc.com>
@bbezak bbezak requested a review from a team as a code owner May 12, 2026 12:46
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request expands the container distribution tests by introducing a test case for guarded distributions. The changes include creating an x509 certificate guard, utilizing it in a new distribution, and performing subsequent verification and cleanup. Feedback from the reviewer highlights a potential issue where the content_guard parameter likely requires a URI/HREF instead of a name, suggesting that the guard creation task's output should be registered and its HREF used. Additionally, it was recommended to enhance the assertion logic to verify that the new distribution is correctly reported as changed.

- name: test_dist_guarded
base_path: test_dist_guarded
repository: test_dist_repo
content_guard: test_dist_guard
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The container_distributions module (as seen in the context) does not currently implement name-to-HREF resolution for the content_guard parameter, unlike the repository parameter which has explicit resolution logic (lines 189-204 of the module). Since the Pulp API typically expects a URI/HREF for the content guard field, passing the name test_dist_guard directly will likely cause the task to fail with a 400 Bad Request.

It is recommended to either update the module to support name resolution for content_guard or pass the HREF directly from the registered result of the guard creation task.

            content_guard: "{{ guard_result.x509_cert_guard.pulp_href }}"

Copy link
Copy Markdown
Member Author

@bbezak bbezak May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly why this test here ;)

Comment on lines +20 to +28
- name: Create test content guard
pulp.squeezer.x509_cert_guard:
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
validate_certs: "{{ pulp_validate_certs }}"
name: test_dist_guard
ca_certificate: "{{ lookup('file', 'files/ca.pem') }}"
state: present
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure the created content guard can be correctly referenced by its HREF in subsequent tasks, it is recommended to register the output of this task. This is particularly important because the container_distributions module (as seen in the context) does not currently appear to perform name-to-HREF resolution for the content_guard parameter.

    - name: Create test content guard
      pulp.squeezer.x509_cert_guard:
        pulp_url: "{{ pulp_url }}"
        username: "{{ pulp_username }}"
        password: "{{ pulp_password }}"
        validate_certs: "{{ pulp_validate_certs }}"
        name: test_dist_guard
        ca_certificate: "{{ lookup('file', 'files/ca.pem') }}"
        state: present
      register: guard_result

Comment on lines +62 to +63
- create_result.distributions[2].name == "test_dist_guarded"
- create_result.distributions[2].distribution.content_guard is search("/contentguards/")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is recommended to verify that the newly created distribution was actually marked as changed during the creation task.

          - create_result.distributions[2].name == "test_dist_guarded"
          - create_result.distributions[2].changed == true
          - create_result.distributions[2].distribution.content_guard is search("/contentguards/")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant