blob: 17a66313a8664e45d9a2d2e7bf3008042681b040 [file] [log] [blame]
Victor Moralesdd074802017-07-26 16:06:35 -05001#!/bin/bash
2
3source /var/onap_tests/_test_base
4source /var/onap/functions
5
6covered_functions=(
7"create_configuration_files" "clone_repo" "install_dev_tools"
8"configure_bind" "install_java" "install_maven" "install_nodejs" "install_python"
9"install_docker" "pull_docker_image" "install_docker_compose" "configure_service"
10"start_ODL" "compile_src" "build_docker_image"
11)
12
13# TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings
14if [ -z $http_proxy ] & [ -z $https_proxy ]; then
15 covered_functions=(${covered_functions[@]} "docker_openecomp_login" "pull_openecomp_image")
16fi
17
18# test_create_configuration_files() - Verify the creation of a configuration files
19function test_create_configuration_files {
20 create_configuration_files
21
22 asserts_file_exist /opt/config/nexus_docker_repo.txt
23 asserts_file_exist /opt/config/nexus_username.txt
24 asserts_file_exist /opt/config/nexus_password.txt
25 asserts_file_exist /opt/config/openstack_username.txt
26 asserts_file_exist /opt/config/tenant_id.txt
27 asserts_file_exist /opt/config/dmaap_topic.txt
28 asserts_file_exist /opt/config/docker_version.txt
29}
30
31# test_docker_openecomp_login() - Verify the proper login to OpenECOMP Docker Hub
32function test_docker_openecomp_login {
33 docker_openecomp_login
34}
35
36# test_pull_openecomp_image() - Verify the addition of a OpenECOMP container image
37function test_pull_openecomp_image {
38 pull_openecomp_image portalapps ep:1610-1
39
40 asserts_installed_package docker-ce
41 asserts_image ep:1610-1
42
43 docker rmi -f ep:1610-1
44}
45
46# test_clone_repo() - Verify cloning and pulling source code from repositories
47function test_clone_repo {
48 clone_repo demo
49
50 asserts_installed_package git
51 asserts_file_exist $git_src_folder/demo/LICENSE.TXT
52}
53
54# test_install_dev_tools() - Verify the correct installation of developer tools
55function test_install_dev_tools {
56 install_dev_tools
57
58 asserts_installed_package apt-transport-https
59 asserts_installed_package ca-certificates
60 asserts_installed_package curl
61}
62
63# test_configure_bind() - Verify the correct installation and configuration of bind
64function test_configure_bind {
65 configure_bind
66
67 asserts_installed_package bind9
68 asserts_installed_package bind9utils
69 asserts_file_exist /etc/bind/zones/db.simpledemo.openecomp.org
70 asserts_file_exist /etc/bind/named.conf.options
71 asserts_file_exist /etc/bind/named.conf.local
72
73 rm -rf /etc/bind/
74}
75
76# test_install_java() - Verify the correct installation of java
77function test_install_java {
78 install_java
79
80 asserts_installed_package openjdk-8-jdk
81}
82
83# test_install_maven() - Verify the correct installation and configuration of maven
84function test_install_maven {
85 install_maven
86
87 asserts_installed_package maven3
88 asserts_installed_package openjdk-8-jdk
89 asserts_file_exist $mvn_conf_file
90}
91
92# test_install_nodejs() - Verify the correct installation of NodeJS tools
93function test_install_nodejs {
94 install_nodejs
95
96 asserts_installed_package nodejs
97 asserts_file_exist /usr/bin/npm
98}
99
100# test_install_python() - Verify the correct installation of Python
101function test_install_python {
102 install_python
103 asserts_installed_package python2.7
104 asserts_installed_package python-dev
Victor Moralesdd074802017-07-26 16:06:35 -0500105}
106
107# test_install_docker() - Verify the correct installation of Docker
108function test_install_docker {
109 install_docker
110
111 asserts_installed_package docker-ce
112}
113
114# test_pull_docker_image() - Verify the correct retrieve of a specific docker image
115function test_pull_docker_image {
116 local image=attos/dmaap
117 pull_docker_image $image
118
119 asserts_image $image
120
121 docker rmi -f $image
122}
123
124# test_install_docker_compose() - Verify the correct installation of Docker Compose tool
125function test_install_docker_compose {
126 install_docker_compose
127
128 asserts_file_exist /opt/docker/docker-compose
129}
130
131# test_configure_service() - Verify the correct configuration of a specific init service
132function test_configure_service {
133 local service=mso
134
135 configure_service $service
136
137 asserts_file_exist /etc/init.d/$service
138
139 rm -rf /etc/init.d/$service
140}
141
142# test_start_ODL() - Verify the installation and configuration of OpenDayLight controller
143function test_start_ODL {
144 start_ODL
145
146 asserts_file_exist /opt/opendaylight/current/bin/start
147}
148
149# test_compile_src() - Verify the compilation of java code using maven tools
150function test_compile_src {
151 local repo=vid/asdcclient
152 clone_repo $repo
153 compile_src $git_src_folder/$repo
154
155 asserts_file_exist $git_src_folder/$repo/target/asdcclient-1.0.2-SNAPSHOT.jar
156}
157
158# test_build_docker_image() - Verify that a docker image is created from source code
159function test_build_docker_image {
Victor Moralesa898f562017-09-14 15:43:21 -0700160 clone_repo ccsdk/distribution
161 build_docker_image $git_src_folder/ccsdk/distribution/ubuntu docker
Victor Moralesdd074802017-07-26 16:06:35 -0500162
Victor Moralesa898f562017-09-14 15:43:21 -0700163 asserts_image onap/ccsdk-ubuntu-image
Victor Moralesdd074802017-07-26 16:06:35 -0500164
Victor Moralesa898f562017-09-14 15:43:21 -0700165 docker rmi -f onap/ccsdk-ubuntu-image
Victor Moralesdd074802017-07-26 16:06:35 -0500166}
167
168if [ "$1" != '*' ]; then
169 unset covered_functions
170 covered_functions=$1
171fi
172main "${covered_functions[@]}"