Skip to content

Conversation

@benzekrimaha
Copy link
Contributor

@benzekrimaha benzekrimaha commented Oct 23, 2025

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

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-service-get-related-functional-tests branch 3 times, most recently from 72dd6ed to cd35cca Compare October 28, 2025 15:59
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-backbeat-related-functional-tests branch 2 times, most recently from 425731c to 2b9959d Compare October 28, 2025 16:03
@scality scality deleted a comment from codecov bot Nov 5, 2025
@codecov
Copy link

codecov bot commented Nov 5, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
6785 1 6784 0
View the full list of 1 ❄️ flaky test(s)
"after each" hook for "should create a bunch of objects and their versions"::put and head object with versioning With default signature "after each" hook for "should create a bunch of objects and their versions"

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0.972s run time
The bucket you tried to delete is not empty.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-backbeat-related-functional-tests branch 5 times, most recently from 8c9eb10 to 3ab4eae Compare November 13, 2025 10:44
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-backbeat-related-functional-tests branch 2 times, most recently from 17d2fcb to 198582c Compare November 20, 2025 17:19
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-backbeat-related-functional-tests branch 3 times, most recently from 2c806e4 to 836c556 Compare November 28, 2025 15:18
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-backbeat-related-functional-tests branch 2 times, most recently from 26ce909 to 8383cf9 Compare December 2, 2025 17:24
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-724-service-get-related-functional-tests branch from cd35cca to 0fec989 Compare December 4, 2025 06:39
@benzekrimaha benzekrimaha changed the title Improvement/cldsrv 724 backbeat related functional tests Improvement/cldsrv 724-backbeat-related-functional-tests Dec 4, 2025
@benzekrimaha benzekrimaha marked this pull request as ready for review December 4, 2025 13:38
return metadata.putObjectMD(bucketName, objectKey, omVal, options, log,
(err, md) => {
if (err) {
// Handle duplicate key error during repair operation
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes , this was found in tests flakiness and was added to fix it

client = new DataFileInterface(config);
implName = 'file';
} else if (config.backends.data === 'multiple') {
Object.keys(config.locationConstraints).filter(k =>
Copy link
Contributor

@SylvainSenechal SylvainSenechal Dec 8, 2025

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
Copy link
Contributor

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 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because this is the branch we bumped arsenal in with the v3 migration so additional adaptations needed to be made


describe('with NoncurrentVersionTransitions', () => {
// NoncurrentVersionTransitions not implemented
describe.skip('with NoncurrentVersionTransitions', () => {
Copy link
Contributor

@SylvainSenechal SylvainSenechal Dec 8, 2025

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 ?

Copy link
Contributor Author

@benzekrimaha benzekrimaha Dec 11, 2025

Choose a reason for hiding this comment

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

yes it was already skipped before the migration all together

Copy link
Contributor

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({
Copy link
Contributor

@SylvainSenechal SylvainSenechal Dec 8, 2025

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() {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is still at the same level ? I'm only declaring the vars used in the function before

assert.strictEqual(versionId, undefined);
getObjectAndAssertAcl(s3, { bucket, key, body: someBody,
expectedResult: testAcp }, done);
waitForVersioningBeforePut(s3, bucket, err => {
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these tests are ceph tests , and we need more time for operation on ceph that's why

ContentLength: partBody.length,
};
const uploadPartCommand = new UploadPartCommand(uploadPartInput);
uploadPartCommand.middlewareStack.add(next => async args => {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried without the middleware and it didn't work as ceph is less permissive than aws is ( this is what I was talking about in the daily )

const params = { Bucket: gcpBucket, Key: gcpKey };
gcpClient.getObject(params, (err, gcpRes) => {
assert.equal(err, null, `Err getting object from GCP: ${err}`);
if (err) {
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to return directly instead of the timeout waiting for the assertion , tried to do that whenever I could , because it's painful to debug in case of failure with the assertions

.catch(err => {
assert.equal(err, null,
`Err completing MPU: ${err}`);
done(err);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed this was fixed

setTimeout(() => {
this.test.awsClient.getObject({ Bucket: awsBucket,
Key: this.test.key }, err => {
assert.strictEqual(err.code, 'NoSuchKey');
Copy link
Contributor

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 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is gcp returning not aws

let bucketUtil;
let s3;

function normalizeMetadata(metadata) {
Copy link
Contributor

@SylvainSenechal SylvainSenechal Dec 9, 2025

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) {
Copy link
Contributor

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) => {
Copy link
Contributor

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 ?

Copy link
Contributor

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 ?

Copy link
Contributor Author

@benzekrimaha benzekrimaha Dec 11, 2025

Choose a reason for hiding this comment

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

indeed it's for ceph as precised before in the comment regarding the wait

it('should return 404 and NoSuchBucket', done => {
const badBucketName = `nonexistingbucket-${genUniqID()}`;
gcpClient.getBucket({
gcpClient.listObjects({
Copy link
Contributor

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);
Copy link
Contributor

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 ?

Copy link
Contributor

@SylvainSenechal SylvainSenechal left a 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

@benzekrimaha benzekrimaha requested review from a team, SylvainSenechal and delthas December 11, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants