Repository navigation
ci(perception): run unit tests in CI, check launch default devices - #126
Merged
Merged
Conversation
CI only ran test/deploy, and the unit tests in test/ aren't installed in the image, so they never ran in CI. A new "Unit tests" step mounts src/perception/test read-only into each deploy image (cpu and gpu) and runs it without test/deploy, before the deploy tests. test/deploy/test_launch_defaults.py loads every installed launch file that declares a `device` argument and checks the image can run its default: onnxruntime has the provider, and for tensorrt the TensorRT library (nvinfer) is installed, since onnxruntime-gpu lists the TensorRT provider without it. The other deploy tests choose the device with pick_device(), so a default the image can't run went unnoticed until the node failed at startup. docker/README.md: describe the new test and how to run the unit tests against a deploy image.
… step launch_testing 3.4.13's pytest plugin returns False from a tryfirst pytest_ignore_collect hook, so pytest's own --ignore handling never runs (ros2/launch#1047, fixed on jazzy after 3.4.13 but not released yet). The unit test step therefore also collected test/deploy, whose tests need the model mount and failed. Turn off the launch_testing and launch_ros pytest plugins for the unit tests, which don't use them. Drop the flags once the image has a newer launch_testing.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CI only ran
test/deploy, and the unit tests insrc/perception/test/aren't installed in the image, so they never ran in CI. This PR runs them, and adds a deploy test for something no test covered: whether the image can run thedevicethe launch files default to.Changes
Unit tests in CI (
.github/workflows/perception-images.yml): a newUnit testsstep, before the deploy tests, mountssrc/perception/testread-only into each deploy image (cpu and gpu) and runspytest -p no:cacheprovider /opt/ap1/unit-tests --ignore=/opt/ap1/unit-tests/deploy. The tests stay out of the image the car runs.test/deploy/test_launch_defaults.py: loads every installedlaunch/*.launch.pythat declares adeviceargument, reads its default (fromAP1_GPU), and checks the image can run it:cpu/cuda/tensorrt: onnxruntime lists the providertensorrt: TensorRT's library (nvinfer) is also installed, because onnxruntime-gpu lists the TensorRT provider even without itauto: always fine (falls back to CPU); any other value failsThe other deploy tests pick the device with
pick_device(), so a launch default the image can't run went unnoticed until the node failed at startup (this is what Perception/91 road seg v0 #123'stensorrtdefault does on the GPU image).docker/README.md: Tests section describes the new test and how to run the unit tests against a deploy image.Testing
test/minusdeploy), as the new CI step runs them: 15 passedtest_launch_defaults.py, current launch files: 10 passed withAP1_GPU=0, and 10 passed withAP1_GPU=1plus onnxruntime-gpu's provider listAP1_GPU=1: fails as intended:road_seg.launch.py: device='tensorrt': library 'nvinfer' not found(same foryolo.launch.py)AP1_GPU=1run on CPU onnxruntime, which reportsavailable: ['CPUExecutionProvider'].Notes
cuda. Its own unit tests (test_runtime.py,test_road_seg.py) will run in CI too.find_librarysearches the linker cache andLD_LIBRARY_PATH. If Switch model runtime from ONNX to TensorRT #98 installs TensorRT from pip (libraries inside site-packages), that path has to be onLD_LIBRARY_PATHfor onnxruntime anyway, and this test checks the same thing.Note
Low Risk
Changes add CI coverage and a read-only test mount; no production runtime or auth paths are modified.
Overview
CI for perception Docker images now runs unit tests in addition to deploy tests: after each image build,
src/perception/testis mounted read-only into the container andpytestruns withdeployexcluded, using-p no:cacheproviderand disabled launch_testing plugins so--ignoreworks on the current image.A new deploy test
test_launch_defaults.pywalks installed launch files, reads eachdevicedefault (e.g. fromAP1_GPU), and fails if the image lacks the needed onnxruntime providers or libraries (such asnvinferfortensorrt). Existing deploy tests pick the device themselves, so mismatched launch defaults were previously undetected.docker/README.mddocuments the launch-default test and reproduces the CI unit-testdocker composeinvocation, including the launch_testing workaround.Reviewed by Cursor Bugbot for commit 156556c. Bugbot is set up for automated code reviews on this repo. Configure here.