|
| 1 | +""" |
| 2 | +power_monitor_test.py: |
| 3 | +
|
| 4 | +Integration tests for the Power Monitor component. |
| 5 | +""" |
| 6 | + |
| 7 | +from datetime import datetime |
| 8 | + |
| 9 | +import pytest |
| 10 | +from common import proves_send_and_assert_command |
| 11 | +from fprime_gds.common.data_types.ch_data import ChData |
| 12 | +from fprime_gds.common.testing_fw.api import IntegrationTestAPI |
| 13 | + |
| 14 | +ina219SysManager = "ReferenceDeployment.ina219SysManager" |
| 15 | +ina219SolManager = "ReferenceDeployment.ina219SolManager" |
| 16 | + |
| 17 | + |
| 18 | +@pytest.fixture(autouse=True) |
| 19 | +def send_packet(fprime_test_api: IntegrationTestAPI, start_gds): |
| 20 | + """Fixture to send the power manager packet before each test""" |
| 21 | + proves_send_and_assert_command( |
| 22 | + fprime_test_api, |
| 23 | + "CdhCore.tlmSend.SEND_PKT", |
| 24 | + ["9"], |
| 25 | + ) |
| 26 | + |
| 27 | + |
| 28 | +def test_01_power_manager_telemetry(fprime_test_api: IntegrationTestAPI, start_gds): |
| 29 | + """Test that we can get Acceleration telemetry""" |
| 30 | + start = datetime.now() |
| 31 | + sys_voltage: ChData = fprime_test_api.assert_telemetry( |
| 32 | + f"{ina219SysManager}.Voltage", start=start, timeout=65 |
| 33 | + ) |
| 34 | + sys_current: ChData = fprime_test_api.assert_telemetry( |
| 35 | + f"{ina219SysManager}.Current", start=start, timeout=65 |
| 36 | + ) |
| 37 | + _: ChData = fprime_test_api.assert_telemetry( |
| 38 | + f"{ina219SysManager}.Power", start=start, timeout=65 |
| 39 | + ) |
| 40 | + sol_voltage: ChData = fprime_test_api.assert_telemetry( |
| 41 | + f"{ina219SolManager}.Voltage", start=start, timeout=65 |
| 42 | + ) |
| 43 | + sol_current: ChData = fprime_test_api.assert_telemetry( |
| 44 | + f"{ina219SolManager}.Current", start=start, timeout=65 |
| 45 | + ) |
| 46 | + _: ChData = fprime_test_api.assert_telemetry( |
| 47 | + f"{ina219SolManager}.Power", start=start, timeout=65 |
| 48 | + ) |
| 49 | + |
| 50 | + sys_voltage_reading: dict[float] = sys_voltage.get_val() |
| 51 | + sys_current_reading: dict[float] = sys_current.get_val() |
| 52 | + # sys_power_reading: dict[float] = sys_power.get_val() |
| 53 | + sol_voltage_reading: dict[float] = sol_voltage.get_val() |
| 54 | + sol_current_reading: dict[float] = sol_current.get_val() |
| 55 | + # sol_power_reading: dict[float] = sol_power.get_val() |
| 56 | + |
| 57 | + assert sys_voltage_reading != 0, "Acceleration reading should be non-zero" |
| 58 | + assert sys_current_reading != 0, "Acceleration reading should be non-zero" |
| 59 | + # assert sys_power_reading != 0, "Acceleration reading should be non-zero" |
| 60 | + assert sol_voltage_reading != 0, "Acceleration reading should be non-zero" |
| 61 | + assert sol_current_reading != 0, "Acceleration reading should be non-zero" |
| 62 | + # assert sol_power_reading != 0, "Acceleration reading should be non-zero" |
0 commit comments