Skip to content

Commit

Permalink
Merge branch 'uat-dev' into fix-otf
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo authored Aug 2, 2023
2 parents b3a3396 + 66d062e commit a530bb4
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,27 @@ public void connect(String clientDeviceId, String componentId, String brokerId,
throw lastException;
}

/**
* Renames connection.
*
* @param clientDeviceId the id of the device (thing name) as defined by user in scenario
* @param newConnectionName new name of the connection
* @throws RuntimeException throws in fail case
*/
@And("I rename connection {string} to {string}")
public void renameConnection(String clientDeviceId, String newConnectionName) {
final String clientDeviceThingName = getClientDeviceThingName(clientDeviceId);
ConnectionControl connectionControl = getConnectionControl(clientDeviceThingName);

// Add test id to new name
final String newConnectionNameWithTestId = getClientDeviceThingName(newConnectionName);
connectionControl.setConnectionName(newConnectionNameWithTestId);

log.info("Connection {} was renamed to {}",
clientDeviceThingName,
newConnectionNameWithTestId);
}

/**
* Try to create MQTT connection to broker and ensure connection has been failed.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,116 @@ Feature: GGMQ-1
| mqtt-v | name | agent | recipe | publish-status-na |
| v5 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml | 0 |

@GGMQ-1-T25
Scenario Outline: GGMQ-1-T25-<mqtt-v>-<name>: As a customer, I connect with same client id twice (not reconnect) and be able to publish and subscribe to messages.
When I create a Greengrass deployment with components
| aws.greengrass.clientdevices.Auth | LATEST |
| aws.greengrass.clientdevices.mqtt.EMQX | LATEST |
| aws.greengrass.clientdevices.IPDetector | LATEST |
| <agent> | classpath:/local-store/recipes/<recipe> |
And I create client device "publisher"
And I create client device "subscriber"
When I associate "publisher" with ggc
When I associate "subscriber" with ggc
And I update my Greengrass deployment configuration, setting the component aws.greengrass.clientdevices.Auth configuration to:
"""
{
"MERGE":{
"deviceGroups":{
"formatVersion":"2021-03-05",
"definitions":{
"MyPermissiveDeviceGroup":{
"selectionRule":"thingName: ${publisher} OR thingName: ${subscriber}",
"policyName":"MyPermissivePolicy"
}
},
"policies":{
"MyPermissivePolicy":{
"AllowAll":{
"statementDescription":"Allow client devices to perform all actions.",
"operations":[
"*"
],
"resources":[
"*"
]
}
}
}
}
}
}
"""

And I update my Greengrass deployment configuration, setting the component <agent> configuration to:
"""
{
"MERGE":{
"controlAddresses":"${mqttControlAddresses}",
"controlPort":"${mqttControlPort}"
}
}
"""

And I deploy the Greengrass deployment configuration
Then the Greengrass deployment is COMPLETED on the device after 5 minutes
And the aws.greengrass.clientdevices.mqtt.EMQX log on the device contains the line "is running now!." within 1 minutes

Then I discover core device broker as "localMqttBroker1" from "publisher" in OTF
Then I discover core device broker as "localMqttBroker2" from "subscriber" in OTF
And I connect device "publisher" on <agent> to "localMqttBroker1" using mqtt "<mqtt-v>"
And I connect device "subscriber" on <agent> to "localMqttBroker2" using mqtt "<mqtt-v>"

When I subscribe "subscriber" to "iot_data_0" with qos 1
When I publish from "publisher" to "iot_data_0" with qos 1 and message "Test message"
And message "Test message" received on "subscriber" from "iot_data_0" topic within 5 seconds
And I rename connection "publisher" to "publisher_old"

# Reconnect publisher with the same device id
And I connect device "publisher" on <agent> to "localMqttBroker1" using mqtt "<mqtt-v>"
When I publish from "publisher" to "iot_data_0" with qos 1 and message "Connect again"
And message "Connect again" received on "subscriber" from "iot_data_0" topic within 5 seconds

@mqtt3 @sdk-java
Examples:
| mqtt-v | name | agent | recipe |
| v3 | sdk-java | aws.greengrass.client.Mqtt5JavaSdkClient | client_java_sdk.yaml |

@mqtt3 @mosquitto-c @SkipOnWindows
Examples:
| mqtt-v | name | agent | recipe |
| v3 | mosquitto-c | aws.greengrass.client.MqttMosquittoClient | client_mosquitto_c.yaml |

@mqtt3 @paho-java
Examples:
| mqtt-v | name | agent | recipe |
| v3 | paho-java | aws.greengrass.client.Mqtt5JavaPahoClient | client_java_paho.yaml |

@mqtt3 @paho-python
Examples:
| mqtt-v | name | agent | recipe |
| v3 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml |

@mqtt5 @sdk-java
Examples:
| mqtt-v | name | agent | recipe |
| v5 | sdk-java | aws.greengrass.client.Mqtt5JavaSdkClient | client_java_sdk.yaml |

@mqtt5 @mosquitto-c @SkipOnWindows
Examples:
| mqtt-v | name | agent | recipe |
| v5 | mosquitto-c | aws.greengrass.client.MqttMosquittoClient | client_mosquitto_c.yaml |

@mqtt5 @paho-java
Examples:
| mqtt-v | name | agent | recipe |
| v5 | paho-java | aws.greengrass.client.Mqtt5JavaPahoClient | client_java_paho.yaml |

@mqtt5 @paho-python
Examples:
| mqtt-v | name | agent | recipe |
| v5 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml |


@GGMQ-1-T27 @OffTheNetwork
Scenario Outline: GGMQ-1-T27-<mqtt-v>-<name>: As a customer, my Greengrass-issued certificate does not rotate when mqtt reconnects
Expand Down

0 comments on commit a530bb4

Please sign in to comment.