Skip to content

Commit ffc3531

Browse files
committed
Adds npm script to test S3 store handler against play.min.io
1 parent 40b4f11 commit ffc3531

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"modular": "PORT=8001 node --watch --trace-warnings ./bin/www -c ./bin/dev-conf.json",
6868
"test": "mocha -u bdd-lazy-var/getter spec/runner.js",
6969
"test-watch": "mocha --watch -u bdd-lazy-var/getter spec/runner.js",
70+
"test-s3-play-min-io": "mocha spec/store_handlers/S3_store_handler.spec.js",
7071
"lint": "eslint --max-warnings=0 \"lib/**/*.js\" \"bin/**/*.js\" \"spec/**/*.js\"",
7172
"lint:fix": "eslint --fix \"lib/**/*.js\" \"bin/**/*.js\" \"spec/**/*.js\""
7273
},

spec/store_handler.spec.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ module.exports.shouldStoreStreams = function () {
9595
const blobs = await this.handler.listAdminBlobs(LIST_DIR_NAME);
9696
expect(blobs).to.have.length(0);
9797

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

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

0 commit comments

Comments
 (0)