aboutsummaryrefslogtreecommitdiffstats
path: root/tests/_test_base
blob: 59b80a5e658a84d341805fba41024e697f2cf391 (plain)
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
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017-2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#############################################################################

if [[ "$debug" == "True" ]]; then
    set -o xtrace
fi

source /var/onap_tests/asserts
source /var/onap/commons

# main() - Starting point for Unit Tests
function main {
    local covered_functions=("$@")

    update_repos
    len=${#covered_functions[@]}
    echo "1..$len"
    for i in ${!covered_functions[@]}; do
        dpkg --get-selections > installed-software
        sort -o installed-software installed-software
        test_${covered_functions[$i]}
        echo "ok $((i+1)) - test_${covered_functions[$i]}"

        # Teardown process
        if is_package_installed docker-ce; then
            docker images -q | xargs docker rmi -f
        fi
        dpkg --get-selections > installed-software_new
        sort -o installed-software_new installed-software_new
        apt-get purge -y -qq $(comm -3 installed-software installed-software_new | awk '{print $1}')
        #rm -rf $git_src_folder
        #rm -rf ~/.m2/
    done
}