bin/test_unit
#!/usr/bin/env bash
set -eox pipefail
junit_output_file="./junit.output"
. bin/build_utils
function main() {
retrieve_cyberark_ca_cert
build_docker_ut_image
run_unit_tests $@
}
function build_docker_ut_image() {
echo "Building unit test image..."
docker build -f Dockerfile.test -t secrets-provider-for-k8s-test-runner:latest .
}
function run_unit_tests() {
echo "Running unit tests..."
docker run --rm -t \
--volume "$PWD"/:/secrets-provider-for-k8s/test/ \
secrets-provider-for-k8s-test-runner:latest \
-coverprofile="./test/c.out" \
./cmd/... \
./pkg/... \
$@ \
| tee -a "$junit_output_file"
echo "Unit test exit status: $?"
}
main $@