diff options
author | Victor Morales <victor.morales@intel.com> | 2017-10-20 13:18:26 -0700 |
---|---|---|
committer | Victor Morales <victor.morales@intel.com> | 2017-10-20 13:30:38 -0700 |
commit | 21404d790afd758160f0562859bf186821d55c70 (patch) | |
tree | 35d12acbc325c30d6a6b168e20e9fb96b5aafe87 /bootstrap/vagrant-onap/tests/test_functions | |
parent | 9f8434f582bbc87d0299d4b4d94c93e20b400a94 (diff) |
Create a upstream repos validator
This Unit Test helps to validate the usage of the official
repositrories and fails in case that a minimum are not used.
Change-Id: Id5a922163a8a0d16de5460aee92e5cced3f285a3
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-Id: INT-289
Diffstat (limited to 'bootstrap/vagrant-onap/tests/test_functions')
-rw-r--r-- | bootstrap/vagrant-onap/tests/test_functions | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions index ee7358a84..8043ebbd7 100644 --- a/bootstrap/vagrant-onap/tests/test_functions +++ b/bootstrap/vagrant-onap/tests/test_functions @@ -8,7 +8,7 @@ covered_functions=( "configure_bind" "install_java" "install_maven" "install_nodejs" "install_python" "install_docker" "pull_docker_image" "install_docker_compose" "configure_service" "start_ODL" "compile_src" "build_docker_image" "docker_openecomp_login" -"pull_openecomp_image" "pull_onap_image" +"pull_openecomp_image" "pull_onap_image" "coverity_repos" ) # test_create_configuration_files() - Verify the creation of a configuration files @@ -165,6 +165,32 @@ function test_build_docker_image { asserts_image onap/ccsdk-ubuntu-image } +# test_coverity_repos() - Verify that all the repos are covered by scripts +function test_coverity_repos { + # Get repositories list from source code files + repos_list=() + for module in $( stat -c "%F %n" /var/onap/* | grep -v "_\|functions\|commons\|files" | cut -d' ' -f 3-); do + source $module + module_repo_list=$(eval echo \${$(basename $module)_repos[@]}) + repos_list=(${repos_list[@]} ${module_repo_list[@]}) + done + + pushd /var/onap_tests/ + cp projects.txt remaining_projects.txt + for covered_repo in "${repos_list[@]}"; do + sed -i "/$covered_repo/d" remaining_projects.txt + done + + threshold=75 + num_projects=$(wc -l < projects.txt) + num_remaining_projects=$(wc -l < remaining_projects.txt) + coverage=`echo "scale=2; 100-($num_remaining_projects/$num_projects*100)" | bc | cut -d . -f 1` + if [ $coverage -lt $threshold ]; then + raise_error "There are repositories that are not covered by scripts" + fi + popd +} + if [ "$1" != '*' ]; then unset covered_functions covered_functions=$1 |