-
Notifications
You must be signed in to change notification settings - Fork 46
Improvements to the API service testing infrastructure, focusing on robust verification of cross-process communication and race condition handling #775
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
Draft
Nox-MSFT
wants to merge
14
commits into
feature/v-next
Choose a base branch
from
user/nox-msft/v-next-rebased
base: feature/v-next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sh (#761) * Fix warnings and add test for ADUC_HashUtils_GetIndexStrongestValidHash * Add empty line.
* Fix line commented by mistake. From: https://github.com/Azure/iot-hub-device-update/pull/683/files#diff-d78d927b66cbcde558ba994ffb91167110227aadb0380b5f3560c5418c1da96c * Remove unneeded import.
* Update x509 doc * Add X.509 demo script with device-specific naming and DU config generation - 8-step validation, dual thumbprints, IoT Hub connectivity testing - File structure reporting and Ubuntu 20.04 disclaimer * Fixed shellcheck error * docs: add comprehensive X.509 testing framework with dependency management Enhance X.509 authentication documentation and demo script with smart dependency caching, service-aware testing, comprehensive validation, and extensive troubleshooting guidance. Includes build automation and compilation fixes for seamless development workflow. * fix: resolve sign-conversion warnings in command_helper and hash_utils - Fix safeReadSize type usage in command_helper.c - Add explicit cast for loop index in hash_utils.c - Improve type safety in buffer and array operations * feat: enhance X.509 authentication with dual certificates and mandatory IoT Hub validation - Add dual certificate generation (primary/secondary) with unique SHA1 thumbprints for X.509 authentication - Implement mandatory IoT Hub hostname validation for agent testing scenarios - Update demo-setup.sh with comprehensive interactive mode and enhanced certificate management - Add Microsoft package repository setup to resolve deviceupdate-agent dependency issues - Extend agent timeout from 15s to 60s for better testing and validation - Update configuration schema version to 1.2 with new X.509 connection format - Improve connection string validation logging and error messages - Add remote debugging configuration and version updates (1.2.1-private-preview) - Enhance X.509 documentation with production-ready certificate examples Major improvements: * Interactive certificate setup with device registration guidance * Dual certificate workflow supporting IoT Hub primary/secondary thumbprints * Smart dependency management with Microsoft repository integration * Enhanced validation with 8-step certificate verification process * Backward compatibility maintained through symlinks and configuration migration Fixed shellcheck issues: * Add -r flag to all read commands to prevent backslash interpretation * Replace 'cat file | sed' with 'sed < file' for better efficiency * Fix sudo redirect issue by using pipe to tee instead of direct redirection * Add shellcheck source directive for /etc/os-release inclusion * - Add comprehensive parameter change detection and connection testing - Fix output hub hostname * Update x509 demo script and document Remove test-device-twin.sh
* Add prelim doc for GetAduServiceStatus API * Add ADUC_ServiceStatus_Pausing * Update description of command handler and view state manager Clarified the explanation of how the CommandHandler interacts with the ViewStateManager and the ADU service status. * Add packaging, pkgcfg, versioning, ipc sections * update diagrams to include Paused state * fix so lib name i state flow diagram * Add apisvc get_state crossproc api * add utils timer * add idlePauseMilliseconds config * Add out-of-proc SDK wrapper API, docs, and examples * apiproto_utils * arm64 rpi4 integration fixes * updates to doc and unused cmake var * fix typo and apiproto hdr lnk * fix indent adu sdk hdr * rmv stale doc param * set viewstate to Failed on report json failure * put extern g_vsm in hdr * rev schemaVersion 1.2 du-config * add MAX_BUF_LEN macro comment * replace 3 sizeof u16 with MSG_HDR_LEN * add links to yocto repo for sample yocto integration via status_monitor * add missing file headers * add missing file hdr for viewstatemgr * log warn when not init'ed in getter * add RESP_MSG_READ_BUF_SIZE
* flush and wait before close resp fifo * further improvements for rpi4 * fix sdk examples zlog indirect dep and clangformat
* Fix example manufacturer and model fields and add IdlePauseMilliseconds to an example config
…upport - Fix race conditions in apisvc_unit_tests.cpp with unique FIFO paths - Add g_api_svc_ready synchronization flag to apisvc.c - Create container-specific test suite (apisvc_container_unit_tests.cpp) - Add enhanced debugging scripts for container environments: * test-apisvc-debug.sh: Comprehensive test debugging with strace * run-container-tests.sh: Container-aware test runner with monitoring - Update CMakeLists.txt to include container tests with proper timeouts - Enhance GitHub Actions workflow with container debugging capabilities - Add comprehensive documentation for container testing best practices - Fix all shellcheck warnings in debugging scripts The changes address test timeouts and hanging in CI/CD container environments while maintaining compatibility with standard testing workflows.
- Fix Catch2 include path: use catch2/catch_all.hpp instead of catch2/catch.hpp - Fix API includes: use aduc/apiproto.h instead of aduc/proto_utils.h - Replace high-level protocol functions with low-level wire protocol API - Add missing filesystem include for std::filesystem usage - Use ApiWireRequestMsg/ApiWireResponseMsg and msg_send_req/msg_recv_resp - Match the API pattern used in the working apisvc_unit_tests.cpp This resolves the build error: 'catch2/catch.hpp: No such file or directory'
Use 'aduc/apisvc.h' instead of 'apisvc.h' to match the working test file. Remove duplicate include that was causing compilation errors.
Define g_vsm as a local variable instead of declaring it as extern. This matches the pattern used in the working apisvc_unit_tests.cpp.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive improvements to the API service testing infrastructure, focusing on robust verification of cross-process communication and race condition handling. The changes include new documentation, enhanced test implementation, and codebase updates to ensure tests can safely run in parallel without resource conflicts. Additionally, the CI/CD pipeline examples have been updated to include stress testing for race conditions.
API Service Race Condition Testing and Documentation
docs/agent-reference/how-to-test-api-service.md.README.mdanddocs/agent-reference/GetAduServiceStatus.mdto describe API service test procedures, stress testing, and expected outputs. [1] [2] [3] [4]Test Implementation and Infrastructure
apisvc_unit_tests.cppto use unique FIFO paths per test instance, synchronize test startup with service readiness, and implement robust timeout handling, enabling reliable parallel execution and race condition detection. [1] [2]is_api_svc_ready()API and supporting logic inapisvc.c/apisvc.hto allow tests to wait for service readiness, and ensured readiness/reset flags are managed correctly. [1] [2] [3] [4] [5]General Test Code Cleanup
#include <ostream>lines from several test main files for cleaner compilation. [1] [2] [3]CI/CD Pipeline and Platform Support
These changes collectively ensure the API service is robust against race conditions, provide clear instructions for developers and CI/CD systems, and improve reliability and maintainability of the test infrastructure.