-
Notifications
You must be signed in to change notification settings - Fork 642
[PR from CLI tool] Hygiene changes in MQTT demos and tests #1128
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
Changes from all commits
5b206c3
3895075
28f8b75
7e6461b
f025a5e
9557d63
107122f
429264a
7621886
10e289f
161f341
37f0344
e17c728
bbd9b40
0eae5f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,9 +51,10 @@ | |
| #error "SERVER_ROOT_CA_CERT_PATH should be defined for the MQTT integration tests." | ||
| #endif | ||
|
|
||
| #ifndef CLIENT_IDENTIFIER | ||
| #error "CLIENT_IDENTIFIER should be defined for the MQTT integration tests." | ||
| #endif | ||
| /** | ||
| * @brief Length of MQTT server host name. | ||
| */ | ||
| #define BROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( BROKER_ENDPOINT ) - 1 ) ) | ||
|
|
||
| /** | ||
| * @brief A valid starting packet ID per MQTT spec. Start from 1. | ||
|
|
@@ -711,6 +712,9 @@ void setUp() | |
| memset( &incomingInfo, 0u, sizeof( MQTTPublishInfo_t ) ); | ||
| memset( &opensslCredentials, 0u, sizeof( OpensslCredentials_t ) ); | ||
| opensslCredentials.pRootCaPath = SERVER_ROOT_CA_CERT_PATH; | ||
| opensslCredentials.pClientCertPath = CLIENT_CERT_PATH; | ||
| opensslCredentials.pPrivateKeyPath = CLIENT_PRIVATE_KEY_PATH; | ||
|
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. Should this be here? Do the system tests need mutual auth? 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. I was suggested to use mutual auth by @abhidixi11. They don't strictly require, but we should run the integration tests on the transport layer that we require for connecting to AWS |
||
|
|
||
| serverInfo.pHostName = BROKER_ENDPOINT; | ||
| serverInfo.hostNameLength = BROKER_ENDPOINT_LENGTH; | ||
| serverInfo.port = BROKER_PORT; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,22 +50,8 @@ | |
| /** | ||
| * @brief MQTT server host name. | ||
| * | ||
| * This test uses the Mosquitto test server. This is a public MQTT server; do not | ||
| * publish anything sensitive to this server. | ||
| * Mosquitto MQTT broker can run locally as an alternate option. Please refer to | ||
| * the instructions in https://mosquitto.org/ for running a Mosquitto broker | ||
| * locally. | ||
| * #define BROKER_ENDPOINT "...insert here..." | ||
| */ | ||
| #ifndef BROKER_ENDPOINT | ||
| #define BROKER_ENDPOINT "test.mosquitto.org" | ||
| #endif | ||
|
|
||
| /** | ||
| * @brief Length of MQTT server host name. | ||
| */ | ||
| #ifndef BROKER_ENDPOINT_LENGTH | ||
| #define BROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( BROKER_ENDPOINT ) - 1 ) ) | ||
| #endif | ||
|
|
||
| /** | ||
| * @brief MQTT server port number. | ||
|
|
@@ -75,21 +61,23 @@ | |
| #define BROKER_PORT ( 8883 ) | ||
|
|
||
| /** | ||
| * @brief Path of the file containing the server's root CA certificate. | ||
| * @brief Path of the file containing the client certificate. | ||
| * | ||
| * This certificate should be PEM-encoded. | ||
| * #define CLIENT_CERT_PATH "...insert here..." | ||
| */ | ||
| #ifndef SERVER_ROOT_CA_CERT_PATH | ||
| #define SERVER_ROOT_CA_CERT_PATH "certificates/mosquitto.org.crt" | ||
| #endif | ||
|
|
||
| /** | ||
| * @brief MQTT client identifier. | ||
| * @brief Path of the file containing the client's private key. | ||
| * | ||
| * No two clients may use the same client identifier simultaneously. | ||
| * #define CLIENT_PRIVATE_KEY_PATH "...insert here..." | ||
| */ | ||
|
|
||
| /** | ||
| * @brief Path of the file containing the server's root CA certificate. | ||
| * | ||
| * This certificate should be PEM-encoded. | ||
| * | ||
| * * #define SERVER_ROOT_CA_CERT_PATH "...insert here..." | ||
| */ | ||
| #ifndef CLIENT_IDENTIFIER | ||
| #define CLIENT_IDENTIFIER "testclient" | ||
|
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. Was this meant to be removed? 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. Yes, as this config wasn't used by the integration test. There are separate macros used by the tests |
||
| #endif | ||
|
|
||
| #endif /* ifndef TEST_CONFIG_H_ */ | ||
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.
Should this be an absolute path?
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.
It is supposed to be provided by the user through CMake configuration.
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.
Something of this sort is needed? https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/development/demos/CMakeLists.txt#L58
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 was referring to the CMake configuration command passed by the user.
I don't see much value in pre-pending the absolute path with $PWD as that would pre-pend the path (to the certificate) from where the cmake command is run (which is most likely in the
builddirectory), and can cause unexpected failure to occur due to the path pre-pending. As the CI team will be providing the absolute path to the credential files in their CMake command, I think that suffices.