Skip to content

Commit fb5e599

Browse files
Add prototype appliance test definition for integration testing
Signed-off-by: Stevan Radaković <stevan.radakovic@linaro.org>
1 parent 978d12e commit fb5e599

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
# Copyright (C) 2024 Linaro Ltd.
4+
set -x
5+
. ../../lib/sh-test-lib
6+
7+
# source the secrets file to get the gitlab_token env var
8+
. ../../../../../../secrets > /dev/null 2>&1
9+
10+
# install dependencies
11+
install_deps "bzip2 curl firefox-esr git python3-pip wget" "$SKIP_INSTALL"
12+
13+
# install spire package
14+
wget https://github.com/Linaro/SPIRE-CLI-S-/releases/download/0.2.0-alpha%2B006/staging-spire_0.2.0-alpha+006_linux_amd64.deb
15+
dpkg -i staging-spire_0.2.0-alpha+006_linux_amd64.deb
16+
17+
# clone baklava-integration repo and install required pip pkgs
18+
get_test_program "https://gitlab-ci-token:${GITLAB_TOKEN}@gitlab.com/LinaroLtd/lava/appliance/baklava-integration.git" "baklava-integration" "main"
19+
20+
git checkout "fix-sshx-and-certs"
21+
22+
pip3 install -r requirements.txt
23+
24+
export SPIRE_PAT_TOKEN LAVA_TOKEN LAVA_PASSWORD
25+
26+
# run tests
27+
robot --pythonpath . --variable remote:"$IS_REMOTE" --outputdir=.. test/
28+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
# Copyright (C) 2024 Linaro Ltd.
3+
metadata:
4+
name: integration-tests
5+
format: "Lava-Test Test Definition 1.0"
6+
description: "Run appliance integration tests in LAVA."
7+
maintainer:
8+
- stevan.radakovic@linaro.org
9+
os:
10+
- debian
11+
- ubuntu
12+
devices:
13+
- qemu
14+
scope:
15+
- functional
16+
17+
params:
18+
SKIP_INSTALL: "False"
19+
IS_REMOTE: "False"
20+
GITLAB_TOKEN: ""
21+
BAKFLEET_URL: ""
22+
LAVA_URL: ""
23+
LAVA_USERNAME: ""
24+
LAVA_TOKEN: ""
25+
LAVA_PASSWORD: ""
26+
BAKLAWEB_URL: ""
27+
SPIRE_USER_EMAIL: ""
28+
SPIRE_PAT_TOKEN: ""
29+
ORG_UUID: ""
30+
31+
run:
32+
steps:
33+
- cd ./automated/linux/torizon/
34+
- export IS_REMOTE BAKFLEET_URL BAKLAWEB_URL SPIRE_USER_EMAIL LAVA_USERNAME LAVA_URL ORG_UUID
35+
- ./integration-tests.sh
36+
- ../../utils/parse-robot-framework.py -r output.xml
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
# Copyright (C) 2024 Linaro Ltd.
4+
5+
import argparse
6+
import subprocess
7+
from robot.api import ExecutionResult, ResultVisitor
8+
9+
10+
def parse_args():
11+
parser = argparse.ArgumentParser()
12+
parser.add_argument(
13+
"-r",
14+
"--result-file",
15+
dest="result_file",
16+
default="./output.xml",
17+
help="Specify robot framework XML test result file.",
18+
)
19+
args = parser.parse_args()
20+
return args
21+
22+
23+
def main():
24+
result = ExecutionResult(args.result_file)
25+
26+
def get_all_tests(suite):
27+
for test in suite.tests:
28+
yield test
29+
for sub_suite in suite.suites:
30+
yield from get_all_tests(sub_suite)
31+
32+
for test in get_all_tests(result.suite):
33+
print(
34+
f"<LAVA_SIGNAL_TESTCASE TEST_CASE_ID={test.name.replace(' ', '')} RESULT={test.status.lower()}>"
35+
)
36+
37+
38+
if __name__ == "__main__":
39+
args = parse_args()
40+
main()

0 commit comments

Comments
 (0)