18. Running BRASH tests

Warning

In current active development! Tests are a work in progress and more will be added, so this page is likely to be updated with more information.

18.1. Simple Tests of System

There are a couple of tests you can run to verify message flow between cFE, and the ROS instances on the ground and flight sides.

18.1.1. ROS on the ground side to/from cFE

This test verifies that the CFE_ES housekeeping packet is flowing from the cFE system down to the ROS on the ground side.

  • For all these instructions, make sure you are in “brash_docker” in the terminal.

  • First in one terminal, start the cFE system:

    docker compose -f docker-compose-dev.yml up fsw
    
  • Then in another terminal, start the ROS on the ground side:

    docker compose -f docker-compose-dev.yml up rosgsw
    
  • Then, in another terminal, try running the simple test of data flow between the two:

    docker exec -it  brash_docker-rosgsw-1  bash
    colcon test  --event-handlers console_cohesion+ --ctest-args " -VVV" --return-code-on-test-failure --packages-select cfe_plugin
    
  • If the test is successful, you should see something like this:

    Start 1: test_telemetry_flow
    1: Test command: /usr/bin/python3.10 "-u" "/opt/ros/humble/share/ament_cmake_test/cmake/run_test.py" "/code/brash/build/cfe_plugin/test_results/cfe_plugin/test_telemetry_flow.xunit.xml" "--package-name" "cfe_plugin" "--output-file" "/code/brash/build/cfe_plugin/ament_cmake_pytest/test_telemetry_flow.txt" "--command" "/usr/bin/python3.10" "-u" "-m" "pytest" "/code/brash/src/cfe_ros2_bridge_plugin/cfe_plugin/test/test_telemetry_flow.py" "-o" "cache_dir=/code/brash/build/cfe_plugin/ament_cmake_pytest/test_telemetry_flow/.cache" "--junit-xml=/code/brash/build/cfe_plugin/test_results/cfe_plugin/test_telemetry_flow.xunit.xml" "--junit-prefix=cfe_plugin"
    1: Test timeout computed to be: 90
    1: -- run_test.py: invoking following command in '/code/brash/build/cfe_plugin':
    1:  - /usr/bin/python3.10 -u -m pytest /code/brash/src/cfe_ros2_bridge_plugin/cfe_plugin/test/test_telemetry_flow.py -o cache_dir=/code/brash/build/cfe_plugin/ament_cmake_pytest/test_telemetry_flow/.cache --junit-xml=/code/brash/build/cfe_plugin/test_results/cfe_plugin/test_telemetry_flow.xunit.xml --junit-prefix=cfe_plugin
    1: ============================= test session starts ==============================
    1: platform linux -- Python 3.10.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
    1: cachedir: /code/brash/build/cfe_plugin/ament_cmake_pytest/test_telemetry_flow/.cache
    1: rootdir: /code/brash/src/cfe_ros2_bridge_plugin/cfe_plugin, configfile: pytest.ini
    1: plugins: launch-testing-ros-0.19.7, ament-xmllint-0.12.10, ament-copyright-0.12.10, ament-lint-0.12.10, ament-pep257-0.12.10, launch-testing-1.0.4, ament-flake8-0.12.10, colcon-core-0.15.2
    1: collected 1 item
    1:
    1: ../../src/cfe_ros2_bridge_plugin/cfe_plugin/test/test_telemetry_flow.py . [100%]
    1:
    1: - generated xml file: /code/brash/build/cfe_plugin/test_results/cfe_plugin/test_telemetry_flow.xunit.xml -
    1: ============================== 1 passed in 1.40s ===============================
    1: -- run_test.py: return code 0
    1: -- run_test.py: verify result file '/code/brash/build/cfe_plugin/test_results/cfe_plugin/test_telemetry_flow.xunit.xml'
    1/1 Test #1: test_telemetry_flow ..............   Passed    2.32 sec
    100% tests passed, 0 tests failed out of 1
    Label Time Summary:
    pytest    =   2.32 sec*proc (1 test)
    Total Test time (real) =   2.32 sec
    

18.1.2. cFE to/from ROS on the flight side

