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 29, 2023
1 parent 9d4cd85 commit f95ddfc
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 11 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
##

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;
22 changes: 11 additions & 11 deletions testing/maskfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,25 @@ 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"
__ssh_cmd="ssh -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${MASKFILE_DIR}/infra/credentials/ssh/id_rsa_robot"

__source_vm_ip_address=($(${__kcli_cmd} "list vm" | grep 'micro_stack' | grep 'source' | awk -F\| '{ print $4 }' | xargs))
__sink_vm_ip_address=($(${__kcli_cmd} "list vm" | grep 'micro_stack' | grep 'sink' | awk -F\| '{ print $4 }' | xargs))

__sink_vm_test_iface_ip_address=($(${__ssh_cmd} "godon_robot@${__sink_vm_ip_address}" "ip --json a show dev ens8 | jq '.[0].addr_info[0].local'"))

# 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"
${__ssh_cmd} "godon_robot@${__sink_vm_ip_address}" "sudo systemctl stop test-server; sudo systemctl start test-server"

${__ssh_cmd} "godon_robot@${__source_vm_ip_address}" "echo "SINK_IP=${__sink_vm_test_iface_ip_address}" > /home/test/sink_ip"
${__ssh_cmd} "godon_robot@${__source_vm_ip_address}" "sudo systemctl stop test-client; sudo systemctl start test-client"

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}"

~~~

Expand Down

0 comments on commit f95ddfc

Please sign in to comment.