Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsure PRN upgrade scenario tests explicitly create Content Views and Lifecycle Environments with required attributes instead of relying on nailgun’s create_missing behavior, fixing 422 validation errors in CI. Sequence diagram for updated PRN content setup in pulp upgrade testssequenceDiagram
actor Tester
participant Pytest as Pytest_runner
participant Fixture as _setup_prn_content
participant Sat as SatelliteAPI
participant CV as ContentView_entity
participant LEnv as LifecycleEnvironment_entity
Tester->>Pytest: run tests/new_upgrades/test_pulp.py
Pytest->>Fixture: call _setup_prn_content(sat, manifest, test_name)
Fixture->>Sat: api.ContentView(organization=org, repository=repos, name=gen_string_alpha)
activate Sat
Sat-->>Fixture: ContentView_entity instance
deactivate Sat
Fixture->>CV: create()
activate CV
CV-->>Fixture: persisted ContentView (cv)
deactivate CV
Fixture->>Sat: api.LifecycleEnvironment()
activate Sat
Sat-->>Fixture: LifecycleEnvironment search proxy
deactivate Sat
Fixture->>LEnv: search(query={search: name=ENVIRONMENT and organization_id=org_id})
activate LEnv
LEnv-->>Fixture: [library_environment]
deactivate LEnv
Fixture->>LEnv: library_environment.read()
activate LEnv
LEnv-->>Fixture: library_environment_with_id
deactivate LEnv
Fixture->>Sat: api.LifecycleEnvironment(organization=org, prior=library_id, name=gen_string_alpha)
activate Sat
Sat-->>Fixture: LifecycleEnvironment_entity instance
deactivate Sat
Fixture->>LEnv: create()
activate LEnv
LEnv-->>Fixture: persisted LifecycleEnvironment (lce)
deactivate LEnv
Fixture->>CV: publish()
CV-->>Fixture: published
Fixture-->>Pytest: return test_data with cv and lce
Pytest-->>Tester: test execution continues without 422 errors
Flow diagram for explicit ContentView and LifecycleEnvironment creation in PRN setupflowchart TD
A[Start _setup_prn_content] --> B[Prepare repositories list]
B --> C[Create ContentView instance with organization, repository, name]
C --> D[Call ContentView.create]
D --> E[ContentView cv created]
E --> F[Create LifecycleEnvironment search proxy]
F --> G[Search for library environment by name and organization_id]
G --> H[Read first search result as library]
H --> I[Create LifecycleEnvironment instance with organization, prior=library.id, name]
I --> J[Call LifecycleEnvironment.create]
J --> K[lce created]
K --> L[Publish ContentView cv]
L --> M[Read cv version]
M --> N[Return test data]
N --> O[End _setup_prn_content]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
Author
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
librarylookup assumessearch(...)[0]will always succeed; consider handling the case where no lifecycle environment is returned to avoid an IndexError that would mask the original problem. - The name for the content view and lifecycle environment is now always a random
gen_string('alpha'); if these names need to be correlated with the test or traceable in logs, consider incorporatingtest_nameor other context into the generated names.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `library` lookup assumes `search(...)[0]` will always succeed; consider handling the case where no lifecycle environment is returned to avoid an IndexError that would mask the original problem.
- The name for the content view and lifecycle environment is now always a random `gen_string('alpha')`; if these names need to be correlated with the test or traceable in logs, consider incorporating `test_name` or other context into the generated names.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Collaborator
|
PRT Result |
Contributor
Author
|
The only failure is related to this PR #20746 |
LadislavVasina1
approved these changes
Feb 10, 2026
cb04888 to
04cd799
Compare
Contributor
Author
|
rebased ^ |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Statement
In CI the PRN new_upgrade-scenarios tests are failing in setup to create a CV since the nailgun fails to
create_missingparameters:Solution
It feels like some version mismatch related inconsistency in nailgun (master nailgun runs against 6.18.z instance).
Since there are the "single-branch" discussion in progress, I'm not to dig into this deeper. This PR just provides a quick fix - provides the missing parameters explicitly so we don't depend on the
create_missingmethod.PRT test Cases example
Summary by Sourcery
Ensure PRN upgrade scenario tests can create content views and lifecycle environments by explicitly providing required attributes instead of relying on automatic parameter creation.
Bug Fixes: