Skip to content

Commit

Permalink
define and integrate test run
Browse files Browse the repository at this point in the history
  • Loading branch information
cherusk committed Nov 28, 2023
1 parent 9d4cd85 commit 3f8971f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##
## 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 <http://www.gnu.org/licenses/>.
##

on:
pull_request:
types: [ labeled ]
branches:
- master


jobs:
test_perform:
if: ${{ contains(github.event.pull_request.labels.*.name, 'tests') && contains(github.event.pull_request.labels.*.name, 'run') }}
runs-on: [self-hosted, linux] # only unique osuosl instance
env:
MASK_FILE: testing/maskfile.md
steps:
- name: perform test run
run: >
source /etc/bashrc;
mask --maskfile "${MASK_FILE}" testing perform;
18 changes: 6 additions & 12 deletions testing/maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_vm "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_vm "godon_robot@${__sink_vm_ip_address}" "systemctl stop test-client; systemctl start test-client"

~~~

Expand Down

0 comments on commit 3f8971f

Please sign in to comment.