Skip to content

Commit 0f3926f

Browse files
committed
refactor(test): Update SITL tests for new Docker containers
Adds Makefile to root for shortcut commands. [skip ci]
1 parent 3138e00 commit 0f3926f

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test-sitl:
2+
python test/sitl/sitl_test_mock_gps_node.py

docs/pages/developer_guide/test/sitl_tests.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
SITL tests
22
____________________________________________________
3-
SITL tests are under the ``test/sitl`` folder. They are simple Python scripts:
3+
SITL tests are under the ``test/sitl`` folder. They are Python scripts. Use the below ``make`` command to run the
4+
SITL test:
45

56
.. code-block:: bash
67
7-
cd ~/colcon_ws/src/gisnav/test/sitl
8-
python sitl_test_mock_gps_node.py
8+
cd ~/colcon_ws/src/gisnav
9+
make test-sitl
10+
11+
.. note::
12+
The ``test/sitl/sitl_test_mock_gps_node.py`` script assumes you have already built the services defined in the
13+
``docker-compose.yaml`` file.
914

1015
Flight Log Analysis
1116
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

test/sitl/sitl_test_mock_gps_node.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from mavsdk import System
1010
from mavsdk.log_files import LogFilesResult, LogFilesError
1111

12-
DOCKER_CONTAINERS = ['gisnav-docker_mapserver_1', 'gisnav-docker_sitl_1']
12+
DOCKER_CONTAINERS = ['gisnav-mapserver-1', 'gisnav-px4-1', 'gisnav-micro-ros-agent-1', 'gisnav-gisnav-1']
1313
SYS_ADDR = 'udp://0.0.0.0:14550'
1414
MISSION_FILE = os.path.join(os.path.dirname(__file__), '../assets/ksql_airport.plan')
15-
MAVLINK_CONNECTION_TIMEOUT_SEC = 15
16-
PRE_FLIGHT_HEALTH_CHECK_TIMEOUT_SEC = 15
15+
MAVLINK_CONNECTION_TIMEOUT_SEC = 30
16+
PRE_FLIGHT_HEALTH_CHECK_TIMEOUT_SEC = 30
1717
LOG_OUTPUT_PATH = os.path.join(os.path.dirname(__file__), 'output')
1818

1919

@@ -79,7 +79,7 @@ async def run():
7979

8080
async def connect_mavlink(drone):
8181
"""Connects to drone via MAVLink"""
82-
print(f'Connecting to drone at "{SYS_ADDR}"...')
82+
print(f'Connecting to drone at "{SYS_ADDR}" (timeout {MAVLINK_CONNECTION_TIMEOUT_SEC} sec)...')
8383
await drone.connect(system_address=SYS_ADDR)
8484
async for state in drone.core.connection_state():
8585
# This might take a while assuming the Docker containers have not had time to start yet
@@ -90,7 +90,7 @@ async def connect_mavlink(drone):
9090

9191
async def check_health(drone):
9292
"""Goes through (pre-flight) health checks"""
93-
print("Going through health-checks...")
93+
print(f"Going through health-checks (timeout {PRE_FLIGHT_HEALTH_CHECK_TIMEOUT_SEC} sec)...")
9494
async for health in drone.telemetry.health():
9595
if health.is_global_position_ok \
9696
and health.is_local_position_ok \

0 commit comments

Comments
 (0)