-
Notifications
You must be signed in to change notification settings - Fork 6
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
ported all tests in shadow-8.feature #162
Open
jiangpta
wants to merge
2
commits into
aws-greengrass:main
Choose a base branch
from
jiangpta:shadow8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
219 changes: 219 additions & 0 deletions
219
uat/testing-features/src/main/resources/greengrass/features/shadow-8.feature
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 |
---|---|---|
@@ -0,0 +1,219 @@ | ||
@Shadow @Shadow-8 @Greengate @beta | ||
Feature: Shadow-8 | ||
|
||
As a developer, I can set the sync directionality. | ||
|
||
Background: | ||
Given my device is registered as a Thing | ||
And my device is running Greengrass | ||
And I start an assertion server | ||
When I add random shadow for MyThing with name MyThingNamedShadow in context | ||
When I add random shadow for MyThing2 with name MyThingNamedShadow2 in context | ||
|
||
@functional @JavaSDK @smoke @RunWithHSM | ||
Scenario: Shadow-8-T1: As a developer, I can sync a local named shadow between cloud and device. | ||
When I create a Greengrass deployment with components | ||
| aws.greengrass.Nucleus | LATEST | | ||
| aws.greengrass.ShadowManager | LATEST | | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.ShadowManager configuration to: | ||
""" | ||
{ | ||
"MERGE":{ | ||
"synchronize":{ | ||
"direction": "betweenDeviceAndCloud", | ||
"shadowDocuments":[ | ||
{ | ||
"thingName":"${MyThing}", | ||
"classic":false, | ||
"namedShadows":[ | ||
"${MyThingNamedShadow}" | ||
] | ||
}, | ||
{ | ||
"thingName":"${MyThing2}", | ||
"classic":true | ||
} | ||
], | ||
"provideSyncStatus":true, | ||
"maxOutboundSyncUpdatesPerSecond":50 | ||
}, | ||
"shadowDocumentSizeLimitBytes":8192, | ||
"maxDiskUtilizationMegaBytes":16 | ||
} | ||
} | ||
""" | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.Nucleus configuration to: | ||
""" | ||
{"MERGE":{"logging": {"level": "DEBUG"}}} | ||
""" | ||
And I deploy the Greengrass deployment configuration | ||
Then the Greengrass deployment is COMPLETED on the device after 4 minutes | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "UpdateThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}", | ||
"ExpectedShadowDocument": "{\"version\":1,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Updated shadow document" within 15 seconds | ||
Then I can get cloud shadow for MyThing with name MyThingNamedShadow with state {"state":{"reported":{"color":{"r":255,"g":255,"b":255},"SomeKey":"SomeValue"}}} within 30 seconds | ||
When I can create cloud shadow for MyThing with name MyThingNamedShadow with state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} | ||
Then I can get cloud shadow for MyThing with version 2 and state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} within 30 seconds | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "GetThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"version\":2,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":0,\"b\":0},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Retrieved matching shadow document" within 15 seconds | ||
|
||
Scenario: Shadow-8-T2: As a developer, I can sync a local named shadow from device to cloud and not vice versa. | ||
When I create a Greengrass deployment with components | ||
| aws.greengrass.Nucleus | LATEST | | ||
| aws.greengrass.ShadowManager | LATEST | | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.ShadowManager configuration to: | ||
""" | ||
{ | ||
"MERGE":{ | ||
"synchronize":{ | ||
"direction": "deviceToCloud", | ||
"shadowDocuments":[ | ||
{ | ||
"thingName":"${MyThing}", | ||
"classic":false, | ||
"namedShadows":[ | ||
"${MyThingNamedShadow}" | ||
] | ||
}, | ||
{ | ||
"thingName":"${MyThing2}", | ||
"classic":true | ||
} | ||
], | ||
"provideSyncStatus":true, | ||
"maxOutboundSyncUpdatesPerSecond":50 | ||
}, | ||
"shadowDocumentSizeLimitBytes":8192, | ||
"maxDiskUtilizationMegaBytes":16 | ||
} | ||
} | ||
""" | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.Nucleus configuration to: | ||
""" | ||
{"MERGE":{"logging": {"level": "DEBUG"}}} | ||
""" | ||
And I deploy the Greengrass deployment configuration | ||
Then the Greengrass deployment is COMPLETED on the device after 4 minutes | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "UpdateThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}", | ||
"ExpectedShadowDocument": "{\"version\":1,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Updated shadow document" within 15 seconds | ||
Then I can get cloud shadow for MyThing with version 1 and state {"state":{"reported":{"color":{"r":255,"g":255,"b":255},"SomeKey":"SomeValue"}}} within 30 seconds | ||
When I can create cloud shadow for MyThing with name MyThingNamedShadow with state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} | ||
Then I can get cloud shadow for MyThing with version 2 and state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} within 30 seconds | ||
# Local should still have version 1 of the shadow document | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "GetThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"version\":1,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Retrieved matching shadow document" within 15 seconds | ||
|
||
Scenario: Shadow-8-T3: As a developer, I can sync a local named shadow from cloud to device and not vice versa. | ||
When I create a Greengrass deployment with components | ||
| aws.greengrass.Nucleus | LATEST | | ||
| aws.greengrass.ShadowManager | LATEST | | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.ShadowManager configuration to: | ||
""" | ||
{ | ||
"MERGE":{ | ||
"synchronize":{ | ||
"direction": "cloudToDevice", | ||
"shadowDocuments":[ | ||
{ | ||
"thingName":"${MyThing}", | ||
"classic":false, | ||
"namedShadows":[ | ||
"${MyThingNamedShadow}" | ||
] | ||
}, | ||
{ | ||
"thingName":"${MyThing2}", | ||
"classic":true | ||
} | ||
], | ||
"provideSyncStatus":true, | ||
"maxOutboundSyncUpdatesPerSecond":50 | ||
}, | ||
"shadowDocumentSizeLimitBytes":8192, | ||
"maxDiskUtilizationMegaBytes":16 | ||
} | ||
} | ||
""" | ||
And I update my Greengrass deployment configuration, setting the component aws.greengrass.Nucleus configuration to: | ||
""" | ||
{"MERGE":{"logging": {"level": "DEBUG"}}} | ||
""" | ||
|
||
And I deploy the Greengrass deployment configuration | ||
Then the Greengrass deployment is COMPLETED on the device after 4 minutes | ||
When I can create cloud shadow for MyThing with name MyThingNamedShadow with state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} | ||
Then I can get cloud shadow for MyThing with version 1 and state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} within 30 seconds | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "GetThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"version\":1,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":0,\"b\":0},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Retrieved matching shadow document" within 15 seconds | ||
When I install the component ShadowComponentPing from local store with configuration | ||
""" | ||
{ | ||
"MERGE":{ | ||
"assertionServerPort": ${assertionServerPort}, | ||
"Operation": "UpdateThingShadow", | ||
"ThingName": "MyThing", | ||
"ShadowName": "MyThingNamedShadow", | ||
"ShadowDocument": "{\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}", | ||
"ExpectedShadowDocument":"{\"version\":2,\"state\":{\"reported\":{\"color\":{\"r\":255,\"g\":255,\"b\":255},\"SomeKey\":\"SomeValue\"}}}" | ||
} | ||
} | ||
""" | ||
Then I get 1 assertions with context "Updated shadow document" within 15 seconds | ||
# Cloud should still have version 1 of the shadow document | ||
Then I can get cloud shadow for MyThing with version 1 and state {"state":{"reported":{"color":{"r":255,"g":0,"b":0},"SomeKey":"SomeValue"}}} within 30 seconds |
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.
All of the shadow documents should have
\\\
. Other than that, rest of the PR looks good.