Skip to content

Switch to integration tests over radio#382

Closed
hrfarmer wants to merge 4 commits into
mainfrom
radio-integration-tests
Closed

Switch to integration tests over radio#382
hrfarmer wants to merge 4 commits into
mainfrom
radio-integration-tests

Conversation

@hrfarmer
Copy link
Copy Markdown
Collaborator

Switch to integration tests over radio

Description

We've changed the physical setup for the CI machine to now use a radio passthrough board to communicate with the CI cube instead of communicating through UART. This will allow us to continuously test radio functionality, as well as in the future add some radio specific tests.

Related Issues/Tickets

Closes #59

How Has This Been Tested?

Will be tested by seeing if integration works on this PR

  • Unit tests
  • Integration tests
  • Z Tests
  • Manual testing (describe steps)

Screenshots / Recordings (if applicable)

Checklist

  • Written detailed sdd with requirements, channels, ports, commands, telemetry defined and correctly formatted and spelled
  • Have written relevant integration tests and have documented them in the sdd
  • Have done a code review with
  • Have tested this PR on every supported board with correct board definitions

Further Notes / Considerations

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Build system and CI updated to require and pass a configurable UART device for GDS integration; the integration step now fails with a clear error if no device is provided.
  • Tests
    • Integration test retry count increased to reduce transient failures during command send/assert operations.
    • Integration tests updated to use the standardized send/assert helper across sequence start and RTC alarm operations; explicit per-call timeout was removed where previously set.

Walkthrough

CI and Makefile now require an explicit UART_DEVICE for integration runs: the workflow passes env.GDS_PASSTHROUGH into make gds-integration, and the Makefile enforces/uses UART_DEVICE to supply --uart-device to fprime-gds. Test code switches many sends to proves_send_and_assert_command and increases retries to 4.

Changes

