blob: 9ab9b521648ae5ef3a885e9042bc6c49af59d42f [file] [log] [blame]
Ievgeniia Zadorozhna45cf52f2025-10-24 18:32:56 +02001#!/bin/bash
2
Ievgeniia Zadorozhna234298e2025-11-24 15:38:42 +01003if [ -z "$MY_PROJFOLDER" ]; then
4 echo "The /artifacts/env.sh script is not sourced. Please do 'source env.sh' before running the Sanity tests"
5 exit 1
6fi
7
Ievgeniia Zadorozhna45cf52f2025-10-24 18:32:56 +02008. "$(dirname "$0")/functions.sh"
9cd $MY_PROJFOLDER/tmp
10source $MY_PROJFOLDER/env.sh
11source $MY_PROJFOLDER/envs/mgmtrc
12source /opt/ksi/.ksivenv/bin/activate
13
14fname="$MY_PROJFOLDER/reports/$MY_CLIENTSHORTNAME-k0rdent-sanity-$(get_timestamp).html"
15
16# Cleaning up
17echo "# Cleaning up '$MY_PROJFOLDER/tmp/artifacts/'"
18[ -d "$MY_PROJFOLDER/tmp/artifacts/" ] && rm -rf "$MY_PROJFOLDER/tmp/artifacts/"
19[ -f "$MY_PROJFOLDER/tmp/nosetests.xml" ] && rm "$MY_PROJFOLDER/tmp/nosetests.xml"
20mkdir "$MY_PROJFOLDER/tmp/artifacts/"
21
22# recreate the sanity reports dir to have fresh artifacts
23sanity_reports_dir="$MY_PROJFOLDER/reports/sanity"
24if [ -d $sanity_reports_dir ]; then
25 yes | rm $sanity_reports_dir/*
26else
27 mkdir $sanity_reports_dir
28fi
29
30# Run the sanity tests
31pytest -m sanity \
32 -p pytest_subtests \
33 -v \
34 --tb=short \
35 --color=yes \
36 -p no:warnings \
37 -p no:sugar \
38 --junitxml=$sanity_reports_dir/sanity-checks-results.xml \
39 --html=$sanity_reports_dir/sanity-checks-results.html \
40 --self-contained-html \
41 -r s \
42 /opt/ksi/test_sanity_checks.py
43
44if [ "$(ls -A "$MY_PROJFOLDER/tmp/artifacts" 2>/dev/null)" ]; then
45 cp "$MY_PROJFOLDER/tmp/artifacts/"* "$sanity_reports_dir"
46fi
47
48cp $sanity_reports_dir/sanity-checks-results.html ${fname}
49update_latest_report_to "${fname}"
50
Ievgeniia Zadorozhna234298e2025-11-24 15:38:42 +010051echo "The test report can be found at ${fname}"
52
Ievgeniia Zadorozhna45cf52f2025-10-24 18:32:56 +020053deactivate