Skip to content

Add a test case for CCV publish dependency chaining#20914

Merged
vsedmik merged 2 commits intoSatelliteQE:masterfrom
vsedmik:ccv-chaining
Mar 12, 2026
Merged

Add a test case for CCV publish dependency chaining#20914
vsedmik merged 2 commits intoSatelliteQE:masterfrom
vsedmik:ccv-chaining

Conversation

@vsedmik
Copy link
Contributor

@vsedmik vsedmik commented Feb 27, 2026

Problem Statement

New approach has been taken for publishing CCVs to address SAT-24497 (when multiple component CVs are published simultaneously) and we should add coverage for that case.

Solution

This PR proposes such a test case.

Requires

theforeman/foreman-tasks#788
Katello/katello#11621

Related Issues

https://issues.redhat.com/browse/SAT-24497

PRT test Cases example

trigger: test-robottelo
pytest: tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining
theforeman:
    foreman-tasks: 788
Katello:
    katello: 11621

Summary by Sourcery

Tests:

  • Add an API-level test ensuring composite content view publish tasks are correctly chained and scheduled after their component content view publishes when triggered asynchronously.

@vsedmik vsedmik self-assigned this Feb 27, 2026
@vsedmik vsedmik requested a review from a team as a code owner February 27, 2026 15:55
@vsedmik vsedmik added CherryPick PR needs CherryPick to previous branches 6.19.z labels Feb 27, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 27, 2026

Reviewer's Guide

Adds an automated API test that verifies composite content view (CCV) auto‑publish correctly chains and waits on multiple component content view publishes when they are triggered asynchronously and simultaneously.

File-Level Changes

Change Details Files
Add end-to-end API test covering CCV auto-publish dependency chaining when publishing multiple component CVs asynchronously.
  • Enable and sync a larger Red Hat RHEL10 BaseOS repository for use in the test setup.
  • Create and publish a Red Hat-based content view with an errata date filter and assert its initial version is 1.0.
  • Create and publish a custom-repository-based content view and assert its initial version is 1.0.
  • Create a composite content view with both component CV versions, configure auto-publish with latest components, and update components to track latest.
  • Trigger asynchronous publishes of both component CVs and wait for the corresponding CCV auto-publish task to be scheduled and completed using a Foreman task search query.
  • Assert all publish tasks succeed, verify the CCV publish starts only after both component tasks have completed, and confirm expected resulting versions of component CVs (2.0) and CCV (1.0).
tests/foreman/api/test_contentview.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The test uses hard-coded future dates for the errata filter (2025-07-01 to 2025-12-31), which may eventually cause the filter to match no content and make the test brittle over time; consider basing these dates relative to the current date or choosing a stable historical range known to contain errata.
  • The comparison ccv_task.started_at >= latest_component_finished implicitly assumes these fields are comparable (e.g., parsed datetimes rather than strings); if they are strings from the API, consider normalizing them to datetime objects before comparison to avoid subtle ordering issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The test uses hard-coded future dates for the errata filter (`2025-07-01` to `2025-12-31`), which may eventually cause the filter to match no content and make the test brittle over time; consider basing these dates relative to the current date or choosing a stable historical range known to contain errata.
- The comparison `ccv_task.started_at >= latest_component_finished` implicitly assumes these fields are comparable (e.g., parsed datetimes rather than strings); if they are strings from the API, consider normalizing them to `datetime` objects before comparison to avoid subtle ordering issues.

## Individual Comments

### Comment 1
<location path="tests/foreman/api/test_contentview.py" line_range="2249-2250" />
<code_context>
+            comp.update(['latest'])
+
+        # 4. Asynchronously publish both component CVs (simultaneously).
+        rh_task = cv_rh.publish(synchronous=False)
+        custom_task = cv_custom.publish(synchronous=False)
+
+        # 5. Wait for the CCV publish task to be scheduled and wait until completed.
</code_context>
<issue_to_address>
**question:** Clarify or strengthen the concurrency aspect of the "simultaneous" publishes.

These publishes are still called sequentially, so “simultaneously” may be misleading. To better reflect the concurrency behavior, either (a) capture and assert the `started_at` times to verify the tasks actually overlap, or (b) reword the comment to clarify that both CVs are just enqueued as async tasks and overlap is not guaranteed. Making this explicit will help future readers understand the intended behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vsedmik
Copy link
Contributor Author

vsedmik commented Feb 27, 2026

trigger: test-robottelo
pytest: tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining
theforeman:
    foreman-tasks: 788
Katello:
    katello: 11621

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 14539
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining --external-logging
Test Result : ========== 1 failed, 99 deselected, 6 warnings in 2319.88s (0:38:39) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Feb 27, 2026
Copy link
Contributor

@aidenfine aidenfine left a comment

Choose a reason for hiding this comment

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

LGTM, once that PRT passes

Copy link
Contributor

@vijaysawant vijaysawant left a comment

Choose a reason for hiding this comment

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

Can we assert more specific return value of wait_for_tasks() which is defined inside robottelo/host_helpers? This function will return list and it would be true exiting publish tasks are running asynchronously.

Copy link
Contributor

@sambible sambible left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Contributor

@vijaysawant vijaysawant left a comment

Choose a reason for hiding this comment

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

Let PRT pass and then merge it.

@vijaysawant
Copy link
Contributor

trigger: test-robottelo
pytest: tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining
theforeman:
    foreman-tasks: 788
Katello:
    katello: 11621

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 14659
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining --external-logging
Test Result : ========== 99 deselected, 19 warnings, 1 error in 5761.01s (1:36:01) ===========

Copy link
Contributor

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

ACK from SME perspective, the steps make sense.

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 14668
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining --external-logging
Test Result : ========== 99 deselected, 13 warnings, 1 error in 5297.23s (1:28:17) ===========

@vsedmik
Copy link
Contributor Author

vsedmik commented Mar 12, 2026

trigger: test-robottelo
pytest: tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 14715
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining --external-logging
Test Result : ========== 1 failed, 99 deselected, 6 warnings in 1310.46s (0:21:50) ===========

@vsedmik
Copy link
Contributor Author

vsedmik commented Mar 12, 2026

PRT failed ^ since we are still missing theforeman/foreman-tasks#788 in snap 5.

Edit: But it seems to be present in snap 169.

@vsedmik
Copy link
Contributor Author

vsedmik commented Mar 12, 2026

trigger: test-robottelo
pytest: tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 14718
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_contentview.py -k test_ccv_publish_dependency_chaining --external-logging
Test Result : ========== 1 passed, 99 deselected, 6 warnings in 1136.68s (0:18:56) ===========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Mar 12, 2026
@vsedmik vsedmik removed CherryPick PR needs CherryPick to previous branches 6.19.z labels Mar 12, 2026
@vsedmik vsedmik added No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Mar 12, 2026
@vsedmik vsedmik merged commit e91a059 into SatelliteQE:master Mar 12, 2026
16 checks passed
@vsedmik vsedmik deleted the ccv-chaining branch March 12, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants