-
Couldn't load subscription status.
- 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
[PR from CLI tool] Hygiene changes in MQTT demos and tests #1128
Conversation
…d setup to use CMake cache variables for credentials
Codecov Report
@@ Coverage Diff @@
## development #1128 +/- ##
===============================================
+ Coverage 96.54% 98.85% +2.30%
===============================================
Files 9 4 -5
Lines 5643 1309 -4334
Branches 641 393 -248
===============================================
- Hits 5448 1294 -4154
+ Misses 9 0 -9
+ Partials 186 15 -171
Continue to review full report at Codecov.
|
| * Instructions to run Mosquitto on Docker container can be viewed in the | ||
| * README.md of the root directory. | ||
| * | ||
| * #define BROKER_ENDPOINT "...insert here..." |
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 see value in being able to run the demos quickly without having the change a bunch of demo_config.h files or adding extra cmake flags. If we recommend running a broker locally, why not just change all of these to "localhost" instead?
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.
Not sure whether that is necessarily helpful in speeding up the experience of running demos. With localhost, the customer would need to have a broker setup on the same machine. (The customer may very well want to setup their broker on a remote host).
A default value would be more valuable in speeding up the customer experience of running the demo, if the broker is publicly available (as was the case with test.mosquitto.org).
I can instead update the comments to use localhost instead of "...insert here..."
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.
If they want to set up a broker on a remote host, that's their choice, just like they were able to choose to not use test.mosquitto.org before this change. Our wording of running the broker "locally" implies that they'd run it on the same machine as the posix demos, so localhost would be an obvious choice for a default.
If we want these demos to not build without editing these files or without specifying a cmake flag, then we don't need to make any changes; I'm just pointing out that making the change would mean one less cmake flag/one less file to edit for someone who is following our instructions on setting up a local broker
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.
Have added the default configuration back, as I don't strongly feel against it.
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.
Is the mosquitto broker installed and running by default on a machine? If not, when I run this demo , I will get connection refused error - at which point I need to go and debug why the connection was refused and eventually realize the that I do not have a mosquitto broker setup.
Wouldn't a #error be better telling me that I need to setup mosquitto broker.
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.
Yes, I agree that having the default value of localhost can cause more developer effort in identifying the failure cause. Will remove the default value in a separate PR
|
/bot run checks |
Fixed the wording |
…s-iot-device-sdk-embedded-C into hygiene/mqtt-demos-and-tests
| * This certificate should be PEM-encoded. | ||
| */ | ||
| #ifndef CLIENT_IDENTIFIER | ||
| #define CLIENT_IDENTIFIER "testclient" |
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.
Was this meant to be removed?
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.
Yes, as this config wasn't used by the integration test. There are separate macros used by the tests
|
|
||
| /** | ||
| * @brief Length of MQTT server host name. | ||
| * @note If using AWS IoT Core, the endpoint can be found in the AWS IoT console |
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.
Can the AWS IoT Core be used for all of our integration tests? Don't we have tests for the retain flag, which AWS IoT doesn't support?
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.
Good point, have removed all comments pointing to use of AWS IoT from the configs
| 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 comment
The 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 comment
The 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
| if(ROOT_CA_CERT_PATH) | ||
| target_compile_definitions( | ||
| ${stest_name} PRIVATE | ||
| SERVER_ROOT_CA_CERT_PATH="${ROOT_CA_CERT_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.
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 build directory), 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.
…t in basic tls demo_config
|
/bot run checks |
* Upgrade MQTT integration test to use mutual auth, and update its build setup to use CMake cache variables for credentials * Fix build warning from logging * Remove references to test.mosquitto.org from demos
* Upgrade MQTT integration test to use mutual auth, and update its build setup to use CMake cache variables for credentials * Fix build warning from logging * Remove references to test.mosquitto.org from demos
* Upgrade MQTT integration test to use mutual auth, and update its build setup to use CMake cache variables for credentials * Fix build warning from logging * Remove references to test.mosquitto.org from demos
* Upgrade MQTT integration test to use mutual auth, and update its build setup to use CMake cache variables for credentials * Fix build warning from logging * Remove references to test.mosquitto.org from demos
Hygiene Changes
BROKER_ENDPOINTastest.mosquitto.orgin demo_config.h files to avoid suggesting use of the public server. (The public Mosquitto server is unreliable as mentioned in their official documentation). Instead use comment blocks to direct customers to setup Mosquitto locally.mqtt.cfrom logging call.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.