Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Chan 3ba26a2030 feature: S3C-1183 add GCP Tag functional tests
Adds GCP S3 functional test for object tagging
2019-02-05 22:05:36 -08:00
1 changed files with 28 additions and 0 deletions

View File

@ -99,6 +99,30 @@ function azureGet(key, tagCheck, isEmpty, callback) {
});
}
function gcpGet(key, tagCheck, isEmpty, isMpu, callback) {
process.stdout.write('Getting object from GCP\n');
gcpClient.getObject({
Bucket: gcpBucket,
Key: key,
}, (err, res) => {
assert.equal(err, null);
if (isEmpty) {
assert.strictEqual(res.ETag, `"${emptyMD5}"`);
} else if (isMpu) {
assert.strictEqual(res.ETag, `"${mpuMD5}"`);
} else {
assert.strictEqual(res.ETag, `"${correctMD5}"`);
}
if (tagCheck) {
const tags = GcpUtils.retrieveTags(res.Metdata);
assert.strictEqual(tags, tagObj);
} else {
assert.strictEqual(res.metadata.tags, undefined);
}
return callback();
});
}
function getObject(key, backend, tagCheck, isEmpty, isMpu, callback) {
function get(cb) {
process.stdout.write('Getting object\n');
@ -127,6 +151,10 @@ function getObject(key, backend, tagCheck, isEmpty, isMpu, callback) {
setTimeout(() => {
get(() => azureGet(key, tagCheck, isEmpty, callback));
}, cloudTimeout);
} else if (backend === 'gcp') {
setTimeout(() => {
get(() => gcpGet(key, tagCheck, isEmpty, isMpu, callback));
}, cloudTimeout);
} else {
get(callback);
}