Skip to content

Commit

Permalink
Use appropriate image for coverage script
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Nov 4, 2024
1 parent 4ce4ee4 commit 513136f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:

- name: Run integration tests
run:
make test_client
make image_client test_client

- name: Get integration test coverage
id: coverage
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ all_client: test_client coverage_client
image_client:
${PWD}/bin/build_image.sh client

test_client: image_client
test_client:
${PWD}/bin/run_tests.sh client

coverage_client:
Expand Down
11 changes: 8 additions & 3 deletions bin/check_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ check_args()
check_coverage()
{
check_args "$@"
export $(echo_versioner_env_vars)

local -r TYPE="${1}" # {server|client}
local -r TEST_LOG=test.log
local -r HOST_TEST_DIR="${ROOT_DIR}/test/${TYPE}"
local -r HOST_REPORTS_DIR="${ROOT_DIR}/reports/${TYPE}" # where report json files have been written to
local -r CONTAINER_TMP_DIR=/tmp

exit_non_zero_unless_file_exists "${HOST_REPORTS_DIR}/${TEST_LOG}"
exit_non_zero_unless_file_exists "${HOST_REPORTS_DIR}/test_metrics.json"
exit_non_zero_unless_file_exists "${HOST_REPORTS_DIR}/coverage_metrics.json"
exit_non_zero_unless_file_exists "${HOST_TEST_DIR}/check_test_metrics.rb"

set +e
docker run \
Expand All @@ -60,10 +64,11 @@ check_coverage()
--volume ${HOST_REPORTS_DIR}/test_metrics.json:${CONTAINER_TMP_DIR}/test_metrics.json:ro \
--volume ${HOST_REPORTS_DIR}/coverage_metrics.json:${CONTAINER_TMP_DIR}/coverage_metrics.json:ro \
--volume ${HOST_TEST_DIR}/check_test_metrics.rb:${CONTAINER_TMP_DIR}/check_test_metrics.rb:ro \
cyberdojo/runner:latest \
sh -c "ruby ${CONTAINER_TMP_DIR}/check_test_metrics.rb"
"${CYBER_DOJO_RUNNER_IMAGE}:${CYBER_DOJO_RUNNER_TAG}" \
sh -c "ruby ${CONTAINER_TMP_DIR}/check_test_metrics.rb" \
| tee -a "${HOST_REPORTS_DIR}/${TEST_LOG}"

local -r STATUS=$?
local -r STATUS=${PIPESTATUS[0]}
set -e

echo "${TYPE} coverage status == ${STATUS}"
Expand Down
2 changes: 1 addition & 1 deletion bin/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ run_tests_in_container()
echo '=================================='

local -r CONTAINER_COVERAGE_DIR="/tmp/reports"
local -r TEST_LOG=test.run.log
local -r TEST_LOG=test.log

set +e
docker exec \
Expand Down
2 changes: 1 addition & 1 deletion test/lib/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

readonly MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export COVERAGE_ROOT="${1}" # eg /tmp/coverage
readonly TEST_LOG="${2}" # eg test.run.log
readonly TEST_LOG="${2}" # eg testlog
readonly TYPE="${3}" # eg client|server
shift; shift; shift

Expand Down

0 comments on commit 513136f

Please sign in to comment.