Cohort / File(s) Summary
CI workflow
.github/workflows/ci.yaml
make gds-integration is invoked with UART_DEVICE sourced from env.GDS_PASSTHROUGH (previously no override).
Makefile integration target
Makefile
gds-integration recipe now requires UART_DEVICE, errors and exits if unset, echoes the selected device, and passes --uart-device $(UART_DEVICE) to fprime-gds instead of using a hardcoded /dev/ttyBOARD.
Integration test helper
PROVESFlightControllerReference/test/int/common.py
proves_send_and_assert_command increases retry attempts from 3 to 4 (adds tries constant and updates docstring and retry logic).
Integration tests (RTC)
PROVESFlightControllerReference/test/int/rtc_test.py
Multiple calls converted from fprime_test_api.send_command / send_and_assert_command to proves_send_and_assert_command for sequence creation/start and RTC alarm ops; explicit timeout=5 argument removed from two replaced calls.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nudged the UART, named it true,
CI hands the ribbon through,
Makefile listens, strict and neat,
Tests will try once more to meet,
A tiny hop — the devs say woo!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Switch to integration tests over radio' directly describes the main change across all modified files—CI workflow, Makefile, and test code now execute integration tests via radio instead of UART.
Description check ✅ Passed The description covers the core rationale (radio passthrough setup, continuous radio testing), links issue #59, marks integration tests as completed, but leaves most SDD and checklist items unchecked despite being in the template.
Linked Issues check ✅ Passed Code changes directly address issue #59's acceptance criteria: CI workflow and Makefile now pass UART_DEVICE environment variable for radio communication [#59], and test code refactored to use retry-safe helper function [#59].
Out of Scope Changes check ✅ Passed All four file changes are scoped to enabling radio-based integration test execution: CI variable passthrough, Makefile UART_DEVICE requirement, test helper retry logic, and test invocations. No unrelated changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 352-357: The gds-integration Makefile target currently falls back
to /dev/ttyBOARD; change it to fail fast when UART_DEVICE is empty by checking
$(UART_DEVICE) and if unset print a clear error (e.g., "UART_DEVICE is required
for gds-integration") to stderr and exit non‑zero instead of using
/dev/ttyBOARD; keep using $(GDS_COMMAND) --gui=none --uart-device $(UART_DEVICE)
when provided and remove the silent default reference to /dev/ttyBOARD so CI
must supply UART_DEVICE explicitly.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0fbbd2b7-7fc0-4513-a3ab-361448c41cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 8fe2589 and 1e20e01.

📒 Files selected for processing (2)
  • .github/workflows/ci.yaml
  • Makefile

Comment thread Makefile Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • Makefile

Commit: 9b08e1e322a6754e724b0aebb56e041c897d816e

The changes have been pushed to the radio-integration-tests branch.

Time taken: 1m 30s

coderabbitai Bot and others added 3 commits April 26, 2026 03:11
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@PROVESFlightControllerReference/test/int/rtc_test.py`:
- Around line 314-323: The test test_06_rtc_alarm_cancellation contradicts its
docstring: after sending ALARM_SET then ALARM_CANCEL it currently calls
fprime_test_api.await_event(f"{rtcManager}.AlarmTriggered") which waits for the
alarm to fire; replace that positive wait with a negative assertion (e.g., call
the test framework's event-count assertion such as
fprime_test_api.assert_event_count(f"{rtcManager}.AlarmTriggered", count=0,
timeout=10) or an equivalent "assert no events" helper) so the test verifies the
AlarmTriggered event does NOT occur after cancellation; update the call
referencing fprime_test_api.await_event accordingly and keep the preceding
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL")
unchanged.
- Line 336: The ALARM_CANCEL calls to proves_send_and_assert_command are missing
the required ID parameter and/or passing it with the wrong type; update both
calls invoking f"{rtcManager}.ALARM_CANCEL" to include the mandatory ID argument
and pass it as a string (e.g., "0") so args is a list[str] — ensure the call
signatures to proves_send_and_assert_command include args like ["0"] for the
ALARM_CANCEL command.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 89aa30af-4041-4051-9aaa-97f93ad389b6

📥 Commits

Reviewing files that changed from the base of the PR and between 5127126 and e080e4d.

📒 Files selected for processing (1)
  • PROVESFlightControllerReference/test/int/rtc_test.py

Comment on lines +314 to 323
proves_send_and_assert_command(
fprime_test_api,
f"{rtcManager}.ALARM_SET",
[alarm_time_data_str],
)

# Cancel the alarm immediately
fprime_test_api.send_command(f"{rtcManager}.ALARM_CANCEL")
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL")

fprime_test_api.await_event(f"{rtcManager}.AlarmTriggered", timeout=10)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Test logic contradicts the docstring.

The test is named test_06_rtc_alarm_cancellation and the docstring states it should verify that "it does not trigger", but line 323 uses await_event which waits for AlarmTriggered to occur. This appears to test the opposite of what's documented.

If the intent is to verify the alarm does not trigger after cancellation, you should use assert_event_count with count=0 or a similar negative assertion pattern.

🐛 Proposed fix to verify alarm does NOT trigger
     # Cancel the alarm immediately
     proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL")

-    fprime_test_api.await_event(f"{rtcManager}.AlarmTriggered", timeout=10)
+    # Wait past when the alarm would have triggered, then verify no AlarmTriggered event
+    time.sleep(7)  # Wait longer than the 5-second alarm delay
+    triggered_events = fprime_test_api.get_event_test_history().retrieve(
+        fprime_test_api.get_event_pred(f"{rtcManager}.AlarmTriggered")
+    )
+    assert len(triggered_events) == 0, "Alarm should not have triggered after cancellation"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@PROVESFlightControllerReference/test/int/rtc_test.py` around lines 314 - 323,
The test test_06_rtc_alarm_cancellation contradicts its docstring: after sending
ALARM_SET then ALARM_CANCEL it currently calls
fprime_test_api.await_event(f"{rtcManager}.AlarmTriggered") which waits for the
alarm to fire; replace that positive wait with a negative assertion (e.g., call
the test framework's event-count assertion such as
fprime_test_api.assert_event_count(f"{rtcManager}.AlarmTriggered", count=0,
timeout=10) or an equivalent "assert no events" helper) so the test verifies the
AlarmTriggered event does NOT occur after cancellation; update the call
referencing fprime_test_api.await_event accordingly and keep the preceding
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL")
unchanged.


# validate that cancel doesn't work without an alarm being present
fprime_test_api.send_command(f"{rtcManager}.ALARM_CANCEL", [0])
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL", [0])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the ALARM_CANCEL command definition to understand expected arguments
rg -n "ALARM_CANCEL" --type-add 'fpp:*.fpp' --type=fpp -A5 -B2

Repository: Open-Source-Space-Foundation/proves-core-reference

Length of output: 1048


🏁 Script executed:

# Check the actual test file around lines 321 and 336
sed -n '315,345p' PROVESFlightControllerReference/test/int/rtc_test.py

Repository: Open-Source-Space-Foundation/proves-core-reference

Length of output: 1086


🏁 Script executed:

# Find and examine the proves_send_and_assert_command function definition
rg -n "def proves_send_and_assert_command" -A 10

Repository: Open-Source-Space-Foundation/proves-core-reference

Length of output: 1118


ALARM_CANCEL missing required argument and type mismatch.

The ALARM_CANCEL command requires a mandatory ID: U16 parameter (per RtcManager.fpp). However, line 321 calls it without any arguments, which will fail. Additionally, line 336 attempts to provide the argument as [0], but the function signature expects args: list[str], making this a type mismatch (integer vs string).

Context
Line 321:
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL")

Line 336:
proves_send_and_assert_command(fprime_test_api, f"{rtcManager}.ALARM_CANCEL", [0])

Command definition in RtcManager.fpp:

sync command ALARM_CANCEL(
    ID: U16 @< ID of the alarm to cancel
)

Function signature:

def proves_send_and_assert_command(
    fprime_test_api: IntegrationTestAPI,
    command: str,
    args: list[str] = [],
    ...
)

Both calls need fixing: line 321 needs the argument added, and line 336 needs the argument as a string (e.g., ["0"]).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@PROVESFlightControllerReference/test/int/rtc_test.py` at line 336, The
ALARM_CANCEL calls to proves_send_and_assert_command are missing the required ID
parameter and/or passing it with the wrong type; update both calls invoking
f"{rtcManager}.ALARM_CANCEL" to include the mandatory ID argument and pass it as
a string (e.g., "0") so args is a list[str] — ensure the call signatures to
proves_send_and_assert_command include args like ["0"] for the ALARM_CANCEL
command.

@Mikefly123
Copy link
Copy Markdown
Contributor

Superseded by #391. Thanks for getting the ball rolling here @hrfarmer!

@Mikefly123 Mikefly123 closed this May 26, 2026
@github-project-automation github-project-automation Bot moved this to Done in V1.X.X May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] Integration tests run over radio instead of UART

2 participants