Include tests for default_setup

This commit is contained in:
Nikola Jokic
2023-11-06 14:20:05 +01:00
parent b3d135408f
commit a9eb5b6c45
4 changed files with 83 additions and 22 deletions

22
test/actions.github.com/default_setup.test.sh Normal file → Executable file
View File

@@ -4,25 +4,31 @@ DIR="$(dirname "${BASH_SOURCE[0]}")"
DIR="$(realpath "${DIR}")"
ROOT_DIR="$(relpath "${DIR}/../..")"
ROOT_DIR="$(realpath "${DIR}/../..")"
source "${DIR}/helper.sh"
SCALE_SET_NAME="default-$(date + '%M%S')$(((${RANDOM} + 100) % 100 + 1))"
SCALE_SET_NAME="default-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))"
SCALE_SET_NAMESPACE="arc-runners"
WORKFLOW_FILE="arc-test-workflow.yaml"
ARC_NAME="arc"
ARC_NAMESPACE="arc-systems"
function install_scale_set() {
echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}"
helm install "${SCALE_SET_NAME}" \
--namespace "${SCALE_SET_NAMESPACE}" \
--create-namespace \
--set githubConfigUrl="https://github.com/${TARGET_ORG}/${TARGET_REPO}" \
--set githubConfigSecret.github_token="${GITHUB_TOKEN}" \
${ROOT_DIR}/charts/gha-runner-scale-set \
--version="${VERSION}" \
--debug
NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" wait_for_scale_set
if ! NAME="${SCALE_SET_NAME}" NAMESPACE="${ARC_NAMESPACE}" wait_for_scale_set; then
NAMESPACE="${ARC_NAMESPACE}" log_arc
return 1
fi
}
function run_workflow() {
@@ -52,20 +58,22 @@ function main() {
build_image
create_cluster
install_arc
NAME="${ARC_NAME}" NAMESPACE="${ARC_NAMESPACE}" install_arc
install_scale_set || failed+=("install_scale_set")
run_workflow || failed+=("run_workflow")
INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set")
delete_cluster
if [[ "${#failed[@]}" -ne 0 ]]; then
echo "----------------------------------"
echo "The following tests failed:"
for test in "${failed[@]}"; do
echo " - ${test}"
done
exit 1
return 1
fi
}