Skip to content

Commit

Permalink
Fix log references and cf.merge before validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepruitt committed Jun 11, 2018
1 parent 23af9c9 commit d2a0c28
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ module.exports = (options = {}) => {
Type: 'AWS::Logs::MetricFilter',
Properties: {
FilterPattern: '"[failure]"',
LogGroupName: cf.ref(prefixed('Logs')),
LogGroupName: cf.ref(prefixed('LogGroup')),
MetricTransformations: [{
MetricName: cf.join([prefixed('WorkerErrors-'), cf.stackName]),
MetricNamespace: 'Mapbox/ecs-watchbot',
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/template.jest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ Object {
"Properties": Object {
"FilterPattern": "\\"[failure]\\"",
"LogGroupName": Object {
"Ref": "SoupLogs",
"Ref": "SoupLogGroup",
},
"MetricTransformations": Array [
Object {
Expand Down Expand Up @@ -1264,7 +1264,7 @@ Object {
"Properties": Object {
"FilterPattern": "\\"[failure]\\"",
"LogGroupName": Object {
"Ref": "WatchbotLogs",
"Ref": "WatchbotLogGroup",
},
"MetricTransformations": Array [
Object {
Expand Down
8 changes: 4 additions & 4 deletions test/template.validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const cf = require('@mapbox/cloudfriend');
const template = require('../lib/template');

test('[template validation] defaults', async (assert) => {
const builtWithDefaults = template({
const builtWithDefaults = cf.merge(template({
service: 'example',
serviceVersion: '1',
command: 'echo hello world',
cluster: 'processing',
notificationEmail: 'hello@mapbox.pagerduty.com'
});
}));

const tmp = path.join(os.tmpdir(), crypto.randomBytes(8).toString('hex'));
fs.writeFileSync(tmp, JSON.stringify(builtWithDefaults));
Expand All @@ -31,7 +31,7 @@ test('[template validation] defaults', async (assert) => {
});

test('[template validation] options set', async (assert) => {
const setsAllOptions = template({
const setsAllOptions = cf.merge(template({
service: 'example',
serviceVersion: '1',
command: 'echo hello world',
Expand Down Expand Up @@ -59,7 +59,7 @@ test('[template validation] options set', async (assert) => {
messageTimeout: 300,
messageRetention: 1096,
notificationEmail: 'hello@mapbox.pagerduty.com'
});
}));

const tmp = path.join(os.tmpdir(), crypto.randomBytes(8).toString('hex'));
fs.writeFileSync(tmp, JSON.stringify(setsAllOptions));
Expand Down
6 changes: 3 additions & 3 deletions test/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ test('[worker] waitFor, exit 0', async (assert) => {
assert.ok(results.duration, 'logged worker success duration');
assert.equal(message.complete.callCount, 1, 'called message.complete()');

assert.equal(fsExtra.emptyDir.callCount, 2, 'called fsExtra.emptyDir() twice')
assert.ok(fsExtra.emptyDir.calledWith('/tmp'), 'called fsExtra.emptyDir() on /tmp')
assert.ok(fsExtra.emptyDir.calledWith('/var/tmp'), 'called fsExtra.emptyDir() on /tmp')
assert.equal(fsExtra.emptyDir.callCount, 2, 'called fsExtra.emptyDir() twice');
assert.ok(fsExtra.emptyDir.calledWith('/tmp'), 'called fsExtra.emptyDir() on /tmp');
assert.ok(fsExtra.emptyDir.calledWith('/var/tmp'), 'called fsExtra.emptyDir() on /tmp');

fsExtra.emptyDir.restore();
Date.prototype.toGMTString.restore();
Expand Down

0 comments on commit d2a0c28

Please sign in to comment.