From 820c8021a400f2b0f4c8759793950ce3b3e23233 Mon Sep 17 00:00:00 2001 From: Matthias Tafelmeier Date: Tue, 28 Nov 2023 12:47:02 +0100 Subject: [PATCH] define and integrate test run --- .github/workflows/tests.yml | 40 +++++++++++++++++++++++++++++++++++++ testing/maskfile.md | 18 ++++++----------- 2 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..223cb644 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,40 @@ +## +## Copyright (c) 2019 Matthias Tafelmeier. +## +## This file is part of godon +## +## godon is free software: you can redistribute it and/or modify +## it under the terms of the GNU Affero General Public License as +## published by the Free Software Foundation, either version 3 of the +## License, or (at your option) any later version. +## +## godon is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU Affero General Public License for more details. +## +## You should have received a copy of the GNU Affero General Public License +## along with this godon. If not, see . +## + +on: + pull_request: + types: [ labeled ] + branches: + - master + + +jobs: + test_perform: + if: ${{ contains(github.event.pull_request.labels.*.name, 'tests')}} + runs-on: [self-hosted, linux] # only unique osuosl instance + env: + MASK_FILE: testing/maskfile.md + steps: + - name: perform test run + run: > + source /etc/bashrc; + cp testing/infra/credentials/ssh/id_rsa testing/infra/credentials/ssh/id_rsa_robot + chmod 0600 testing/infra/credentials/ssh/id_rsa_robot + + mask --maskfile "${MASK_FILE}" testing perform; diff --git a/testing/maskfile.md b/testing/maskfile.md index 9e483720..a309267c 100755 --- a/testing/maskfile.md +++ b/testing/maskfile.md @@ -243,25 +243,19 @@ docker-compose -f "${MASKFILE_DIR}/../docker-compose.yml" down --remove-orphans ### testing perform -> Perform/Orchestrate Session of Tests Run +> Orchestrate and Perform Session of Test Run ~~~bash set -eEux echo "performing tests" +__kcli_cmd="mask --maskfile ${MASKFILE_DIR}/maskfile.md util kcli run" - # TODO improvised until formatted parser install -target_ip="$(sudo ansible-inventory --list -y -i ${MASKFILE_DIR}/infra/inventory.sh | - grep ansible_host | head -n 1 | \ - awk -F: '{print $2}' | xargs echo -n)" -svc_name=control_loop -dag_name="lnx_net_stack" - +__source_vm_ip_address=($(${__kcli_cmd} "list vm" | grep 'micro_stack' | grep 'source' | awk -F\| '{ print $4 }' | xargs)) +ssh -i infra/credentials/ssh/id_rsa_robot "godon_robot@${__source_vm_ip_address}" "systemctl stop test-server; systemctl start test-server" -sudo docker-compose -f "${MASKFILE_DIR}/docker-compose.yml" exec -T "${svc_name}" \ - airflow variables --set target "${target_ip}" -sudo docker-compose -f "${MASKFILE_DIR}/docker-compose.yml" exec -T "${svc_name}" \ - airflow trigger_dag "${dag_name}" +__sink_vm_ip_address=($(${__kcli_cmd} "list vm" | grep 'micro_stack' | grep 'sink' | awk -F\| '{ print $4 }' | xargs)) +ssh -i infra/credentials/ssh/id_rsa_robot "godon_robot@${__sink_vm_ip_address}" "systemctl stop test-client; systemctl start test-client" ~~~