-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iotevents): allow setting description, evaluation method and key of DetectorModel #18644
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
49b3387
feat(iotevents): allow setting `description`, `evaluationMethod` and …
yamatatsu 3dc2d35
Merge branch 'master' into iotevents-dm-other-properties
yamatatsu 3ee41a6
address comments
yamatatsu dba6fd4
Merge branch 'master' into iotevents-dm-other-properties
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -76,10 +76,15 @@ test('can get detector model name', () => { | |
}); | ||
}); | ||
|
||
test('can set physical name', () => { | ||
test.each([ | ||
['physical name', { detectorModelName: 'test-detector-model' }, { DetectorModelName: 'test-detector-model' }], | ||
['description', { description: 'test-detector-model-description' }, { DetectorModelDescription: 'test-detector-model-description' }], | ||
['evaluationMethod', { evaluationMethod: iotevents.EventEvaluation.SERIAL }, { EvaluationMethod: 'SERIAL' }], | ||
['detectorKey', { detectorKey: 'payload.deviceId' }, { Key: 'payload.deviceId' }], | ||
])('can set %s', (_, partialProps, expected) => { | ||
// WHEN | ||
new iotevents.DetectorModel(stack, 'MyDetectorModel', { | ||
detectorModelName: 'test-detector-model', | ||
...partialProps, | ||
initialState: new iotevents.State({ | ||
stateName: 'test-state', | ||
onEnter: [{ | ||
|
@@ -90,9 +95,7 @@ test('can set physical name', () => { | |
}); | ||
|
||
// THEN | ||
Template.fromStack(stack).hasResourceProperties('AWS::IoTEvents::DetectorModel', { | ||
DetectorModelName: 'test-detector-model', | ||
}); | ||
Template.fromStack(stack).hasResourceProperties('AWS::IoTEvents::DetectorModel', expected); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's just do all 3 in one test. Spreading them out like that just makes the tests longer, it doesn't really improve coverage in any way. |
||
|
||
test('can set multiple events to State', () => { | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ class TestStack extends cdk.Stack { | |
|
||
const input = new iotevents.Input(this, 'MyInput', { | ||
inputName: 'test_input', | ||
attributeJsonPaths: ['payload.temperature'], | ||
attributeJsonPaths: ['payload.deviceId', 'payload.temperature'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, why are we changing existing things? |
||
}); | ||
|
||
const onlineState = new iotevents.State({ | ||
|
@@ -27,6 +27,9 @@ class TestStack extends cdk.Stack { | |
|
||
new iotevents.DetectorModel(this, 'MyDetectorModel', { | ||
detectorModelName: 'test-detector-model', | ||
description: 'test-detector-model-description', | ||
evaluationMethod: iotevents.EventEvaluation.SERIAL, | ||
detectorKey: 'payload.deviceId', | ||
initialState: onlineState, | ||
}); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change - seems unrelated to the rest of this PR...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified this for the sake of reality.
The path passed in
detectorKey
must be declared in thisattributeJsonPaths
. And the value passed indetectorKey
is often the unique value of the device or device group.This is because IoT Events is often used to monitor devices and device groups.
I modified integ test for the same reason.