-
Notifications
You must be signed in to change notification settings - Fork 5
/
test-module.sh
executable file
·49 lines (41 loc) · 1.19 KB
/
test-module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# Copyright (C) 2023 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
# Hint: access the test logs on HTTP port 8000 with this command:
#
# python -mhttp.server -d tests/outputs/ 8000 &
#
set -e
SSH_KEYFILE=${SSH_KEYFILE:-$HOME/.ssh/id_rsa}
LEADER_NODE="${1:?missing LEADER_NODE argument}"
IMAGE_URL="${2:?missing IMAGE_URL argument}"
shift 2
ssh_key="$(< $SSH_KEYFILE)"
cleanup() {
set +e
podman cp rf-core-runner:/home/pwuser/outputs tests/
podman stop rf-core-runner
podman rm rf-core-runner
}
trap cleanup EXIT
podman run -i \
--network=host \
-v .:/home/pwuser/ns8-module:z \
--volume=site-packages:/home/pwuser/.local/lib/python3.8/site-packages:Z \
--name rf-core-runner ghcr.io/marketsquare/robotframework-browser/rfbrowser-stable:17.5.2 \
bash -l -s <<EOF
set -e
echo "$ssh_key" > /home/pwuser/ns8-key
pip install -q -r /home/pwuser/ns8-module/tests/pythonreq.txt
mkdir ~/outputs
cd /home/pwuser/ns8-module
exec robot -v NODE_ADDR:${LEADER_NODE} \
-v IMAGE_URL:${IMAGE_URL} \
-v SSH_KEYFILE:/home/pwuser/ns8-key \
--name samba \
--skiponfailure unstable \
-d ~/outputs ${@} /home/pwuser/ns8-module/tests/
EOF