Expected Behavior
Tests should pass based on their setup, not on the underlying state of the environment. Or make sure that the test setup loads with a content downloader that does not exist.
In other words, a correctly setup environment should not trigger the tests to fail.
Current Behavior
Test fails if your environment is setup correctly. Currently they only work in CI because the CI environment does not have certain files setup.
Steps to Reproduce
Provide a detailed set of steps to reproduce the bug.
- Setup a content downloader for example:
## configure content downloader extension
so_name="libcurl_content_downloader"
base64digest=$(openssl dgst -binary "/var/lib/adu/extensions/sources/libcurl_content_downloader.so" | openssl base64)
parameters_to_expand="
so_name
base64digest
"
target_filepath="/var/lib/adu/extensions/content_downloader/extension.json"
mkdir -p "$(dirname "$target_filepath")"
cp "scripts/docker/templates/content_downloader.extension.template.json" "$target_filepath"
inline_expand_template_parameters "$parameters_to_expand" "$target_filepath"
-
Test "LoadContentDownloaderLibrary fails when extension load fails and no cached" fails
-
Removing the file /var/lib/adu/extensions/content_downloader/extension.json makes the test pass again.
rm /var/lib/adu/extensions/content_downloader/extension.json
Device Information
- Host OS [e.g. Ubuntu 22.04]: Debian 12
- Architecture [e.g. amd64, arm32, arm64]: amd64
- Provisioning Method: Symmetric key
- DU Agent Version (run 'sudo -u adu /usr/bin/AducIotAgent -v'):
1.4.0
Logs
[ctest] LoadContentDownloaderLibrary fails when extension load fails and no cached
[ctest] -------------------------------------------------------------------------------
[ctest] /workspaces/iot-hub-device-update/src/extensions/extension_manager/tests/src/extension_manager_ut.cpp:417
[ctest] ...............................................................................
[ctest]
[ctest] /workspaces/iot-hub-device-update/src/extensions/extension_manager/tests/src/extension_manager_ut.cpp:424: FAILED:
[ctest] CHECK( result.ResultCode == 0 )
[ctest] with expansion:
[ctest] 1 == 0
[ctest]
[ctest] ===============================================================================
[ctest] test cases: 1 | 1 failed
[ctest] assertions: 1 | 1 failed
[ctest]
[ctest]
[ctest]
[ctest] 0% tests passed, 1 tests failed out of 1
[ctest]
[ctest] Total Test time (real) = 0.02 sec
[ctest]
[ctest] The following tests FAILED:
[ctest] 310 - LoadContentDownloaderLibrary fails when extension load fails and no cached (Failed)
Additional Information
Please provide any additional information that may be helpful in understanding the issue.
If you setup your environment to be able to run AducIotAgent then try to run the tests, the following are failing
The following tests FAILED:
310 - LoadContentDownloaderLibrary fails when extension load fails and no cached (Failed)
311 - IsComponentsEnumeratorRegistered returns false when no enumerator loaded (Failed)
312 - LoadComponentEnumeratorLibrary fails when extension not found (Failed)
313 - InitializeContentDownloader fails when downloader lib not loaded (Failed)
315 - GetAllComponents fails when component enumerator not loadable (Failed)
316 - SelectComponents fails when component enumerator not loadable (Failed)
318 - ExtensionManager_InitializeContentDownloader wrapper returns failure when no downloader (Failed)
339 - GetDownloadTimeoutInMinutes returns downloadOptions value when config has zero timeout (Failed)
342 - GetDownloadTimeoutInMinutes returns default when downloadOptions has zero timeout (Failed)
343 - GetDownloadTimeoutInMinutes returns default for large timeout value in options (Failed)
344 - Default_ExtensionManager_Download_Options can be modified and used (Failed)
Expected Behavior
Tests should pass based on their setup, not on the underlying state of the environment. Or make sure that the test setup loads with a content downloader that does not exist.
In other words, a correctly setup environment should not trigger the tests to fail.
Current Behavior
Test fails if your environment is setup correctly. Currently they only work in CI because the CI environment does not have certain files setup.
Steps to Reproduce
Provide a detailed set of steps to reproduce the bug.
Test
"LoadContentDownloaderLibrary fails when extension load fails and no cached"failsRemoving the file
/var/lib/adu/extensions/content_downloader/extension.jsonmakes the test pass again.Device Information
1.4.0
Logs
Additional Information
Please provide any additional information that may be helpful in understanding the issue.
If you setup your environment to be able to run AducIotAgent then try to run the tests, the following are failing
The following tests FAILED: 310 - LoadContentDownloaderLibrary fails when extension load fails and no cached (Failed) 311 - IsComponentsEnumeratorRegistered returns false when no enumerator loaded (Failed) 312 - LoadComponentEnumeratorLibrary fails when extension not found (Failed) 313 - InitializeContentDownloader fails when downloader lib not loaded (Failed) 315 - GetAllComponents fails when component enumerator not loadable (Failed) 316 - SelectComponents fails when component enumerator not loadable (Failed) 318 - ExtensionManager_InitializeContentDownloader wrapper returns failure when no downloader (Failed) 339 - GetDownloadTimeoutInMinutes returns downloadOptions value when config has zero timeout (Failed) 342 - GetDownloadTimeoutInMinutes returns default when downloadOptions has zero timeout (Failed) 343 - GetDownloadTimeoutInMinutes returns default for large timeout value in options (Failed) 344 - Default_ExtensionManager_Download_Options can be modified and used (Failed)