Skip to content

Commit

Permalink
Adds npm script to test S3 store handler against play.min.io
Browse files Browse the repository at this point in the history
  • Loading branch information
DougReeder committed Aug 29, 2024
1 parent 40b4f11 commit ffc3531
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit ffc3531

Please sign in to comment.