-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92f8dc8
commit 32f3135
Showing
9 changed files
with
396 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "scality" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Dependency directory | ||
node_modules | ||
|
||
# Logs | ||
logs | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "zenko", | ||
"version": "1.0.0", | ||
"directories": { | ||
"doc": "docs", | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "cd tests/ && mocha -t 90000 clueso-tests/", | ||
"lint": "eslint $(git ls-files '*.js')" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/scality/Zenko.git" | ||
}, | ||
"author": "", | ||
"license": "", | ||
"bugs": { | ||
"url": "https://github.com/scality/Zenko/issues" | ||
}, | ||
"homepage": "https://github.com/scality/Zenko#readme", | ||
"devDependencies": { | ||
"async": "^2.6.0", | ||
"aws-sdk": "^2.169.0", | ||
"eslint": "2.13.1", | ||
"eslint-config-airbnb": "6.2.0", | ||
"eslint-config-scality": "scality/Guidelines", | ||
"mocha": "^4.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
const s3Client = require('../utils/s3SDK'); | ||
const runAndCheckSearch = require('../utils/helpers').runAndCheckSearch; | ||
|
||
const objectKey = 'findMe'; | ||
const hiddenKey = 'leaveMeAlone'; | ||
const userMetadata = { food: 'pizza' }; | ||
const updatedUserMetadata = { food: 'cake' }; | ||
|
||
|
||
describe('Basic search', () => { | ||
const bucketName = `basicsearchmebucket${Date.now()}`; | ||
before(done => { | ||
s3Client.createBucket({ Bucket: bucketName }, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
return s3Client.putObject({ Bucket: bucketName, Key: objectKey, | ||
Metadata: userMetadata }, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
return s3Client.putObject({ Bucket: bucketName, | ||
Key: hiddenKey }, | ||
err => { | ||
// give ingestion pipeline some time | ||
setTimeout(() => done(err), 45000); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
after(done => { | ||
s3Client.deleteObjects({ Bucket: bucketName, Delete: { Objects: [ | ||
{ Key: objectKey }, | ||
{ Key: hiddenKey }], | ||
} }, | ||
err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
return s3Client.deleteBucket({ Bucket: bucketName }, done); | ||
}); | ||
}); | ||
|
||
it('should list object with searched for system metadata', done => { | ||
const encodedSearch = encodeURIComponent(`key="${objectKey}"`); | ||
return runAndCheckSearch(s3Client, bucketName, | ||
encodedSearch, objectKey, done); | ||
}); | ||
|
||
it('should list object with searched for user metadata', done => { | ||
const encodedSearch = | ||
encodeURIComponent('userMd.\`x-amz-meta-food\`' + | ||
`="${userMetadata.food}"`); | ||
return runAndCheckSearch(s3Client, bucketName, encodedSearch, | ||
objectKey, done); | ||
}); | ||
|
||
it('should return empty listing when no object has user md', done => { | ||
const encodedSearch = | ||
encodeURIComponent('userMd.\`x-amz-meta-food\`="nosuchfood"'); | ||
return runAndCheckSearch(s3Client, bucketName, | ||
encodedSearch, null, done); | ||
}); | ||
|
||
describe('search when overwrite object', () => { | ||
before(done => { | ||
s3Client.putObject({ Bucket: bucketName, Key: objectKey, | ||
Metadata: updatedUserMetadata }, err => { | ||
// give ingestion pipeline some time and make sure | ||
// cache expires (60 second cache expiry) | ||
setTimeout(() => done(err), 75000); | ||
}); | ||
}); | ||
|
||
it('should list object with searched for updated user metadata', | ||
done => { | ||
const encodedSearch = | ||
encodeURIComponent('userMd.\`x-amz-meta-food\`' + | ||
`="${updatedUserMetadata.food}"`); | ||
return runAndCheckSearch(s3Client, bucketName, encodedSearch, | ||
objectKey, done); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Search when no objects in bucket', () => { | ||
const bucketName = `noobjectbucket${Date.now()}`; | ||
before(done => { | ||
s3Client.createBucket({ Bucket: bucketName }, done); | ||
}); | ||
|
||
after(done => { | ||
s3Client.deleteBucket({ Bucket: bucketName }, done); | ||
}); | ||
|
||
it('should return empty listing when no objects in bucket', done => { | ||
const encodedSearch = encodeURIComponent(`key="${objectKey}"`); | ||
return runAndCheckSearch(s3Client, bucketName, | ||
encodedSearch, null, done); | ||
}); | ||
}); |
Oops, something went wrong.