Skip to content

Commit

Permalink
Fixed assume role expiration validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nataniel López committed May 12, 2020
1 parent 9a32c90 commit 55e9280
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/log.js
Expand Up @@ -159,7 +159,7 @@ class Log {

if(this.roleArn) {
firehoseParams.credentials = await this.getCredentials();
this._credentialsExpiration = firehoseParams.credentials.expiration;
this._credentialsExpiration = new Date(firehoseParams.credentials.expiration);
}

this._firehose = new Firehose(firehoseParams);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/log-test.js
Expand Up @@ -92,7 +92,7 @@ describe('Log', () => {
const fakeTime = sandbox.useFakeTimers(new Date().getTime());

sandbox.stub(STS.prototype, 'assumeRole')
.resolves({ ...fakeRole, Expiration: fakeTime.Date() });
.resolves({ ...fakeRole, Expiration: fakeTime.Date().toISOString() });

sandbox.stub(Firehose.prototype, 'putRecordBatch')
.resolves();
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Log', () => {
const fakeTime = sandbox.useFakeTimers(new Date().getTime());

sandbox.stub(STS.prototype, 'assumeRole')
.resolves({ ...fakeRole, Expiration: fakeTime.Date() });
.resolves({ ...fakeRole, Expiration: fakeTime.Date().toISOString() });

sandbox.stub(Firehose.prototype, 'putRecordBatch')
.resolves();
Expand Down Expand Up @@ -153,7 +153,7 @@ describe('Log', () => {
const fakeTime = sandbox.useFakeTimers(new Date().getTime());

sandbox.stub(STS.prototype, 'assumeRole')
.resolves({ ...fakeRole, Expiration: fakeTime.Date() });
.resolves({ ...fakeRole, Expiration: fakeTime.Date().toISOString() });

sandbox.stub(Firehose.prototype, 'putRecordBatch')
.resolves();
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('Log', () => {
const fakeTime = sandbox.useFakeTimers(new Date().getTime());

sandbox.stub(STS.prototype, 'assumeRole')
.resolves({ ...fakeRole, Expiration: fakeTime.Date() });
.resolves({ ...fakeRole, Expiration: fakeTime.Date().toISOString() });

sandbox.stub(Firehose.prototype, 'putRecordBatch')
.throws();
Expand Down

0 comments on commit 55e9280

Please sign in to comment.