This framework is a collection of building blocks to support end to end automation from the customer perspective, using Cucumber as the feature driver. AWS Greengrass uses these very same building blocks to qualify software changes on variable devices.
- AWS Resource Management (
aws-greengrass-testing-resources
) - A platform abstraction over Java Process API
- A bunch of common steps (
aws-greengrass-testing-features
) - Ability for the features to be driven through IDT.
- Some example use-cases and components (
aws-greengrass-testing-components
) - Service discovery for extensions like other AWS resources, steps, and configuration.
Special first time instructions
This is needed to pull in the latest StreamManger SDK and install them locally for building.
Unix Based Systems
If this directory ./aws-greengrass-testing-components/aws-greengrass-testing-components-streammanager/lib/streammanager
already exists within your project, remove it by running
rm -rf ./aws-greengrass-testing-components/aws-greengrass-testing-components-streammanager/lib/streammanager
This ensures that when running the next commands you are getting a fresh version of the submodules that this project loads
From the root of the project run
git submodule update --init
mvn process-resources
Windows
In order for the git submodule update --init
command to work on Windows the core.longpaths
setting
needs to be enabled on git. To do that:
- Open a command prompt as an Administrator
- Run
git config --global core.longpaths true
This is required because Windows has a limit of 260 chars for file names and when pulling the submodules, the file names are paths that are longer than 260 characters which cause pulling the submodule to fail.
Note:
After enabling core.longpaths
,
If this directory .\aws-greengrass-testing-components\aws-greengrass-testing-components-streammanager\lib\streammanager
already exists within your project, remove it by running (you can also delete the folder using the UI):
rm .\aws-greengrass-testing-components\aws-greengrass-testing-components-streammanager\lib\streammanager
This ensures that when running the next commands you are getting a fresh version of the submodules that this project loads
From the root of the project run
git submodule update --init
mvn process-resources
When pulling the submodule succeeds you should be able to find this jar on
aws-greengrass-testing-components/aws-greengrass-testing-components-streammanager/lib/streammanager/sdk/aws-greengrass-stream-manager-sdk-java.jar
Regular compilation instructions
Replace compile
with package
to build shaded jars.
mvn clean compile
Run integration tests for the example component
- Download latest greengrass archive at the example component path
curl https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-nucleus-latest.zip -o aws-greengrass-testing-examples/aws-greengrass-testing-examples-component/greengrass-nucleus-latest.zip
-
Get credentials for AWS account. The test needs credentials to identify the AWS account to use and to be able to create test resources in the account. Here is the instruction on how to set up credentials. The credentials need to made available on the device. Some options are:
- Copy temporary credentials and set them as env variables
- Set AWS profile for your environment
-
Run the tests
mvn clean -DskipTests=false -pl aws-greengrass-testing-examples/aws-greengrass-testing-examples-component -am integration-test
- Run mqtt tests
mvn clean -DskipITs=false -pl aws-greengrass-testing-features/aws-greengrass-testing-features-mqtt/ -am integration-test
- Run cloud component tests
mvn clean -DskipTests=false -pl aws-greengrass-testing-features/aws-greengrass-testing-features-cloudcomponent/ -am integration-test
Running tests with HSM configuration
Any test can be run with HSM configuration. HSM configuration parameters are defined here. If ggc.hsm.configured is set to true, then the framework expects the other HSM parameters to be configured. When hsm is configured, this initial config file is used to start the greengrass with. Before you run the tests with HSM, following steps are pre-requisite:
- DUT has the HSM installed.
- A device certificate is created and added to the HSM along with private key. You specify the certificate ARN and hsm labels for key and cert as parameters.
- PKCS library is present either on the host or on the DUT. If the library is already on the DUT, specify the library path with a prefix "dut:"
- Similarly, the pkcs plugin jar can be on the host agent or on the DUT. If it is already on DUT, specify the path with the prefix "dut:"
Debugging test failures
The test logs path is set using the "test.log.path" property in the project. The default value for this will be
"testResults". Thus, by default logs for example component test run will be found at aws-greengrass-testing-examples/aws-greengrass-testing-examples-component/testResults
Fixing licenses
mvn license:format
See CONTRIBUTING for more information.
This project is licensed under the Apache-2.0 License.
GitHub issue is the preferred channel to interact with our team.