Skip to content

Commit

Permalink
Add discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
sfodagain committed Jun 5, 2024
1 parent 6a1e7c7 commit f1b5d08
Show file tree
Hide file tree
Showing 26 changed files with 344 additions and 26 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -430,21 +430,22 @@ jobs:
with:
role-to-assume: ${{ env.CI_GREENGRASS_INSTALLER_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
# - name: Build and run Greengrass basic discovery sample
# working-directory: ./aws-iot-device-sdk-python-v2/test/greengrass/basic_discovery
# run: |
# gdk component build
# gdk test-e2e build
# gdk test-e2e run
# - name: Show logs
# working-directory: ./aws-iot-device-sdk-python-v2/test/greengrass/basic_discovery
# # Print logs unconditionally to provide more details on Greengrass run even if the test failed.
# if: always()
# run: |
# echo "=== greengrass.log"
# cat testResults/gg*/greengrass.log
# echo "=== software.amazon.awssdk.sdk-gg-test-discovery.log"
# cat testResults/gg*/software.amazon.awssdk.sdk-gg-test-discovery.log
- name: Build and run Greengrass basic discovery sample
working-directory: ./aws-iot-device-sdk-python-v2/test/greengrass/basic_discovery
run: |
export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-python-v2/samples
gdk component build
gdk test-e2e build
gdk test-e2e run
- name: Show logs
working-directory: ./aws-iot-device-sdk-python-v2/test/greengrass/basic_discovery
# Print logs unconditionally to provide more details on Greengrass run even if the test failed.
if: always()
run: |
echo "=== greengrass.log"
cat testResults/gg*/greengrass.log
echo "=== software.amazon.awssdk.sdk-gg-test-discovery.log"
cat testResults/gg*/software.amazon.awssdk.sdk-gg-test-discovery.log
- name: Build and run Greengrass IPC sample
working-directory: ./aws-iot-device-sdk-python-v2/test/greengrass/ipc
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_basic_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"name": "--key",
"secret": "ci/PubSub/key",
"filename": "tmp_key.pem"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_cognito_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"name": "--cognito_identity",
"secret": "ci/Cognito/identity_id"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_custom_authorizer_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"name": "--custom_auth_password",
"secret": "ci/CustomAuthorizer/password"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_fleet_provisioning_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"name": "--template_parameters",
"data": "{\"SerialNumber\":\"$INPUT_UUID\"}"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
7 changes: 3 additions & 4 deletions .github/workflows/ci_run_greengrass_discovery_cfg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"language": "CPP",
"runnable_file": "basic-discovery",
"language": "Python",
"runnable_file": "basic_discovery.py",
"runnable_region": "us-east-1",
"runnable_main_class": "",
"arguments": [
Expand Down Expand Up @@ -30,6 +30,5 @@
"name": "--mode",
"data": "publish"
}
],
"stdin_file": "messages.txt"
]
}
1 change: 0 additions & 1 deletion .github/workflows/ci_run_greengrass_ipc_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
"name": "--is_ci",
"data": "true"
}

]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_jobs_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"name": "--thing_name",
"data": "CI_Jobs_Thing"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_mqtt5_custom_authorizer_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"name": "--custom_auth_password",
"secret": "ci/CustomAuthorizer/password"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
{
"name": "--use_websockets",
"data": "true"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_mqtt5_fleet_provisioning_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"name": "--template_parameters",
"data": "{\"SerialNumber\":\"$INPUT_UUID\"}"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_mqtt5_jobs_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
{
"name": "--thing_name",
"data": "CI_Jobs_Thing"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_mqtt5_pkcs11_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
{
"name": "--key_label",
"data": "my-key"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_pkcs11_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
{
"name": "--key_label",
"data": "my-key"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_pkcs12_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"name": "--pkcs12_password",
"secret": "ci/PubSub/key_pkcs12_password"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_websocket_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
{
"name": "--signing_region",
"data": "us-east-1"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_windows_cert_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"windows_cert_key": "ci/PubSub/key",
"windows_cert_key_path": "tmp_key.pem",
"windows_cert_pfx_key_path": "tmp_pfx.pem"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/ci_run_x509_connect_cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
{
"name": "--x509_thing_name",
"data": "CI_PubSub_Thing"
},
{
"name": "--is_ci",
"data": "true"
}
]
}
6 changes: 3 additions & 3 deletions samples/basic_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def on_publish(topic, payload, dup, qos, retain, **kwargs):
message['message'] = cmdData.input_message
message['sequence'] = loop_count
messageJson = json.dumps(message)
pub_future, _ = mqtt_connection.publish(cmdData.input_topic, messageJson, QoS.AT_MOST_ONCE)
pub_future.result()
print('Published topic {}: {}\n'.format(cmdData.input_topic, messageJson))
pub_future, _ = mqtt_connection.publish(cmdData.input_topic, messageJson, QoS.AT_LEAST_ONCE)
publish_completion_data = pub_future.result()
print('Published topic {}: {} (puback reason: {})\n'.format(cmdData.input_topic, messageJson, repr(publish_completion_data.puback.reason_code)))

loop_count += 1
time.sleep(1)
3 changes: 3 additions & 0 deletions test/greengrass/basic_discovery/copy_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cp ../../../samples/basic_discovery.py .
cp ../../../utils/run_in_ci.py .
cp ../../../.github/workflows/ci_run_greengrass_discovery_cfg.json .
22 changes: 22 additions & 0 deletions test/greengrass/basic_discovery/gdk-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"component": {
"software.amazon.awssdk.sdk-gg-test-discovery": {
"author": "iot-device-sdk",
"version": "NEXT_PATCH",
"build": {
"build_system": "custom",
"custom_build_command": ["bash", "copy_files.sh"]
},
"publish": {
"bucket": "iot-sdk-ci-bucket-us-east-1",
"region": "us-east-1"
}
}
},
"gdk_version": "1.3.0",
"test-e2e": {
"gtf_options": {
"tags": "testgg"
}
}
}
63 changes: 63 additions & 0 deletions test/greengrass/basic_discovery/gg-e2e-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.aws.greengrass</groupId>
<artifactId>uat-features</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>OTF</name>

<properties>
<otf.version>1.2.0-SNAPSHOT</otf.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>greengrass-common</id>
<name>greengrass common</name>
<!-- CloudFront url fronting the aws-greengrass-testing-standalone in S3-->
<url>https://d2jrmugq4soldf.cloudfront.net/snapshots</url>
</repository>
</repositories>

<dependencies>
<!-- Open Testing Framework dependency - Source Code: https://github.com/aws-greengrass/aws-greengrass-testing -->
<dependency>
<groupId>com.aws.greengrass</groupId>
<artifactId>aws-greengrass-testing-standalone</artifactId>
<version>${otf.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.aws.greengrass.testing.launcher.TestLauncher</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit f1b5d08

Please sign in to comment.