Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ format:
.PHONY: unit-test
unit-test:
cd uss_qualifier && make unit_test
cd monitorlib && make unit_test

image: ../uv.lock ../pyproject.toml $(shell find . -type f ! -path "*/output/*" ! -name image ! -name *.pyc) $(shell find ../interfaces -type f)
./build.sh
Expand Down
3 changes: 3 additions & 0 deletions monitoring/monitorlib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: unit_test
unit_test:
./scripts/run_unit_tests.sh
19 changes: 19 additions & 0 deletions monitoring/monitorlib/scripts/in_container/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -eo pipefail

# This script is intended to be called from within a Docker container running
# mock_uss via the interuss/monitoring image. In that context, this script is
# the entrypoint into the test definition validation tool.

# Ensure uss_qualifier is the working directory
OS=$(uname)
if [[ $OS == "Darwin" ]]; then
# OSX uses BSD readlink
BASEDIR="$(dirname "$0")"
else
BASEDIR=$(readlink -e "$(dirname "$0")")
fi
cd "${BASEDIR}/../.." || exit 1

uv run pytest
29 changes: 29 additions & 0 deletions monitoring/monitorlib/scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -eo pipefail
set -o xtrace

# Find and change to repo root directory
OS=$(uname)
if [[ "$OS" == "Darwin" ]]; then
# OSX uses BSD readlink
BASEDIR="$(dirname "$0")"
else
BASEDIR=$(readlink -e "$(dirname "$0")")
fi
cd "${BASEDIR}/../../.." || exit 1

(
cd monitoring || exit 1
make image
)

# shellcheck disable=SC2086
docker run --name monitorlib_unit_test \
--rm \
-e MONITORING_GITHUB_ROOT=${MONITORING_GITHUB_ROOT:-} \
-v "$(pwd):/app" \
-v /var/run/docker.sock:/var/run/docker.sock \
interuss/monitoring-dev \
monitorlib/scripts/in_container/run_unit_tests.sh

Loading