Adding github action for entrypoint unit test

... and adding safety mechanism in UNITTEST handling.
This commit is contained in:
Sebastien Le Digabel 2021-08-02 10:46:58 +01:00 committed by Yusuke Kuoka
parent ec0915ce7c
commit a98729b08b
2 changed files with 24 additions and 3 deletions

21
.github/workflows/test-entrypoint.yaml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Unit tests for entrypoint
on:
pull_request:
branches:
- '**'
paths:
- 'runner/**'
- 'test/entrypoint/**'
jobs:
test:
runs-on: ubuntu-latest
name: Test entrypoint
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run unit tests for entrypoint.sh
run: |
cd test/entrypoint
bash entrypoint_unittest.sh

View File

@ -64,13 +64,13 @@ if [ -z "${RUNNER_REPO}" ] && [ -n "${RUNNER_GROUP}" ];then
fi
# Hack due to https://github.com/actions-runner-controller/actions-runner-controller/issues/252#issuecomment-758338483
if [ ! -d ${RUNNER_HOME} ]; then
if [ ! -d "${RUNNER_HOME}" ]; then
error "${RUNNER_HOME} should be an emptyDir mount. Please fix the pod spec."
exit 1
fi
# if this is not a testing environment
if [ -z "$UNITTEST" ]; then
if [ -z "${UNITTEST:-}" ]; then
sudo chown -R runner:docker ${RUNNER_HOME}
mv /runnertmp/* ${RUNNER_HOME}/
fi
@ -138,7 +138,7 @@ if [ -n "${RUNNER_REGISTRATION_ONLY}" ]; then
exit 0
fi
if [ -z "$UNITTEST" ]; then
if [ -z "${UNITTEST:-}" ]; then
mkdir ./externals
# Hack due to the DinD volumes
mv ./externalstmp/* ./externals/