Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ jobs:
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
S3DATA: multiple
S3METADATA: mongodb
ENABLE_NULL_VERSION_COMPAT_MODE: true # needed with mongodb backend
JOB_NAME: ${{ github.job }}
steps:
- name: Checkout
Expand Down Expand Up @@ -557,6 +558,7 @@ jobs:
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
JOB_NAME: ${{ github.job }}
ENABLE_NULL_VERSION_COMPAT_MODE: true # needed with mongodb backend
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
33 changes: 13 additions & 20 deletions lib/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
const dataRetrievalInfo = {
versionId: dataStoreVersionId,
};
return _respond(response, dataRetrievalInfo, log, callback);
return response ? _respond(response, dataRetrievalInfo, log, callback) : callback();
});
}

Expand Down Expand Up @@ -534,15 +534,9 @@
});
}

let versionId;
let versioning;
let versionId = decodeVersionId(request.query);
let versioning = bucketInfo.isVersioningEnabled();
let isNull = false;
const decodedVidResult = decodeVersionId(request.query);

if (decodedVidResult || omVal.replicationInfo.isNFS) {
versionId = decodedVidResult;
versioning = bucketInfo.isVersioningEnabled();
}

if (versionId === 'null') {
isNull = true;
Expand Down Expand Up @@ -1141,17 +1135,16 @@
}

function _putTagging(request, response, log, cb) {
return handleTaggingOperation(
request, response, 'Put', undefined, log, err => {
if (err) {
log.error('put tagging failed', {
method: '_putTagging',
error: err,
});
return cb(err);
}
return _respond(response, null, log, cb);
});
return handleTaggingOperation(request, null, 'Put', undefined, log, err => {
if (err) {
log.error('put tagging failed', {

Check warning on line 1140 in lib/routes/routeBackbeat.js

View check run for this annotation

Codecov / codecov/patch

lib/routes/routeBackbeat.js#L1140

Added line #L1140 was not covered by tests
method: '_putTagging',
error: err,
});
return cb(err);

Check warning on line 1144 in lib/routes/routeBackbeat.js

View check run for this annotation

Codecov / codecov/patch

lib/routes/routeBackbeat.js#L1144

Added line #L1144 was not covered by tests
}
return _respond(response, null, log, cb);
});
}

function _conditionalTagging(request, response, locations, log, cb) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let gcpBucket;
let gcpBucketMPU;

const isCEPH = process.env.CI_CEPH !== undefined;
const itSkipCeph = isCEPH ? it.skip : it.skip;
const itSkipCeph = isCEPH ? it.skip : it;
const describeSkipIfCeph = isCEPH ? describe.skip : describe.skip; // always skip

