-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prototype appliance test definition for integration testing
Signed-off-by: Stevan Radaković <[email protected]>
- Loading branch information
1 parent
978d12e
commit 3a23de8
Showing
3 changed files
with
108 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (C) 2024 Linaro Ltd. | ||
. ../../lib/sh-test-lib | ||
|
||
# source the secrets file to get the gitlab_token env var | ||
. ../../../../../../secrets > /dev/null 2>&1 | ||
|
||
# install dependencies | ||
install_deps "bzip2 git curl libxtst6 libgtk-3-0 libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev python3-pip wget" "$SKIP_INSTALL" | ||
|
||
apk add --no-cache wget \ | ||
&& GECKODRIVER_VERSION=$(wget -qO- https://api.github.com/repos/mozilla/geckodriver/releases/latest \ | ||
| grep "tag_name" | sed -E 's/.*"([^"]+)".*/\1/') \ | ||
&& wget -qO /tmp/geckodriver.tar.gz \ | ||
"https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-linux-aarch64.tar.gz" \ | ||
&& tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin/ \ | ||
&& rm /tmp/geckodriver.tar.gz \ | ||
|
||
|
||
# install spire package | ||
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 | ||
dpkg -i staging-spire_0.2.0-alpha+006_linux_amd64.deb | ||
|
||
# clone baklava-integration repo and install required pip pkgs | ||
get_test_program "https://gitlab-ci-token:${GITLAB_TOKEN}@gitlab.com/LinaroLtd/lava/appliance/baklava-integration.git" "baklava-integration" "main" | ||
pip3 install -r requirements.txt | ||
|
||
export SPIRE_PAT_TOKEN LAVA_TOKEN LAVA_PASSWORD | ||
|
||
# run tests | ||
robot --pythonpath . --variable remote:"$IS_REMOTE" --outputdir=.. test/ | ||
exit 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (C) 2024 Linaro Ltd. | ||
metadata: | ||
name: integration-tests | ||
format: "Lava-Test Test Definition 1.0" | ||
description: "Run appliance integration tests in LAVA." | ||
maintainer: | ||
- [email protected] | ||
os: | ||
- debian | ||
- ubuntu | ||
devices: | ||
- qemu | ||
scope: | ||
- functional | ||
|
||
params: | ||
SKIP_INSTALL: "False" | ||
IS_REMOTE: "False" | ||
GITLAB_TOKEN: "" | ||
BAKFLEET_URL: "" | ||
LAVA_URL: "" | ||
LAVA_USERNAME: "" | ||
LAVA_TOKEN: "" | ||
LAVA_PASSWORD: "" | ||
BAKLAWEB_URL: "" | ||
SPIRE_USER_EMAIL: "" | ||
SPIRE_PAT_TOKEN: "" | ||
|
||
run: | ||
steps: | ||
- cd ./automated/linux/torizon/ | ||
- export IS_REMOTE BAKFLEET_URL BAKLAWEB_URL SPIRE_USER_EMAIL LAVA_USERNAME LAVA_URL | ||
- ./integration-tests.sh | ||
- ../../utils/parse-robot-framework.py -r output.xml |
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,40 @@ | ||
#!/usr/bin/env python | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (C) 2024 Linaro Ltd. | ||
|
||
import argparse | ||
import subprocess | ||
from robot.api import ExecutionResult, ResultVisitor | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"-r", | ||
"--result-file", | ||
dest="result_file", | ||
default="./output.xml", | ||
help="Specify robot framework XML test result file.", | ||
) | ||
args = parser.parse_args() | ||
return args | ||
|
||
|
||
def main(): | ||
result = ExecutionResult(args.result_file) | ||
|
||
def get_all_tests(suite): | ||
for test in suite.tests: | ||
yield test | ||
for sub_suite in suite.suites: | ||
yield from get_all_tests(sub_suite) | ||
|
||
for test in get_all_tests(result.suite): | ||
print( | ||
f"<LAVA_SIGNAL_TESTCASE TEST_CASE_ID={test.name.replace(' ', '')} RESULT={test.status.lower()}>" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
args = parse_args() | ||
main() |