Merge "Add test suit for SDC helm chart validator"
[integration/csit.git] / scripts / optf-has / has / music_script.sh
index 2a4f178..4257dad 100755 (executable)
@@ -23,12 +23,12 @@ echo "### This is ${WORKSPACE}/scripts/optf-has/has/music_script.sh"
 # add here all the configuration steps eventually needed to be carried out for music CSIT testing
 #
 echo "########## music configuration step ##########";
-CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_3_11:latest
-CASS_IMG_JOB=nexus3.onap.org:10001/onap/music/cassandra_job:latest
+CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_3_11:3.0.23
+CASS_IMG_JOB=nexus3.onap.org:10001/onap/music/cassandra_job:3.0.23
 TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.5
 ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
 BUSYBOX_IMG=nexus3.onap.org:10001/library/busybox:latest
-MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
+MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:3.0.23
 TT=10
 WORK_DIR=/tmp/music
 CASS_USERNAME=nelson24
@@ -66,20 +66,18 @@ docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001"
 -v $MUSIC_TRIGGER_DIR/$TRIGGER_JAR:/etc/cassandra/triggers/$TRIGGER_JAR \
 ${CASS_IMG};
 
+# See if cassandra is up.
+echo "########## Running Test to see if Cassandra is up ##########"
 CASSA_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-db`
 echo "CASSANDRA_IP=${CASSA_IP}"
 ${WORKSPACE}/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042
 
-# See if cassandra is up.
-echo "########## Running Test to see if Cassandra is up ##########"
-docker run --name music-casstest --network music-net \
-$BUSYBOX_IMG sh -c "until nc -z music-db 9042 && echo "success"; do echo 'No connection .. Sleeping for $TT seconds';sleep $TT; done;"
+# Sleep 60 seconds to ensure Cassandra is up and running.
+sleep 60;
 
 # Check to see if Keyspaces are there.
 docker exec music-db cqlsh -u cassandra -p cassandra -e "DESCRIBE keyspaces;"
 
-sleep 10;
-
 # Load data into Cassandra via Cassandra Job
 echo "########## Running Cassandra Job (music-job) to load cql files ##########"
 docker run -d --name music-job --network music-net \
@@ -91,9 +89,22 @@ docker run -d --name music-job --network music-net \
 -e USERNAME=$CASS_USERNAME \
 -e PASSWORD=$CASS_PASSWORD \
 $CASS_IMG_JOB
+
+sleep 70;
+
 # Logs
 echo "########## Cassandra Job logs ##########"
 docker logs music-job
+# Check to see if Keyspaces are there.
+# "############## Check if new username and password work ##########"
+docker exec music-db cqlsh -u $CASS_USERNAME -p $CASS_PASSWORD -e "DESCRIBE keyspaces;"
+# Check to see if Keyspaces are there.
+# "############## Check if original username and password work ##########"
+docker exec music-db cqlsh -u cassandra -p cassandra -e "DESCRIBE keyspaces;"
+# Check to see if Keyspaces are there.
+# "############## Check if new cassandra username and password work ##########"
+docker exec music-db cqlsh -u cassandra -p SomeLongRandomStringNoonewillthinkof -e "DESCRIBE keyspaces;"
+
 
 # Start Music war
 echo "########## Start music-war ##########"
@@ -107,7 +118,7 @@ ZOO_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music
 echo "ZOOKEEPER_IP=${ZOO_IP}"
 
 # Delay  between Cassandra/Zookeeper and Tomcat
-sleep 10;
+sleep 120;
 
 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
 echo "########## Start Tomcat (music-tomcat) ##########"