File: collect_results.sh

package info (click to toggle)
murano-dashboard 1%3A10.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,620 kB
  • sloc: python: 15,632; javascript: 1,627; sh: 106; makefile: 38
file content (31 lines) | stat: -rwxr-xr-x 1,008 bytes parent folder | download | duplicates (2)
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
DEST=${DEST:-/opt/stack/new}
DASHBOARD_DIR=$DEST/murano-dashboard

function create_artifacts_dir() {
    dst="${WORKSPACE}/logs/artifacts"
    mkdir -p "${dst}"
}

function collect_screenshots() {
    # Copy screenshots for failed tests
    if [[ -d "$DASHBOARD_DIR/muranodashboard/tests/functional/screenshots/" ]]; then
        mkdir -p "${WORKSPACE}/logs/artifacts/screenshots"
        cp -Rv $DASHBOARD_DIR/muranodashboard/tests/functional/screenshots/* "${WORKSPACE}/logs/artifacts/screenshots/"
    fi
}

function generate_html_report() {
    local xml_report="${WORKSPACE}/logs/test_report.xml"
    local html_report="${WORKSPACE}/logs/test_report.html"

    if [[ -f "${WORKSPACE}/logs/test_report.xml" ]]; then
        $(which python3) "$DASHBOARD_DIR/functional_tests/generate_html_report.py" "${xml_report}" "${html_report}"
        cp "${html_report}" "${WORKSPACE}/index.html"
    fi
}

function do_collect_results() {
    create_artifacts_dir
    collect_screenshots
    generate_html_report
}