Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds npm script to test S3 store handler against play.min.io #122

Merged
merged 1 commit into from
Aug 29, 2024
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"modular": "PORT=8001 node --watch --trace-warnings ./bin/www -c ./bin/dev-conf.json",
"test": "mocha -u bdd-lazy-var/getter spec/runner.js",
"test-watch": "mocha --watch -u bdd-lazy-var/getter spec/runner.js",
"test-s3-play-min-io": "mocha spec/store_handlers/S3_store_handler.spec.js",
"lint": "eslint --max-warnings=0 \"lib/**/*.js\" \"bin/**/*.js\" \"spec/**/*.js\"",
"lint:fix": "eslint --fix \"lib/**/*.js\" \"bin/**/*.js\" \"spec/**/*.js\""
},
Expand Down
5 changes: 4 additions & 1 deletion spec/store_handler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module.exports.shouldStoreStreams = function () {
const blobs = await this.handler.listAdminBlobs(LIST_DIR_NAME);
expect(blobs).to.have.length(0);

const startTime = new Date();
const content = 'indifferent content';
this.listBlobPath = path.join(LIST_DIR_NAME, 'some-file.yaml');
await this.handler.upsertAdminBlob(this.listBlobPath, 'text/plain', content);
Expand All @@ -105,7 +106,9 @@ module.exports.shouldStoreStreams = function () {
// contentType is optional
expect(blobs2[0].contentLength).to.equal(content.length);
expect(typeof blobs2[0].ETag).to.equal('string');
expect(new Date(blobs2[0].lastModified)).to.be.lessThanOrEqual(new Date());
// allows one second of clock skew between S3 server and this server
expect(new Date(blobs2[0].lastModified)).to.be.lessThanOrEqual(new Date(Date.now() + 1000));
expect(new Date(blobs2[0].lastModified)).to.be.greaterThanOrEqual(new Date(startTime - 1000));

await this.handler.deleteAdminBlob(this.listBlobPath);

Expand Down