-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #307 from getlift/fix-queues-construct-alarm-exten…
…sion Fix queues construct alarm extension
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -620,4 +620,58 @@ describe("queues", () => { | |
MaximumMessageSize: 1024, | ||
}); | ||
}); | ||
|
||
it("allows overriding alarm properties", async () => { | ||
const { cfTemplate, computeLogicalId } = await runServerless({ | ||
fixture: "queues", | ||
configExt: merge({}, pluginConfigExt, { | ||
constructs: { | ||
emails: { | ||
alarm: "[email protected]", | ||
extensions: { | ||
alarm: { | ||
Properties: { | ||
AlarmActions: ["arn:aws:sns:region:account-id:sns-topic-name"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
command: "package", | ||
}); | ||
expect(cfTemplate.Resources[computeLogicalId("emails", "Alarm")].Properties).toMatchObject({ | ||
AlarmActions: ["arn:aws:sns:region:account-id:sns-topic-name"], | ||
}); | ||
}); | ||
|
||
it("should throw if overriding alarm properties while no alarm is configured", async () => { | ||
expect.assertions(2); | ||
|
||
try { | ||
await runServerless({ | ||
fixture: "queues", | ||
configExt: merge({}, pluginConfigExt, { | ||
constructs: { | ||
emails: { | ||
extensions: { | ||
alarm: { | ||
Properties: { | ||
AlarmActions: ["arn:aws:sns:region:account-id:sns-topic-name"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}), | ||
command: "package", | ||
}); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ServerlessError); | ||
expect(error).toHaveProperty( | ||
"message", | ||
"There is no extension 'alarm' available on this construct. Available extensions are: queue, dlq." | ||
); | ||
} | ||
}); | ||
}); |