-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e5aa15
commit 520f08e
Showing
6 changed files
with
86 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
set -e | ||
|
||
LEADER_NODE=$1 | ||
IMAGE_URL=$2 | ||
shift 2 | ||
SSH_KEYFILE=${SSH_KEYFILE:-$HOME/.ssh/id_rsa} | ||
|
||
ssh_key="$(cat $SSH_KEYFILE)" | ||
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 \ | ||
--volume=site-packages:/home/pwuser/.local/lib/python3.8/site-packages:Z \ | ||
--network=host \ | ||
-v .:/home/pwuser/ns8-module:z \ | ||
--name rf-core-runner ghcr.io/marketsquare/robotframework-browser/rfbrowser-stable:v10.0.3 \ | ||
--volume=site-packages:/home/pwuser/.local/lib/python3.8/site-packages:Z \ | ||
--name rf-core-runner ghcr.io/marketsquare/robotframework-browser/rfbrowser-stable:18.6.3 \ | ||
bash -l -s <<EOF | ||
set -e | ||
echo "$ssh_key" > /home/pwuser/ns8-key | ||
set -x | ||
pip install -r /home/pwuser/ns8-module/tests/pythonreq.txt | ||
mkdir ~/outputs | ||
cd /home/pwuser/ns8-module | ||
robot -v NODE_ADDR:${LEADER_NODE} \ | ||
-v SSH_KEYFILE:/home/pwuser/ns8-key \ | ||
-d ~/outputs /home/pwuser/ns8-module/tests/ | ||
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 loki \ | ||
--skiponfailure unstable \ | ||
-d ~/outputs ${@} /home/pwuser/ns8-module/tests/ | ||
EOF | ||
|
||
tests_res=$? | ||
|
||
podman cp rf-core-runner:/home/pwuser/outputs tests/ | ||
podman stop rf-core-runner | ||
podman rm rf-core-runner | ||
|
||
exit ${tests_res} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*** Settings *** | ||
Library SSHLibrary | ||
|
||
*** Variables *** | ||
${MID} | ||
|
||
*** Test Cases *** | ||
Module removal | ||
[Tags] module remove | ||
${rc} = Execute Command remove-module --no-preserve ${MID} | ||
... return_rc=True return_stdout=False | ||
Should Be Equal As Integers ${rc} 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
*** Settings *** | ||
Library SSHLibrary | ||
Library DateTime | ||
|
||
*** Variables *** | ||
${SSH_KEYFILE} %{HOME}/.ssh/id_ecdsa | ||
${NODE_ADDR} 127.0.0.1 | ||
${MID} loki0 | ||
${IMAGE_URL} ghcr.io/nethserver/loki:latest | ||
|
||
*** Keywords *** | ||
Connect to the node | ||
Open Connection ${NODE_ADDR} | ||
Login With Public Key root ${SSH_KEYFILE} | ||
${output} = Execute Command systemctl is-system-running --wait | ||
|
||
Wait until boot completes | ||
${output} = Execute Command systemctl is-system-running --wait | ||
Should Be True '${output}' == 'running' or '${output}' == 'degraded' | ||
|
||
Save the journal begin timestamp | ||
${tsnow} = Get Current Date result_format=epoch | ||
Set Global Variable ${JOURNAL_SINCE} ${tsnow} | ||
|
||
Collect the suite journal | ||
Execute Command journalctl -S @${JOURNAL_SINCE} >journal-dump.log | ||
Get File journal-dump.log ${OUTPUT DIR}/journal-${SUITE NAME}.log | ||
|
||
*** Settings *** | ||
Suite Setup Connect to the Node | ||
Suite Setup Run Keywords | ||
... Connect to the Node | ||
... Wait until boot completes | ||
... Save the journal begin timestamp | ||
|
||
Suite Teardown Run Keywords | ||
... Collect the suite journal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
robotframework==4.1.2 | ||
robotframework-sshlibrary==3.8.0 | ||
robotframework-requests==0.9.2 | ||
bcrypt==3.2.0 | ||
cffi==1.15.0 | ||
cryptography==36.0.1 | ||
paramiko==2.9.2 | ||
pycparser==2.21 | ||
pynacl==1.5.0 | ||
scp==0.14.2 | ||
robotframework | ||
robotframework-sshlibrary |