-
Notifications
You must be signed in to change notification settings - Fork 252
Improvement/cldsrv 724-backbeat-related-functional-tests #5985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: improvement/CLDSRV-724-service-get-related-functional-tests
Are you sure you want to change the base?
Conversation
72dd6ed to
cd35cca
Compare
425731c to
2b9959d
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files
... and 27 files with indirect coverage changes @@ Coverage Diff @@
## improvement/CLDSRV-724-service-get-related-functional-tests #5985 +/- ##
===============================================================================================
+ Coverage 81.00% 84.31% +3.30%
===============================================================================================
Files 204 204
Lines 12890 12902 +12
===============================================================================================
+ Hits 10442 10878 +436
+ Misses 2448 2024 -424
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
8c9eb10 to
3ab4eae
Compare
17d2fcb to
198582c
Compare
2c806e4 to
836c556
Compare
26ce909 to
8383cf9
Compare
cd35cca to
0fec989
Compare
8383cf9 to
b3e16fb
Compare
| return metadata.putObjectMD(bucketName, objectKey, omVal, options, log, | ||
| (err, md) => { | ||
| if (err) { | ||
| // Handle duplicate key error during repair operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we have this in sdkv3 migration ? Is it because you found a bug/flaky test and needed this to fix it ?
| client = new DataFileInterface(config); | ||
| implName = 'file'; | ||
| } else if (config.backends.data === 'multiple') { | ||
| Object.keys(config.locationConstraints).filter(k => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(writing this without having read the whole pr) : Seeing this feels a bit weird, we don't really know why it's done, maybe add a comment to explain where this is used ? Also, the result of the map is not assigned to anything 🤔
Edit: Not too sure, just leaving this here so that another reviewer can double check
| const data = await s3.send(new GetBucketLocationCommand({ Bucket: bucketName })); | ||
| assert.strictEqual(data.LocationConstraint, endpoint); | ||
|
|
||
| // S3C backend has 'dc-1' as default location constraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't we have to do such thing for the previous test though 🤔
|
|
||
| describe('with NoncurrentVersionTransitions', () => { | ||
| // NoncurrentVersionTransitions not implemented | ||
| describe.skip('with NoncurrentVersionTransitions', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test isn't skipped on the left, (but it's already sdk v3 code).
Was the test skipped before updating it to v3 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment as im still early in the pr : It feels weird to review because the code being replaced is already migrated to v3, so it looks more like a refactoring ?
For example here, beforeEach is modified to async/await
But also, afterEach is logically modified, as the putBucketLogging didn't exist before 🤔
| if (err && err.name !== 'NoSuchBucket') { | ||
| return done(err); | ||
| try { | ||
| await s3.send(new PutBucketLoggingCommand({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why doing this in an afterEach (asking because usually, afterEach is cleanup delete commands, not post/put) ? Also it wasn't there in the old code
| let credentials = null; | ||
| let backbeatAuthCredentials = null; | ||
|
|
||
| async function getCredentials() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like you could've kept the credentials initialization at the top level ?
If not, then I think it's better to move the declaration of backbeatAuthCredentials in the beforeAll too
| assert.strictEqual(versionId, undefined); | ||
| getObjectAndAssertAcl(s3, { bucket, key, body: someBody, | ||
| expectedResult: testAcp }, done); | ||
| waitForVersioningBeforePut(s3, bucket, err => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we need this now, but didn't need it before (i saw it added to other tests in other files too)
| ContentLength: partBody.length, | ||
| }; | ||
| const uploadPartCommand = new UploadPartCommand(uploadPartInput); | ||
| uploadPartCommand.middlewareStack.add(next => async args => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this is needed, as you added content length in the command already. Can probably leave as it's a test, but with more time it would be nice to retest it by retrying the test without the middleware
| const params = { Bucket: gcpBucket, Key: gcpKey }; | ||
| gcpClient.getObject(params, (err, gcpRes) => { | ||
| assert.equal(err, null, `Err getting object from GCP: ${err}`); | ||
| if (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you replace assert error nil with cb(err) ? I'm guessing there is not much impact as the error is catched later ?
| .catch(err => { | ||
| assert.equal(err, null, | ||
| `Err completing MPU: ${err}`); | ||
| done(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this will never be reach since the error is always non nil in the catch
| setTimeout(() => { | ||
| this.test.awsClient.getObject({ Bucket: awsBucket, | ||
| Key: this.test.key }, err => { | ||
| assert.strictEqual(err.code, 'NoSuchKey'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this test isn't problematic, as I guess here it should be err.name 🤔
| let bucketUtil; | ||
| let s3; | ||
|
|
||
| function normalizeMetadata(metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth it to explain why this is needed now
Also it looks this is used to modify the result to compare it with an expected value, maybe it would've been better to not modify the result, and modify the expected value without normalization instead (edit: especially since it looks like the function is only called twice and not on every test) ?
| if (attempt < MAX_VERSIONING_CHECKS) { | ||
| await new Promise(resolve => setTimeout(resolve, VERSIONING_CHECK_INTERVAL)); | ||
| } else { | ||
| if (callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we've reached max attempt, and get bucket versioning doesnt't fail but also doesn't return status enabled, should'nt this return an error ?
|
|
||
| utils.putToAwsBackend = async (s3, bucket, key, body) => { | ||
| const result = await s3.send(new PutObjectCommand({ | ||
| utils.waitForVersioningBeforePut = async (s3, bucket, callback) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what context would we need to wait a bit for the versioning to take effect, and why this is needed now but not before ?
I guess we have some test that setup bucket versioning, but it should take effect directly no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the end of the file, if I understand correctly this is only needed for the Ceph tests that will eventually be removed ?
| it('should return 404 and NoSuchBucket', done => { | ||
| const badBucketName = `nonexistingbucket-${genUniqID()}`; | ||
| gcpClient.getBucket({ | ||
| gcpClient.listObjects({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changing from getBucket to listObject ? I guess the test is still valid because listObject will also return noSuchBucket but still, here we want to test the getBucket api I think
| * round robin is confined to each nodejs cluster processes | ||
| */ | ||
| const APPROX = Math.floor(0.1 * TOTAL_OBJECTS_PER_NODE); | ||
| const APPROX = Math.ceil(0.2 * TOTAL_OBJECTS_PER_NODE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you remember what happened here that you need to do this change ?
SylvainSenechal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bigbig pr again. this time I left a bit more comments but actually not many changes requested, its mostly questions to double check the changes, and make sure we understand why the changes are done because I found 2/3 things were curious
Please note that this PR also takles the rest of the unmigrated code , better to review it by commit to have the context
Issue: CLDSRV-724