mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 12:06:57 +00:00
Adding some unit testing for entrypoint.sh
The unit tests are simulating a run for entrypoint. It creates some dummy config.sh and runsvc.sh and makes sure the logic behind entrypoint.sh is correct. Unfortunately the entrypoint.sh contains some sections that are not mockable so I had to put some logic in there too. Testing includes for now: - the normal scenario - the normal non-ephemeral scenario - the configuration failure scenario Also tested the entrypoint.sh on a real runner, still works as expected.
This commit is contained in:
committed by
Yusuke Kuoka
parent
d355f05ac0
commit
ec0915ce7c
37
test/entrypoint/entrypoint_unittest.sh
Executable file
37
test/entrypoint/entrypoint_unittest.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
source logging.sh
|
||||
|
||||
for unittest in ./should*; do
|
||||
log "**********************************"
|
||||
log " UNIT TEST: ${unittest}"
|
||||
log "**********************************"
|
||||
log ""
|
||||
|
||||
cd ${unittest}
|
||||
./test.sh
|
||||
ret_code=$?
|
||||
cd ..
|
||||
|
||||
log ""
|
||||
log ""
|
||||
if [ "${ret_code}" = "0" ]; then
|
||||
success "Completed: unit test ${unittest}"
|
||||
else
|
||||
error "Completed: unit test ${unittest} with errors"
|
||||
failed="true"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${failed:-}" ]; then
|
||||
error ""
|
||||
error "*************************************"
|
||||
error "All unit tests completed, with errors"
|
||||
error "*************************************"
|
||||
exit 1
|
||||
else
|
||||
success ""
|
||||
success "***************************************"
|
||||
success "All unit tests completed with no errors"
|
||||
success "***************************************"
|
||||
fi
|
||||
Reference in New Issue
Block a user