CMP-3866: Enhanced TestScanTailoredProfileIsDeprecated to cover case when TailoredProfile extends a Profile that is marked deprecated#1089
Conversation
…oredProfile extends a Profile that is marked deprecated
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: taimurhafeez The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Skipping CI for Draft Pull Request. |
|
🤖 To deploy this PR, run the following command: |
|
@taimurhafeez: This pull request references CMP-3866 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
🤖 To deploy this PR, run the following command: |
|
/retest-required |
|
/retest |
rhmdnd
left a comment
There was a problem hiding this comment.
A few comments inline, mainly around the test images and the possibility of making this it's own test.
Thanks!
| } | ||
|
|
||
| // Find one of the profiles created by the ProfileBundle and annotate it as deprecated | ||
| // Using ocp4-cis as it should be available in the standard content |
There was a problem hiding this comment.
We could list profiles in the bundle and grab one if we want to make this a little more resilient to upstream profile changes.
| t.Fatal(err) | ||
| } | ||
|
|
||
| // SCENARIO 2: TailoredProfile extends a deprecated Profile - the TailoredProfile itself is not marked deprecated, |
There was a problem hiding this comment.
With this being an entirely separate scenario - should it just be it's own test? In that case the profile bundle name could be derived from the test name.
| } | ||
|
|
||
| // Create a TailoredProfile that extends the deprecated Profile | ||
| tpExtendsDeprecatedName := "test-tp-extends-deprecated" |
There was a problem hiding this comment.
Similar naming comment here.
| if deprecatedProfileCopy.Annotations == nil { | ||
| deprecatedProfileCopy.Annotations = make(map[string]string) | ||
| } | ||
| deprecatedProfileCopy.Annotations[compv1alpha1.ProfileStatusAnnotation] = "deprecated" |
There was a problem hiding this comment.
Could we use the deprecated_profile image?
I think @yuumasato built an image with a data stream that contains a deprecated profile specifically for testing when he implemented the deprecated profile functionality.
|
@taimurhafeez: This pull request references CMP-3866 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
🤖 To deploy this PR, run the following command: |
@rhmdnd Please review if modifications are acceptable. |
|
🤖 To deploy this PR, run the following command: |
|
@taimurhafeez: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Test Coverage
Adds two test cases having distinct deprecation scenarios:
Scenario 1 :
Scenario 2 :
Run the test
If you encounter an error for running the test that relates to invalid machine selector etc, following worked for me.
In a separate terminal 1,
while true; do oc patch validatingadmissionpolicy custom-machine-config-pool-selector --type=merge -p '{"spec":{"failurePolicy":"Ignore"}}' 2>/dev/null; sleep 3; done &Then in main terminal 2
make e2e-parallel E2E_GO_TEST_FLAGS="-v -run TestScanTailoredProfileIsDeprecated"Or
make e2e-parallel E2E_GO_TEST_FLAGS="-v -run TestScanTailoredProfileExtendsDeprecatedProfile"After the test run,
kill the process in terminal 1 by
kill %1Expected output:
Assisted by Claude Code.