ROX-32714: Update groovy tests for ImageV2#19972
ROX-32714: Update groovy tests for ImageV2#19972charmik-redhat wants to merge 2 commits intomasterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19972 +/- ##
==========================================
+ Coverage 49.56% 49.61% +0.04%
==========================================
Files 2764 2765 +1
Lines 208442 208596 +154
==========================================
+ Hits 103321 103499 +178
+ Misses 97466 97440 -26
- Partials 7655 7657 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 Build Images ReadyImages are ready for commit b5cae73. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-638-gb5cae7379d |
| byte[] sha256 = MessageDigest.getInstance("SHA-256").digest(ns.getBytes("UTF-8")) | ||
| long msb = ByteBuffer.wrap(sha256, 0, 8).getLong() | ||
| long lsb = ByteBuffer.wrap(sha256, 8, 8).getLong() | ||
| UUID nsUUID = new UUID(msb, lsb) | ||
|
|
||
| MessageDigest sha1 = MessageDigest.getInstance("SHA-1") | ||
| sha1.update(uuidToBytes(nsUUID)) | ||
| sha1.update(name.getBytes("UTF-8")) | ||
| byte[] hash = sha1.digest() | ||
|
|
||
| hash[6] = (byte) ((hash[6] & 0x0F) | 0x50) // version 5 | ||
| hash[8] = (byte) ((hash[8] & 0x3F) | 0x80) // variant RFC 4122 | ||
| long msbResult = ByteBuffer.wrap(hash, 0, 8).getLong() | ||
| long lsbResult = ByteBuffer.wrap(hash, 8, 8).getLong() |
There was a problem hiding this comment.
Maybe we can use a lib to handle that e.g. https://github.com/f4b6a3/uuid-creator
There was a problem hiding this comment.
Good suggestion, updated to use that library.
| def retryResultRet = gqlService.Call(getQuery(resourceType), [ query: searchQuery ]) | ||
| assert retryResultRet.getCode() == 200 | ||
| assert retryResultRet.getValue() != null |
There was a problem hiding this comment.
This will ignore the previous result. Maybe we don't need to barnach on flattenImageDataEnabled and always retry to have cleaner test. On non faltten images it will not retry at all unless a failure
There was a problem hiding this comment.
Makes sense. I will update it.
| if (flattenImageDataEnabled) { | ||
| // When FlattenImageData is enabled, the reprocessor moves images from the | ||
| // images table to images_v2 after upgrade, which may take some time. | ||
| evaluateWithRetry(30, 10) { |
There was a problem hiding this comment.
Do we need evaluateWithRetry or just withRetry as we are not interested in the return value
There was a problem hiding this comment.
Could we not simply add the retry logic without the feature flag branch?
There was a problem hiding this comment.
Right, withRetry is enough. Also, updated it to always do the retry regardless of feature flag
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@charmik-redhat: The following test 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. |
Description
Update groovy E2E tests under
qa-tests-backend/to work correctly whenFlattenImageDatais enabled (ImageV2).When
FlattenImageDatais enabled, images are stored in a newimages_v2table and their IDs change from the image digest (SHA) to a deterministic
UUIDv5 derived from the full image name and digest. These changes update
the tests to handle both ID schemes:
Helpers.generateImageV2ID()andnewV5FromNonUUIDs()to mirror theGo-side
pkg/images/utils.NewImageV2IDUUID generation logicflattenImageDataEnabledflag toBaseSpecification(read fromROX_FLATTEN_IMAGE_DATAenv var) and a pre-computedTEST_IMAGE_V2_IDAdmissionControllerTest,ImageManagementTest, andCSVTesttouse the V2 image ID when the flag is enabled
VulnMgmtTestto pass image name alongside digest so it cancompute the correct image ID for GraphQL queries
SACTestto expect an additional search result (IMAGES_V2 category)GlobalSearchto include theIMAGES_V2search categoryUpgradesTestforgetImagesand GraphQL queries,since the reprocessor may take time to migrate images to
images_v2after an upgrade
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Ran tests with and without the FlattenImageData enabled