Skip to content
Open
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 @@ -10,6 +10,7 @@ format:
unit-test:
cd uss_qualifier && make unit_test
cd monitorlib && make unit_test
cd benchmarker && make unit_test

image: ../uv.lock ../pyproject.toml $(shell find . -type f ! -path "*/output/*" ! -path "*/.*" ! -path "*/__pycache__/*" ! -name image ! -name image-dev ! -name "*.pyc") $(shell find ../interfaces -type f)
./build.sh
Expand Down
3 changes: 3 additions & 0 deletions monitoring/benchmarker/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
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def fake_create_vu(

with (
patch(
"monitoring.benchmarker.engine.loads.user_search.user_search.create_virtual_user",
"monitoring.benchmarker.engine.loads.step_execution.create_virtual_user",
side_effect=fake_create_vu,
),
ThreadPoolExecutor(max_workers=4) as executor,
Expand Down
19 changes: 19 additions & 0 deletions monitoring/benchmarker/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
# the interuss/monitoring-dev image. In that context, this script runs the
# benchmarker unit tests.

# Ensure benchmarker 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
28 changes: 28 additions & 0 deletions monitoring/benchmarker/scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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-dev
)

# shellcheck disable=SC2086
docker run --name benchmarker_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 \
benchmarker/scripts/in_container/run_unit_tests.sh
Loading