diff options
Diffstat (limited to 'test/csit/plans/music')
5 files changed, 177 insertions, 23 deletions
diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh b/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh new file mode 100644 index 000000000..88becf69e --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Not sure why this is needed. +source ${SCRIPTS}/common_functions.sh + +# Initial Configuration. +DATASTORE="consul" +DATASTORE_IP="localhost" + +MOUNTPATH="/dkv_mount_path/configs/" +DEFAULT_CONFIGS=$(pwd)/mountpath/default + +mkdir -p mountpath/default + +pushd mountpath/default +cat << EOF > sampleConfig1.properties +foo1=bar1 +hello1=world1 +key1=value1 +EOF +cat << EOF > sampleConfig2.properties +foo2=bar2 +hello2=world2 +key2=value2 +EOF +popd + +docker login -u docker -p docker nexus3.onap.org:10001 +docker pull nexus3.onap.org:10001/onap/music/distributed-kv-store +docker run -e DATASTORE=$DATASTORE -e DATASTORE_IP=$DATASTORE_IP -e MOUNTPATH=$MOUNTPATH -d \ + --name dkv \ + -v $DEFAULT_CONFIGS:/dkv_mount_path/configs/default \ + -p 8200:8200 -p 8080:8080 nexus3.onap.org:10001/onap/music/distributed-kv-store + + +echo "###### WAITING FOR DISTRIBUTED KV STORE CONTAINER TO COME UP" +sleep 10 + +# +# add here all ROBOT_VARIABLES settings +# +echo "# music robot variables settings"; +ROBOT_VARIABLES="-v DKV_HOSTNAME:http://localhost -v DKV_PORT:8080" + +echo ${ROBOT_VARIABLES}
\ No newline at end of file diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh b/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh new file mode 100644 index 000000000..0abf3a62d --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +rm -rf mountpath +docker stop dkv +docker rm dkv +docker rmi nexus3.onap.org:10001/onap/music/distributed-kv-store diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt b/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt new file mode 100644 index 000000000..ac37bc5a6 --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +music/music-distributed-kv-store-suite
\ No newline at end of file diff --git a/test/csit/plans/music/music-test-plan/setup.sh b/test/csit/plans/music/music-test-plan/setup.sh index 517837c9a..ddfdfc023 100755 --- a/test/csit/plans/music/music-test-plan/setup.sh +++ b/test/csit/plans/music/music-test-plan/setup.sh @@ -18,41 +18,85 @@ # # add here eventual scripts needed for music # -echo "##########################################################"; -echo "#"; echo "# music scripts calling"; -echo "#"; -echo "##########################################################"; source ${WORKSPACE}/test/csit/scripts/music/music-scripts/music_script.sh # -# add here below the start of all docker containers needed for music CSIT testing -# -echo "##########################################################"; -echo "#"; -echo "# music scripts docker containers spinoff"; -echo "#"; -echo "##########################################################"; - -# # add here all the configuration steps eventually needed to be carried out for music CSIT testing # -echo "##########################################################"; -echo "#"; echo "# music configuration step"; -echo "#"; -echo "##########################################################"; + +CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest +TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0 +ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4 +MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest +WORK_DIR=/tmp/music +CASS_USERNAME=nelson24 +CASS_PASSWORD=winman123 +MUSIC_SOURCE_PROPERTIES=${WORKSPACE}/test/csit/scripts/music/music-properties +MUSIC_PROPERTIES=/tmp/music/properties +MUSIC_LOGS=/tmp/music/logs +mkdir -p ${MUSIC_PROPERTIES} +mkdir -p ${MUSIC_LOGS} + +cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties + +# Create Volume for mapping war file and tomcat +docker volume create --name music-vol; + +# Create a network for all the containers to run in. +docker network create music-net; + +# Start Cassandra +docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG}; + +CASSA_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-db` +echo "CASSANDRA_IP=${CASSA_IP}" +${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042 + +# Start Music war +docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; + +# Start Zookeeper +docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}; + +ZOO_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-zk` +echo "ZOOKEEPER_IP=${ZOO_IP}" + +# Delay between Cassandra/Zookeeper and Tomcat +sleep 60; + +# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. +docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG}; + +# Connect tomcat to host bridge network so that its port can be seen. +docker network connect bridge music-tomcat; + +TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` +echo "TOMCAT_IP=${TOMCAT_IP}" + +${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${TOMCAT_IP} 8080 + + +echo "inspect docker things for tracing purpose" +docker inspect music-db +docker inspect music-zk +docker inspect music-tomcat +docker inspect music-war +docker volume inspect music-vol +docker network inspect music-net + +echo "dump music content just after music is started" +docker exec music-db /usr/bin/nodetool status +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' # # add here all ROBOT_VARIABLES settings # -echo "##########################################################"; -echo "#"; echo "# music robot variables settings"; -echo "#"; -echo "##########################################################"; -ROBOT_VARIABLES="-v MUSIC_HOSTNAME:http://localhost -v MUSIC_PORT:8080 -v COND_HOSTNAME:http://localhost -v COND_PORT:8091" +ROBOT_VARIABLES="-v MUSIC_HOSTNAME:http://${TOMCAT_IP} -v MUSIC_PORT:8080 -v COND_HOSTNAME:http://localhost -v COND_PORT:8091" echo ${ROBOT_VARIABLES} diff --git a/test/csit/plans/music/music-test-plan/teardown.sh b/test/csit/plans/music/music-test-plan/teardown.sh index 884a64f71..e9982ae27 100755 --- a/test/csit/plans/music/music-test-plan/teardown.sh +++ b/test/csit/plans/music/music-test-plan/teardown.sh @@ -24,5 +24,31 @@ echo "#"; echo "# music scripts docker containers killing"; echo "#"; echo "##########################################################"; -# kill-instance.sh <dockercontainername> +docker stop music-tomcat +docker stop music-war +docker stop music-zk +docker stop music-db + +docker rm music-zk +docker rm music-tomcat +docker rm music-war +docker rm music-db + +docker network rm music-net; +sleep 5; + +docker volume rm music-vol + +echo "dump music.log files" +ls -alF /tmp/music +ls -alF /tmp/music/properties +cat /tmp/music/properties/music.properties +cat /tmp/music/logs/MUSIC/music.log +cat /tmp/music/logs/MUSIC/error.log + +#rm -Rf /tmp/music + + + + |