Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,13 @@ jobs:

file-ft-tests:
strategy:
fail-fast: false
matrix:
include:
- job-name: file-ft-tests
- enable-null-compat: ''
job-name: file-ft-tests
- enable-null-compat: 'true'
job-name: file-ft-tests-null-compat
name: ${{ matrix.job-name }}
runs-on: ubuntu-24.04
needs: build
Expand All @@ -404,6 +408,7 @@ jobs:
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
MPU_TESTING: "yes"
ENABLE_NULL_VERSION_COMPAT_MODE: "${{ matrix.enable-null-compat }}"
JOB_NAME: ${{ matrix.job-name }}
steps:
- name: Checkout
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenko/cloudserver",
"version": "9.0.20",
"version": "9.0.21",
"description": "Zenko CloudServer, an open-source Node.js implementation of a server handling the Amazon S3 protocol",
"main": "index.js",
"engines": {
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"@azure/storage-blob": "^12.25.0",
"@hapi/joi": "^17.1.1",
"arsenal": "git+https://github.com/scality/Arsenal#8.2.25",
"arsenal": "git+https://github.com/scality/Arsenal#8.2.27",
"async": "2.6.4",
"aws-sdk": "^2.1692.0",
"bucketclient": "scality/bucketclient#8.2.4",
Expand Down Expand Up @@ -76,6 +76,10 @@
"jsonwebtoken": "^9.0.0",
"nan": "v2.22.0"
},
"mocha": {
"recursive": true,
"timeout": 40000
},
"scripts": {
"cloudserver": "S3METADATA=mongodb npm-run-all --parallel start_dataserver start_s3server",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
Expand Down
204 changes: 80 additions & 124 deletions tests/functional/aws-node-sdk/test/bucket/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('GET Bucket - AWS.S3.listObjects', () => {
});

afterEach(done => {
bucketUtil.empty(bucketName).catch(done).done(() => done());
bucketUtil.empty(bucketName).then(() => done()).catch(done);
});

tests.forEach(test => {
Expand All @@ -357,181 +357,137 @@ describe('GET Bucket - AWS.S3.listObjects', () => {
});

tests.forEach(test => {
it(`v2 should ${test.name}`, done => {
it(`v2 should ${test.name}`, async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;

Promise
.mapSeries(test.objectPutParams(Bucket),
param => s3.putObject(param).promise())
.then(() =>
s3.listObjectsV2(test.listObjectParams(Bucket))
.promise())
.then(data => {
const isValidResponse =
tv4.validate(data, bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
test.assertions(data, Bucket);
done();
})
.catch(done);
for (const param of test.objectPutParams(Bucket)) {
await s3.putObject(param).promise();
}
const data = await s3.listObjectsV2(test.listObjectParams(Bucket)).promise();
const isValidResponse = tv4.validate(data, bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
test.assertions(data, Bucket);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as Prefix`, done => {
it(`should list objects with key ${k} as Prefix`, async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }];

Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjects({ Bucket, Prefix: k }).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.deepStrictEqual(data.Prefix, k);
done();
})
.catch(done);
for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjects({ Bucket, Prefix: k }).promise();
const isValidResponse = tv4.validate(data, bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.deepStrictEqual(data.Prefix, k);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as Marker`, done => {
it(`should list objects with key ${k} as Marker`, async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }];

Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjects({ Bucket, Marker: k }).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.deepStrictEqual(data.Marker, k);
done();
})
.catch(done);
for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjects({ Bucket, Marker: k }).promise();
const isValidResponse = tv4.validate(data, bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.deepStrictEqual(data.Marker, k);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as NextMarker`, done => {
it(`should list objects with key ${k} as NextMarker`, async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }, { Bucket, Key: 'zzz' }];

Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjects({ Bucket, MaxKeys: 1,
Delimiter: 'foo' }).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.strictEqual(data.NextMarker, k);
done();
})
.catch(done);
for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjects({ Bucket, MaxKeys: 1,
Delimiter: 'foo' }).promise();
const isValidResponse = tv4.validate(data, bucketSchema);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.strictEqual(data.NextMarker, k);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as StartAfter`, done => {
it(`should list objects with key ${k} as StartAfter`, async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }];

Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjectsV2(
{ Bucket, StartAfter: k }).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.deepStrictEqual(data.StartAfter, k);
done();
})
.catch(done);
for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjectsV2(
{ Bucket, StartAfter: k }).promise();
const isValidResponse = tv4.validate(data, bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.deepStrictEqual(data.StartAfter, k);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as ContinuationToken`,
done => {
async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }];

Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjectsV2({
Bucket,
ContinuationToken: generateToken(k),
}).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.deepStrictEqual(
decryptToken(data.ContinuationToken), k);
done();
})
.catch(done);
for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjectsV2({
Bucket,
ContinuationToken: generateToken(k),
}).promise();
const isValidResponse = tv4.validate(data, bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.deepStrictEqual(
decryptToken(data.ContinuationToken), k);
});
});

['&amp', '"quot', '\'apos', '<lt', '>gt'].forEach(k => {
it(`should list objects with key ${k} as NextContinuationToken`,
done => {
async () => {
const s3 = bucketUtil.s3;
const Bucket = bucketName;
const objects = [{ Bucket, Key: k }, { Bucket, Key: 'zzz' }];
Promise
.mapSeries(objects, param => s3.putObject(param).promise())
.then(() => s3.listObjectsV2({ Bucket, MaxKeys: 1,
Delimiter: 'foo' }).promise())
.then(data => {
const isValidResponse = tv4.validate(data,
bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
return data;
}).then(data => {
assert.strictEqual(
decryptToken(data.NextContinuationToken), k);
done();
})
.catch(done);

for (const param of objects) {
await s3.putObject(param).promise();
}
const data = await s3.listObjectsV2({ Bucket, MaxKeys: 1,
Delimiter: 'foo' }).promise();
const isValidResponse = tv4.validate(data, bucketSchemaV2);
if (!isValidResponse) {
throw new Error(tv4.error);
}
assert.strictEqual(
decryptToken(data.NextContinuationToken), k);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('aws-sdk test get bucket encryption', () => {
before(done => {
const config = getConfig('default', { signatureVersion: 'v4' });
s3 = new S3(config);
return metadata.setup(done);
metadata.setup(done);
});

beforeEach(done => s3.createBucket({ Bucket: bucketName }, done));
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/aws-node-sdk/test/bucket/getLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ describeSkipAWS('GET bucket location ', () => {
// if region location-dmf-v1 should return InvalidLocationConstraint error
return;
}
if (locationConstraints[location].isCRR) {
// CRR location cannot be used as bucket location
return;
}
describe(`with location: ${location}`, () => {
before(() => s3.createBucket(
{
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/aws-node-sdk/test/bucket/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ describe('PUT Bucket - AWS.S3.createBucket', () => {
location => {
describeSkipAWS(`bucket creation with location: ${location}`,
() => {
after(done =>
after(done => {
bucketUtil.deleteOne(bucketName)
.then(() => done()).catch(() => done()));
.then(() => done()).catch(() => done());
});
it(`should create bucket with location: ${location}`, done => {
bucketUtil.s3.createBucket(
{
Expand Down
3 changes: 0 additions & 3 deletions tests/functional/aws-node-sdk/test/mocha.opts

This file was deleted.

2 changes: 2 additions & 0 deletions tests/functional/aws-node-sdk/test/object/100-continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ContinueRequestHandler {

getRequestOptions() {
return {
// Prevent socket reuse as a test checks for socket.bytesWritten
agent: new http.Agent({ keepAlive: false }),
path: this.path,
hostname,
port,
Expand Down
Loading
Loading