Repository navigation
Add MQTTManager unit test harness and CI #392
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
Open
jamesmulcahy
wants to merge
23
commits into
NSPManager:devel
Choose a base branch
from
jamesmulcahy:feat/mqttmanager-test-harness
base: devel
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.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
cd37c4c
Add MQTTManager unit test harness
jamesmulcahy b0c8233
Run the MQTTManager tests in GitHub Actions
jamesmulcahy e6b194d
Report MQTTManager test results in the GitHub Actions job summary
jamesmulcahy 277a41d
Add MQTTManager tests for switches, buttons, scenes, thermostats, med…
jamesmulcahy 9cf277d
Initialise the room temperature provider
jamesmulcahy 1708131
Check for the NSPM controller in the NSPMButton constructor
jamesmulcahy b2fc6ff
Add OpenHAB switch, scene and thermostat tests
jamesmulcahy c1d2357
Add NSPanel config and command tests
jamesmulcahy ed5c916
Send the room temperature sensor topic to panels again
jamesmulcahy 602dc33
Don't crash on a thermostat temperature limit that isn't a number
jamesmulcahy 70748ec
Initialise NSPanel humidity, pressure and relay members
jamesmulcahy f14983c
Keep panels that haven't been accepted in AWAITING_ACCEPT
jamesmulcahy dfc4d77
Detach all NSPanel callbacks when a panel is destroyed
jamesmulcahy bd75534
Round decimal thermostat limits instead of truncating them
jamesmulcahy 15d5173
Initialise the OpenhabThermostat debounce timestamps
jamesmulcahy 05ff4ea
Initialise the OpenhabLight group event state
jamesmulcahy b70be42
Test Home Assistant script activation from panels end to end
jamesmulcahy 2255a0c
Don't run static destructors when the test binary exits
jamesmulcahy 8dd5425
Report crashes in the test binary with the test name and a backtrace
jamesmulcahy bb551d3
Lock the MQTT retained message buffer
jamesmulcahy 554e30c
Hold _rooms_mutex when changing or walking EntityManager's room list
jamesmulcahy af5e62e
Remove the unused openhab_rgb_channel_name setting
jamesmulcahy e778e80
Build the tests' fake HTTP server on ix::HttpServer
jamesmulcahy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: "MQTTManager tests" | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "docker/MQTTManager/**" | ||
| - ".github/workflows/mqttmanager-tests.yml" | ||
| push: | ||
| branches: | ||
| - "main" | ||
| - "devel" | ||
| paths: | ||
| - "docker/MQTTManager/**" | ||
| - ".github/workflows/mqttmanager-tests.yml" | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| # Building the Conan dependencies from source takes about an hour when the cache is cold. | ||
| timeout-minutes: 120 | ||
| env: | ||
| # Host directory mounted as the container's Conan package cache (see run_tests.sh). | ||
| NSPM_TEST_CONAN_CACHE: ${{ github.workspace }}/.conan-cache | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Restore Conan packages | ||
| id: conan-cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ env.NSPM_TEST_CONAN_CACHE }} | ||
| key: mqttmanager-conan-${{ hashFiles('docker/MQTTManager/conanfile.py', 'docker/MQTTManager/tests/docker/Dockerfile') }} | ||
| restore-keys: mqttmanager-conan- | ||
|
|
||
| - name: Build and run tests | ||
| run: | | ||
| mkdir -p "$NSPM_TEST_CONAN_CACHE" | ||
| docker/MQTTManager/run_tests.sh | ||
| env: | ||
| NSPM_TEST_RESULTS_DIR: ${{ github.workspace }}/test-results | ||
|
|
||
| # annotate_only writes the job summary and failure annotations without creating a | ||
| # check run, which needs checks: write and so fails on pull requests from forks. | ||
| - name: Report test results | ||
| if: ${{ !cancelled() }} | ||
| uses: mikepenz/action-junit-report@v6 | ||
| with: | ||
| report_paths: test-results/*.xml | ||
| annotate_only: true | ||
| detailed_summary: true | ||
| include_passed: true | ||
| require_tests: true | ||
|
|
||
| # Saved even when the tests fail, so a failing test does not cost another dependency build. | ||
| - name: Save Conan packages | ||
| if: always() && steps.conan-cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: ${{ env.NSPM_TEST_CONAN_CACHE }} | ||
| key: ${{ steps.conan-cache.outputs.cache-primary-key }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,4 @@ firmware/NSPanelManagerFirmware/CMakeLists.txt | |
|
|
||
| # MacOS | ||
| .DS_Store | ||
| docker/MQTTManager/tests/last_run.log | ||
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
This is awesome. I'll need to look into doing this when doing the actual release builds as well.