if (config.backends.data === 'multiple') {
Expand Down
74 changes: 33 additions & 41 deletions tests/multipleBackend/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const azureClient = getAzureClient();
const containerName = getAzureContainerName(azureLocation);

const ipAddress = process.env.IP ? process.env.IP : '127.0.0.1';
const isNullVersionCompatMode = process.env.ENABLE_NULL_VERSION_COMPAT_MODE === 'true';

const { accessKeyId, secretAccessKey } = getCredentials();

Expand Down Expand Up @@ -379,6 +380,9 @@ describe('backbeat routes', () => {
const objMDAfter = JSON.parse(getMetadataAfterRes.body).Body;
const expectedMd = JSON.parse(objMD);
expectedMd.isNull = true; // TODO remove the line once CLDSRV-509 is fixed
if (!isNullVersionCompatMode) {
expectedMd.isNull2 = true; // TODO remove the line once CLDSRV-509 is fixed
}
assert.deepStrictEqual(JSON.parse(objMDAfter), expectedMd);

const listObjectVersionsRes = results.listObjectVersions;
Expand Down Expand Up @@ -1447,8 +1451,7 @@ describe('backbeat routes', () => {
});
});

// TODO: CLDSRV-394 unskip routeBackbeat tests
describe.skip('backbeat PUT routes', () => {
describe('backbeat PUT routes', () => {
describe('PUT data + metadata should create a new complete object',
() => {
[{
Expand Down Expand Up @@ -1644,11 +1647,9 @@ describe('backbeat routes', () => {
});
});

it('should PUT tags for a non-versioned bucket', function test(done) {
itSkipCeph('should PUT tags for a non-versioned bucket', function test(done) {
this.timeout(10000);
const bucket = NONVERSIONED_BUCKET;
const awsBucket =
config.locationConstraints[awsLocation].details.bucketName;
const awsKey = uuidv4();
async.waterfall([
next =>
Expand Down Expand Up @@ -2153,7 +2154,7 @@ describe('backbeat routes', () => {
});
});
});
describe.skip('backbeat authorization checks', () => {
describe('backbeat authorization checks', () => {
[{ method: 'PUT', resourceType: 'metadata' },
{ method: 'PUT', resourceType: 'data' }].forEach(test => {
const queryObj = test.resourceType === 'data' ? { v2: '' } : {};
Expand Down Expand Up @@ -2271,7 +2272,7 @@ describe('backbeat routes', () => {
});
});

describe.skip('GET Metadata route', () => {
describe('GET Metadata route', () => {
beforeEach(done => makeBackbeatRequest({
method: 'PUT', bucket: TEST_BUCKET,
objectKey: TEST_KEY,
Expand Down Expand Up @@ -2329,14 +2330,12 @@ describe('backbeat routes', () => {
});
});
});
describe.skip('backbeat multipart upload operations', function test() {
describe('backbeat multipart upload operations', function test() {
this.timeout(10000);

// The ceph image does not support putting tags during initiate MPU.
itSkipCeph('should put tags if the source is AWS and tags are ' +
'provided when initiating the multipart upload', done => {
const awsBucket =
config.locationConstraints[awsLocation].details.bucketName;
'provided when initiating the multipart upload', done => {
const awsKey = uuidv4();
const multipleBackendPath =
`/_/backbeat/multiplebackenddata/${awsBucket}/${awsKey}`;
Expand Down Expand Up @@ -2478,19 +2477,16 @@ describe('backbeat routes', () => {
jsonResponse: true,
}, next),
next =>
azureClient.getBlobProperties(
containerName, blob, (err, result) => {
if (err) {
return next(err);
}
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
.then(result => {
const tags = JSON.parse(result.metadata.tags);
assert.deepStrictEqual(tags, { key1: 'value1' });
return next();
}),
}, next),
], done);
});
});
describe.skip('Batch Delete Route', function test() {
describe('Batch Delete Route', function test() {
this.timeout(30000);
it('should batch delete a local location', done => {
let versionId;
Expand Down Expand Up @@ -2549,7 +2545,8 @@ describe('backbeat routes', () => {
}),
], done);
});
it('should batch delete a versioned AWS location', done => {

itSkipCeph('should batch delete a versioned AWS location', done => {
let versionId;
const awsKey = `${TEST_BUCKET}/batch-delete-test-key-${makeid(8)}`;

Expand Down Expand Up @@ -2689,7 +2686,7 @@ describe('backbeat routes', () => {
], done);
});

it('should not put tags if the source is not Azure and ' +
itSkipCeph('should not put tags if the source is not Azure and ' +
'if-unmodified-since condition is not met', done => {
const awsKey = uuidv4();
async.series([
Expand Down Expand Up @@ -2734,7 +2731,7 @@ describe('backbeat routes', () => {
], done);
});

it('should put tags if the source is not Azure and ' +
itSkipCeph('should put tags if the source is not Azure and ' +
'if-unmodified-since condition is met', done => {
const awsKey = uuidv4();
let lastModified;
Expand Down Expand Up @@ -2809,8 +2806,8 @@ describe('backbeat routes', () => {
const blob = uuidv4();
async.series([
next =>
azureClient.createBlockBlobFromText(
containerName, blob, 'a', null, next),
azureClient.getContainerClient(containerName).uploadBlockBlob(blob, 'a', 1)
.then(() => next(), next),
next =>
makeRequest({
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -2842,14 +2839,11 @@ describe('backbeat routes', () => {
return next(err);
}),
next =>
azureClient.getBlobProperties(
containerName, blob, (err, result) => {
if (err) {
return next(err);
}
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
.then(result => {
assert(result);
return next();
}),
}, next),
], done);
});

Expand All @@ -2859,17 +2853,14 @@ describe('backbeat routes', () => {
let lastModified;
async.series([
next =>
azureClient.createBlockBlobFromText(
containerName, blob, 'a', null, next),
azureClient.getContainerClient(containerName).uploadBlockBlob(blob, 'a', 1)
.then(() => next(), next),
next =>
azureClient.getBlobProperties(
containerName, blob, (err, result) => {
if (err) {
return next(err);
}
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
.then(result => {
lastModified = result.lastModified;
return next();
}),
}, next),
next =>
makeRequest({
authCredentials: backbeatAuthCredentials,
Expand All @@ -2895,10 +2886,11 @@ describe('backbeat routes', () => {
jsonResponse: true,
}, next),
next =>
azureClient.getBlobProperties(containerName, blob, err => {
assert(err.statusCode === 404);
return next();
}),
azureClient.getContainerClient(containerName).getBlobClient(blob).getProperties()
.then(() => assert.fail('Expected error'), err => {
assert.strictEqual(err.statusCode, 404);
return next();
}),
], done);
});
});
Expand Down
25 changes: 15 additions & 10 deletions tests/multipleBackend/routes/routeVeeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ describe('veeam PUT routes:', () => {
.then(() => done())
.catch(err => {
process.stdout.write(`Error creating bucket: ${err}\n`);
throw err;
done(err);
});
});
after(done => {
bucketUtil.empty(TEST_BUCKET)
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
.then(() => done());
.then(() => done())
.catch(done);
});

[
Expand Down Expand Up @@ -224,13 +225,14 @@ describe('veeam GET routes:', () => {
.then(() => done())
.catch(err => {
process.stdout.write(`Error creating bucket: ${err}\n`);
throw err;
done(err);
});
});
afterEach(done => {
bucketUtil.empty(TEST_BUCKET)
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
.then(() => done());
.then(() => done())
.catch(done);
});

[
Expand Down Expand Up @@ -358,13 +360,14 @@ describe('veeam DELETE routes:', () => {
.then(() => done())
.catch(err => {
process.stdout.write(`Error creating bucket: ${err}\n`);
throw err;
done(err);
});
});
afterEach(done => {
bucketUtil.empty(TEST_BUCKET)
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
.then(() => done());
.then(() => done())
.catch(done);
});

[
Expand Down Expand Up @@ -469,13 +472,14 @@ describe('veeam HEAD routes:', () => {
.then(() => done())
.catch(err => {
process.stdout.write(`Error creating bucket: ${err}\n`);
throw err;
done(err);
});
});
afterEach(done => {
bucketUtil.empty(TEST_BUCKET)
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
.then(() => done());
.then(() => done())
.catch(done);
});

[
Expand Down Expand Up @@ -554,12 +558,13 @@ describe.skip('veeam LIST routes:', () => {
.then(() => done())
.catch(err => {
process.stdout.write(`Error creating bucket: ${err}\n`);
throw err;
done(err);
});
});
afterEach(done => {
bucketUtil.empty(TEST_BUCKET)
.then(() => s3.deleteBucket({ Bucket: TEST_BUCKET }).promise())
.then(() => done());
.then(() => done())
.catch(done);
});
});
Loading