diff options
author | Shashank Kumar Shankar <shashank.kumar.shankar@intel.com> | 2017-08-17 15:43:17 -0700 |
---|---|---|
committer | Victor Morales <victor.morales@intel.com> | 2017-08-29 17:30:07 -0500 |
commit | 9911e6810d1e419be93aca41f7de937c7b2c817b (patch) | |
tree | 13272b1c9181e4a73cba9a64dd01576bc3c7bf1a /bootstrap/vagrant-onap/lib/portal | |
parent | 9b890140774f555d4d71be2b8874875bb6944d4a (diff) |
Add UTs for Portal script
This patch adds Unit Test for checking Portal installation.
Issue-Id: INT-21
Change-Id: I8cb93db08134e9cc96400476a7d1f19d4c789e0c
Signed-off-by: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Diffstat (limited to 'bootstrap/vagrant-onap/lib/portal')
-rwxr-xr-x | bootstrap/vagrant-onap/lib/portal | 96 |
1 files changed, 62 insertions, 34 deletions
diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal index 44cedb20d..505bdde0c 100755 --- a/bootstrap/vagrant-onap/lib/portal +++ b/bootstrap/vagrant-onap/lib/portal @@ -3,53 +3,74 @@ set -o xtrace source /var/onap/functions -source /var/onap/asserts -# install_mariadb() - Pull and create a MariaDB container -function install_mariadb { +policy_src_folder=$git_src_folder/portal +policy_repos=("sdk") + +# clone_all_portal_repos() - Function that clones Portal source repo. +function clone_all_portal_repos { + clone_repo portal $policy_src_folder + clone_repo ecompsdkos $policy_src_folder/ecompsdkos + clone_repo "ui/dmaapbc" $policy_src_folder/dmaapbc + + for dirc in ${policy_repos[@]}; do + clone_repo portal/$dirc $policy_src_folder/$dirc + done +} + +# compile_all_portal_repos() - Function that compiles Portal source repo. +function compile_all_portal_repos { + compile_src $policy_src_folder + + for dirc in ${policy_repos[@]}; do + compile_src $policy_src_folder/$dirc + done +} + +# _build_portal_images() - Function that builds Portal Docker images from source code +function _build_portal_images { + install_maven + + pushd $policy_src_folder/deliveries + chmod +x *.sh + export MVN=$(which mvn) + export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml + export SETTINGS_FILE=$HOME/.m2/settings.xml + bash build_portalapps_dockers.sh + compile_src $policy_src_folder/ecomp-portal-widget-ms + build_docker_image $policy_src_folder/ecomp-portal-widget-ms + popd +} + +# get_portal_images() - Function to get Portal images. +function get_portal_images { + if [[ "$build_image" == "True" ]]; then + _build_portal_images + else + pull_openecomp_image portaldb ecompdb:portal + pull_openecomp_image portalapps ep:1610-1 + fi pull_docker_image mariadb +} + +# _install_mariadb() - Pull and create a MariaDB container +function _install_mariadb { docker create --name data_vol_portal -v /var/lib/mysql mariadb } -# install_portal() - Function that pulls and install the source code of Portal +# install_portal() - Function that installs the source code of Portal function install_portal { - local src_folder=/opt/portal - clone_repo portal $src_folder - clone_repo portal/sdk $src_folder/sdk install_docker docker rm -f ecompdb_portal docker rm -f 1610-1 - pushd $src_folder/deliveries - if [[ "$build_image" == "True" ]]; then - install_maven - - clone_repo ecompsdkos $src_folder/ecompsdkos - clone_repo "ui/dmaapbc" $src_folder/dmaapbc - chmod +x *.sh - export MVN=$(which mvn) - export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml - export SETTINGS_FILE=$HOME/.m2/settings.xml - bash run.sh - compile_src $src_folder/ecomp-portal-widget-ms - build_docker_image $src_folder/ecomp-portal-widget-ms - else - pull_openecomp_image portaldb ecompdb:portal - pull_openecomp_image portalapps ep:1610-1 - fi - for image in ecompdb:portal ep:1610-1; do - asserts_image $image - done - - chmod +x new_start.sh - chmod +x new_stop.sh - chmod +x dbstart.sh + pushd $policy_src_folder/deliveries mkdir -p /PROJECT/OpenSource/UbuntuEP/logs install_package unzip unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/ - bash dbstart.sh - bash new_start.sh + install_docker_compose + bash portal_vm_init.sh sleep 180 @@ -63,6 +84,13 @@ function install_portal { # init_portal() - Function that initialize Portal services function init_portal { - install_mariadb + if [[ "$clone_repo" == "True" ]]; then + clone_all_portal_repos + if [[ "$compile_repo" == "True" ]]; then + compile_all_portal_repos + fi + fi + get_portal_images + _install_mariadb install_portal } |