This test verifies that the CFE ES housekeeping is making it to the flight side ROS.

  • First in one terminal, start the cFE system:

    $ docker compose -f docker-compose-dev.yml up fsw
    
  • Then in another terminal, start the ROS on the ground side:

    $ docker compose -f docker-compose-dev.yml up rosgsw
    
  • Then in another terminal, start the ROS on the flight side:

    $ docker compose -f docker-compose-dev.yml up rosfsw
    
  • Then in another terminal, try the test:

    $ docker exec -it  brash_docker-rosfsw-1  bash
    $ colcon test  --event-handlers console_cohesion+ --ctest-args " -VVV" --return-code-on-test-failure --packages-select cfe_sbn_plugin
    
  • If the test is successful you should see something like this:

    test 1
    Start 1: test_fsw_telemetry_flow
    1: Test command: /usr/bin/python3.10 "-u" "/opt/ros/humble/share/ament_cmake_test/cmake/run_test.py" "/code/brash/build/cfe_sbn_plugin/test_results/cfe_sbn_plugin/test_fsw_telemetry_flow.xunit.xml" "--package-name" "cfe_sbn_plugin" "--output-file" "/code/brash/build/cfe_sbn_plugin/ament_cmake_pytest/test_fsw_telemetry_flow.txt" "--command" "/usr/bin/python3.10" "-u" "-m" "pytest" "/code/brash/src/cfe_sbn_bridge_plugin/cfe_sbn_plugin/test/test_fsw_telemetry_flow.py" "-o" "cache_dir=/code/brash/build/cfe_sbn_plugin/ament_cmake_pytest/test_fsw_telemetry_flow/.cache" "--junit-xml=/code/brash/build/cfe_sbn_plugin/test_results/cfe_sbn_plugin/test_fsw_telemetry_flow.xunit.xml" "--junit-prefix=cfe_sbn_plugin"
    1: Test timeout computed to be: 90
    1: -- run_test.py: invoking following command in '/code/brash/build/cfe_sbn_plugin':
    1:  - /usr/bin/python3.10 -u -m pytest /code/brash/src/cfe_sbn_bridge_plugin/cfe_sbn_plugin/test/test_fsw_telemetry_flow.py -o cache_dir=/code/brash/build/cfe_sbn_plugin/ament_cmake_pytest/test_fsw_telemetry_flow/.cache --junit-xml=/code/brash/build/cfe_sbn_plugin/test_results/cfe_sbn_plugin/test_fsw_telemetry_flow.xunit.xml --junit-prefix=cfe_sbn_plugin
    1: ============================= test session starts ==============================
    1: platform linux -- Python 3.10.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
    1: cachedir: /code/brash/build/cfe_sbn_plugin/ament_cmake_pytest/test_fsw_telemetry_flow/.cache
    1: rootdir: /code/brash/src/cfe_sbn_bridge_plugin/cfe_sbn_plugin, configfile: pytest.ini
    1: plugins: launch-testing-ros-0.19.7, ament-xmllint-0.12.10, ament-copyright-0.12.10, ament-lint-0.12.10, ament-pep257-0.12.10, launch-testing-1.0.4, ament-flake8-0.12.10, colcon-core-0.15.2
    1: collected 1 item
    1:
    1: ../../src/cfe_sbn_bridge_plugin/cfe_sbn_plugin/test/test_fsw_telemetry_flow.py . [100%]
    1:
    1: - generated xml file: /code/brash/build/cfe_sbn_plugin/test_results/cfe_sbn_plugin/test_fsw_telemetry_flow.xunit.xml -
    1: ============================== 1 passed in 2.60s ===============================
    1: -- run_test.py: return code 0
    1: -- run_test.py: verify result file '/code/brash/build/cfe_sbn_plugin/test_results/cfe_sbn_plugin/test_fsw_telemetry_flow.xunit.xml'
    1/1 Test #1: test_fsw_telemetry_flow ..........   Passed    3.59 sec
    100% tests passed, 0 tests failed out of 1
    Label Time Summary:
    pytest    =   3.59 sec*proc (1 test)
    Total Test time (real) =   3.60 sec