summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/tests
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2017-07-26 16:06:35 -0500
committerVictor Morales <victor.morales@intel.com>2017-07-26 16:06:35 -0500
commitdd074806ad51761392a9cca3f1f04fbbebd3de22 (patch)
tree9088768b55bf307875369e7368f56c7e66149424 /bootstrap/vagrant-onap/tests
parent8805879b4dc92014381ba55b75955b295944ded6 (diff)
Sync latest changes for vagrant-onap
Given some internal procedures was not possible to submit all the changes. In the meantime, those changes were placed into an non-official project. This change syncronizes the latest changes into the official repository. Issue-id: INT-17 Change-Id: Ia4125f4b70273401e4ed3cc1908d2e2ad7d1c2e9 Signed-off-by: Victor Morales <victor.morales@intel.com>
Diffstat (limited to 'bootstrap/vagrant-onap/tests')
-rw-r--r--bootstrap/vagrant-onap/tests/_test_base24
-rw-r--r--bootstrap/vagrant-onap/tests/test_functions174
-rw-r--r--bootstrap/vagrant-onap/tests/test_mr24
-rw-r--r--bootstrap/vagrant-onap/tests/test_mso48
-rw-r--r--bootstrap/vagrant-onap/tests/test_sdnc45
-rw-r--r--bootstrap/vagrant-onap/tests/test_vfc20
6 files changed, 335 insertions, 0 deletions
diff --git a/bootstrap/vagrant-onap/tests/_test_base b/bootstrap/vagrant-onap/tests/_test_base
new file mode 100644
index 000000000..19cc8ef11
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/_test_base
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source /var/onap/asserts
+
+# main() - Starting point for Unit Tests
+function main {
+ local covered_functions=("$@")
+
+ 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
+ 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
+}
diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions
new file mode 100644
index 000000000..ea268923b
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_functions
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/functions
+
+covered_functions=(
+"create_configuration_files" "clone_repo" "install_dev_tools"
+"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"
+)
+
+# TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings
+if [ -z $http_proxy ] & [ -z $https_proxy ]; then
+ covered_functions=(${covered_functions[@]} "docker_openecomp_login" "pull_openecomp_image")
+fi
+
+# test_create_configuration_files() - Verify the creation of a configuration files
+function test_create_configuration_files {
+ create_configuration_files
+
+ asserts_file_exist /opt/config/nexus_docker_repo.txt
+ asserts_file_exist /opt/config/nexus_username.txt
+ asserts_file_exist /opt/config/nexus_password.txt
+ asserts_file_exist /opt/config/openstack_username.txt
+ asserts_file_exist /opt/config/tenant_id.txt
+ asserts_file_exist /opt/config/dmaap_topic.txt
+ asserts_file_exist /opt/config/docker_version.txt
+}
+
+# test_docker_openecomp_login() - Verify the proper login to OpenECOMP Docker Hub
+function test_docker_openecomp_login {
+ docker_openecomp_login
+}
+
+# test_pull_openecomp_image() - Verify the addition of a OpenECOMP container image
+function test_pull_openecomp_image {
+ pull_openecomp_image portalapps ep:1610-1
+
+ asserts_installed_package docker-ce
+ asserts_image ep:1610-1
+
+ docker rmi -f ep:1610-1
+}
+
+# test_clone_repo() - Verify cloning and pulling source code from repositories
+function test_clone_repo {
+ clone_repo demo
+
+ asserts_installed_package git
+ asserts_file_exist $git_src_folder/demo/LICENSE.TXT
+}
+
+# test_install_dev_tools() - Verify the correct installation of developer tools
+function test_install_dev_tools {
+ install_dev_tools
+
+ asserts_installed_package apt-transport-https
+ asserts_installed_package ca-certificates
+ asserts_installed_package curl
+}
+
+# test_configure_bind() - Verify the correct installation and configuration of bind
+function test_configure_bind {
+ configure_bind
+
+ asserts_installed_package bind9
+ asserts_installed_package bind9utils
+ asserts_file_exist /etc/bind/zones/db.simpledemo.openecomp.org
+ asserts_file_exist /etc/bind/named.conf.options
+ asserts_file_exist /etc/bind/named.conf.local
+
+ rm -rf /etc/bind/
+}
+
+# test_install_java() - Verify the correct installation of java
+function test_install_java {
+ install_java
+
+ asserts_installed_package openjdk-8-jdk
+}
+
+# test_install_maven() - Verify the correct installation and configuration of maven
+function test_install_maven {
+ install_maven
+
+ asserts_installed_package maven3
+ asserts_installed_package openjdk-8-jdk
+ asserts_file_exist $mvn_conf_file
+}
+
+# test_install_nodejs() - Verify the correct installation of NodeJS tools
+function test_install_nodejs {
+ install_nodejs
+
+ asserts_installed_package nodejs
+ asserts_file_exist /usr/bin/npm
+}
+
+# test_install_python() - Verify the correct installation of Python
+function test_install_python {
+ install_python
+ asserts_installed_package python2.7
+ asserts_installed_package python-dev
+ asserts_file_exist /usr/local/bin/tox
+}
+
+# test_install_docker() - Verify the correct installation of Docker
+function test_install_docker {
+ install_docker
+
+ asserts_installed_package docker-ce
+}
+
+# test_pull_docker_image() - Verify the correct retrieve of a specific docker image
+function test_pull_docker_image {
+ local image=attos/dmaap
+ pull_docker_image $image
+
+ asserts_image $image
+
+ docker rmi -f $image
+}
+
+# test_install_docker_compose() - Verify the correct installation of Docker Compose tool
+function test_install_docker_compose {
+ install_docker_compose
+
+ asserts_file_exist /opt/docker/docker-compose
+}
+
+# test_configure_service() - Verify the correct configuration of a specific init service
+function test_configure_service {
+ local service=mso
+
+ configure_service $service
+
+ asserts_file_exist /etc/init.d/$service
+
+ rm -rf /etc/init.d/$service
+}
+
+# test_start_ODL() - Verify the installation and configuration of OpenDayLight controller
+function test_start_ODL {
+ start_ODL
+
+ asserts_file_exist /opt/opendaylight/current/bin/start
+}
+
+# test_compile_src() - Verify the compilation of java code using maven tools
+function test_compile_src {
+ local repo=vid/asdcclient
+ clone_repo $repo
+ compile_src $git_src_folder/$repo
+
+ asserts_file_exist $git_src_folder/$repo/target/asdcclient-1.0.2-SNAPSHOT.jar
+}
+
+# test_build_docker_image() - Verify that a docker image is created from source code
+function test_build_docker_image {
+ clone_repo portal
+ compile_src $git_src_folder/portal/ecomp-portal-widget-ms
+ build_docker_image $git_src_folder/portal/ecomp-portal-widget-ms
+
+ asserts_image widget-ms
+
+ docker rmi -f widget-ms
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_mr b/bootstrap/vagrant-onap/tests/test_mr
new file mode 100644
index 000000000..6fad08311
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_mr
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/mr
+
+covered_functions=(
+"init_mr"
+)
+
+# test_init_mr() - Verify the built and start of Message Router services
+function test_init_mr {
+ init_mr
+
+ asserts_image dockerfiles_kafka
+ asserts_image anapsix/alpine-java
+ asserts_image attos/dmaap
+ asserts_image wurstmeister/zookeeper
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_mso b/bootstrap/vagrant-onap/tests/test_mso
new file mode 100644
index 000000000..632f6ea02
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_mso
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/mso
+
+covered_functions=(
+"clone_all_mso_repos" "compile_all_mso_repos"
+)
+
+# test_clone_all_mso_repos() - Verify the source code retrieve of MSO project
+function test_clone_all_mso_repos {
+ clone_all_mso_repos
+
+ asserts_file_exist $src_folder/pom.xml
+ asserts_file_exist $src_folder/chef-repo/LICENSE.txt
+ asserts_file_exist $src_folder/docker-config/LICENSE.txt
+ asserts_file_exist $src_folder/libs/pom.xml
+ asserts_file_exist $src_folder/mso-config/LICENSE.txt
+}
+
+# test_compile_all_mso_repos() - Verify the correct compilation of MSO projects
+function test_compile_all_mso_repos {
+ clone_all_mso_repos
+ compile_all_mso_repos
+
+ asserts_file_exist $src_folder/libs/ceilometer-client/target/ceilometer-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/ceilometer-model/target/ceilometer-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/glance-client/target/glance-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/glance-model/target/glance-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/heat-client/target/heat-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/heat-model/target/heat-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/keystone-client/target/keystone-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/keystone-model/target/keystone-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/nova-client/target/nova-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/nova-model/target/nova-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/openstack-client/target/openstack-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/quantum-client/target/quantum-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/quantum-model/target/quantum-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/swift-client/target/swift-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/swift-model/target/swift-model-1.1.0-SNAPSHOT.jar
+}
+
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_sdnc b/bootstrap/vagrant-onap/tests/test_sdnc
new file mode 100644
index 000000000..be900d3d8
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_sdnc
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/sdnc
+
+covered_functions=(
+"clone_all_sdnc_repos" "compile_all_sdnc_repos" "get_sdnc_images"
+)
+
+# test_clone_all_sdnc_repos() - Verify the source code retrieve of SDNC project
+function test_clone_all_sdnc_repos {
+ clone_all_sdnc_repos
+
+ asserts_file_exist $src_folder/core/pom.xml
+ asserts_file_exist $src_folder/adaptors/pom.xml
+ asserts_file_exist $src_folder/northbound/pom.xml
+ asserts_file_exist $src_folder/plugins/pom.xml
+ asserts_file_exist $src_folder/oam/pom.xml
+}
+
+# test_compile_all_sdnc_repos() - Verify the correct compilation of SDNC projects
+function test_compile_all_sdnc_repos {
+ clone_all_sdnc_repos
+ compile_all_sdnc_repos
+
+ asserts_file_exist $src_folder/core/rootpom/boron-sr1/target/classes/LICENSE
+ asserts_file_exist $src_folder/core/rootpom/boron-sr3/target/classes/LICENSE
+ asserts_file_exist $src_folder/core/rootpom/target/rootpom-1.1.0-site_en.xml
+}
+
+# test_get_sdnc_images() - Verify that the SDNC images are created or retrieved
+function test_get_sdnc_images {
+ clone_all_sdnc_repos
+ get_sdnc_images
+
+ asserts_image openecomp/sdnc-image
+ asserts_image openecomp/admportal-sdnc-image
+ asserts_image openecomp/dgbuilder-sdnc-image
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_vfc b/bootstrap/vagrant-onap/tests/test_vfc
new file mode 100644
index 000000000..2f71cf1b0
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_vfc
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/vfc
+
+covered_functions=(
+"clone_all_vfc_repos"
+)
+
+# test_clone_all_vfc_repos() - Verify cloning and pulling source code from repositories
+function test_clone_all_vfc_repos {
+ # TODO(sshank)
+ echo ""
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"