diff options
Diffstat (limited to 'test/csit')
9 files changed, 132 insertions, 24 deletions
diff --git a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh index 84d36667e..246fb8363 100755 --- a/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh +++ b/test/csit/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh @@ -4,8 +4,14 @@ cd ssl make clean cd .. -docker-compose logs > ${WORKSPACE}/archives/containers_logs/docker-compose.log +COMPOSE_LOGS_FILE=${WORKSPACE}/archives/containers_logs/docker-compose.log +docker-compose logs > ${COMPOSE_LOGS_FILE} docker-compose down docker-compose rm -f -docker network rm ${CONTAINERS_NETWORK}
\ No newline at end of file +docker network rm ${CONTAINERS_NETWORK} + +if grep "LEAK:" ${COMPOSE_LOGS_FILE}; then + echo "Teardown failed. Memory leak detected in docker-compose logs." + exit 1 +fi diff --git a/test/csit/plans/music/music-test-plan/setup.sh b/test/csit/plans/music/music-test-plan/setup.sh index ce5d1085a..7775bc52b 100755 --- a/test/csit/plans/music/music-test-plan/setup.sh +++ b/test/csit/plans/music/music-test-plan/setup.sh @@ -18,60 +18,105 @@ # # add here eventual scripts needed for music # -echo "# music scripts calling"; +echo "########## music scripts calling ##########"; source ${WORKSPACE}/test/csit/scripts/music/music-scripts/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_music:latest +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 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 +TT=10 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 +CQL_FILES=${WORKSPACE}/test/csit/scripts/music/cql +MUSIC_TRIGGER_DIR=/tmp/triggers +TRIGGER_JAR=musictrigger-0.1.0.jar +TRIGGER_JAR_URL=https://nexus.onap.org/service/local/repositories/autorelease-72298/content/org/onap/music/musictrigger/0.1.0/musictrigger-0.1.0.jar + mkdir -p ${MUSIC_PROPERTIES} mkdir -p ${MUSIC_LOGS} mkdir -p ${MUSIC_LOGS}/MUSIC +mkdir -p /tmp/triggers +# Get Trigger +echo "########## Get Trigger Jar ##########" +curl -o $MUSIC_TRIGGER_DIR/$TRIGGER_JAR $TRIGGER_JAR_URL cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties # Create Volume for mapping war file and tomcat +echo "########## create music-vol ##########" docker volume create --name music-vol; # Create a network for all the containers to run in. +echo "########## create music-net ##########" 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}; +echo "########## Start Cassandra (music-db) ##########" +docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" \ +-v $MUSIC_TRIGGER_DIR/$TRIGGER_JAR:/etc/cassandra/triggers/$TRIGGER_JAR \ +${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 +# 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;" + +# 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 \ +-v $CQL_FILES/admin.cql:/cql/admin.cql \ +-v $CQL_FILES/admin_pw.cql:/cql/admin_pw.cql \ +-v $CQL_FILES/extra:/cql/extra \ +-e PORT=9042 \ +-e CASS_HOSTNAME=music-db \ +-e USERNAME=$CASS_USERNAME \ +-e PASSWORD=$CASS_PASSWORD \ +$CASS_IMG_JOB +# Logs +echo "########## Cassandra Job logs ##########" +docker logs music-job + # Start Music war +echo "########## Start music-war ##########" docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; # Start Zookeeper +echo "########## Start zookeeper (music-zk) ##########" 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; +sleep 10; # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. +echo "########## Start Tomcat (music-tomcat) ##########" 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. +echo "########## Create Bridge for Tomcat ##########" docker network connect bridge music-tomcat; TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` @@ -80,20 +125,19 @@ echo "TOMCAT_IP=${TOMCAT_IP}" ${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${TOMCAT_IP} 8080 sleep 20; -echo "get the tomcat logs to make sure its running music properly" -echo "======== TOMCAT Logs ==============" +echo "########## TOMCAT Logs ##########" docker logs music-tomcat # Needed only if we need to look at localhost logs. -#echo "===== MUSIC localhost Log ====================" -#docker exec music-tomcat /bin/bash -c "cat /usr/local/tomcat/logs/localhost*" +echo "########## MUSIC localhost Log ##########" +docker exec music-tomcat /bin/bash -c "cat /usr/local/tomcat/logs/localhost*" -echo "===== MUSIC Log ====================" +echo "########## MUSIC Log ##########" ls -al $MUSIC_LOGS/MUSIC docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/music.log" -echo "===== MUSIC error log ==================" -docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/error.log" +#echo "########## MUSIC error log ##########" +#docker exec music-tomcat /bin/bash -c "cat /opt/app/music/logs/MUSIC/error.log" -echo "inspect docker things for tracing purpose" +echo "########## inspect docker things for tracing purpose ##########" docker inspect music-db docker inspect music-zk docker inspect music-tomcat @@ -101,7 +145,7 @@ docker inspect music-war docker volume inspect music-vol docker network inspect music-net -echo "dump music content just after music is started" +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 'DESCRIBE keyspace admin' @@ -111,7 +155,7 @@ docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM adm # # add here all ROBOT_VARIABLES settings # -echo "# music robot variables settings"; +echo "########## music robot variables settings ##########"; 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/scripts/externalapi-nbi/start_nbi_containers.sh b/test/csit/scripts/externalapi-nbi/start_nbi_containers.sh index 1d1d0fd3e..68fbb029c 100644 --- a/test/csit/scripts/externalapi-nbi/start_nbi_containers.sh +++ b/test/csit/scripts/externalapi-nbi/start_nbi_containers.sh @@ -27,6 +27,7 @@ cd $WORKSPACE/externalapi-nbi # Create .env file to access env variables for docker-compose echo "NEXUS_DOCKER_REPO=${NEXUS_DOCKER_REPO}" > .env +echo "MSB_ENABLED=false" >> .env # Fetch the latest docker-compose.yml wget -O docker-compose.yml 'https://git.onap.org/externalapi/nbi/plain/docker-compose.yml?h=master' diff --git a/test/csit/scripts/music/cql/admin.cql b/test/csit/scripts/music/cql/admin.cql new file mode 100644 index 000000000..df13f32ae --- /dev/null +++ b/test/csit/scripts/music/cql/admin.cql @@ -0,0 +1,34 @@ +CREATE KEYSPACE IF NOT EXISTS admin + WITH REPLICATION = { + 'class' : 'SimpleStrategy', + 'replication_factor': 1 + } + AND DURABLE_WRITES = true; + +CREATE TABLE IF NOT EXISTS admin.keyspace_master ( + uuid uuid, + keyspace_name text, + application_name text, + is_api boolean, + password text, + username text, + is_aaf boolean, + PRIMARY KEY (uuid) +); + +CREATE TABLE IF NOT EXISTS admin.notification_master ( + id uuid, + current_notifier text, + endpoint_password blob, + endpoint_userid text, + notify_delete_on text, + notify_insert_on text, + notify_to_endpoint text, + notify_update_on text, + notifyon text PRIMARY KEY, + request text +); + + + +describe keyspace admin; diff --git a/test/csit/scripts/music/cql/admin_pw.cql b/test/csit/scripts/music/cql/admin_pw.cql new file mode 100644 index 000000000..02de61e2e --- /dev/null +++ b/test/csit/scripts/music/cql/admin_pw.cql @@ -0,0 +1,2 @@ +CREATE ROLE IF NOT EXISTS nelson24 WITH PASSWORD = 'winman123' AND SUPERUSER = True AND LOGIN = True; +ALTER ROLE cassandra WITH PASSWORD = 'SomeLongRandomStringNoonewillthinkof'; diff --git a/test/csit/scripts/music/cql/extra/test.cql b/test/csit/scripts/music/cql/extra/test.cql new file mode 100644 index 000000000..6a5872011 --- /dev/null +++ b/test/csit/scripts/music/cql/extra/test.cql @@ -0,0 +1 @@ +DESCRIBE keyspace admin;
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py index ab3b1e21d..9edad2cc2 100644 --- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py +++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py @@ -8,12 +8,12 @@ class DcaeAppSimulatorLibrary: def configure_dcae_app_simulator_to_consume_messages_from_topics(self, app_url, topics): logger.info("PUT at: " + app_url) - resp = HttpRequests.session_without_env().put(app_url, data={'topics': topics}, timeout=5) + resp = HttpRequests.session_without_env().put(app_url, data={'topics': topics}, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) def assert_DCAE_app_consumed(self, app_url, expected_messages_amount): logger.info("GET at: " + app_url) - resp = HttpRequests.session_without_env().get(app_url, timeout=5) + resp = HttpRequests.session_without_env().get(app_url, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) assert resp.content == expected_messages_amount, \ @@ -21,7 +21,7 @@ class DcaeAppSimulatorLibrary: def assert_DCAE_app_consumed_less_equal_than(self, app_url, messages_threshold): logger.info("GET at: " + app_url) - resp = HttpRequests.session_without_env().get(app_url, timeout=5) + resp = HttpRequests.session_without_env().get(app_url, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) logger.debug("Messages consumed by simulator: " + resp.content + @@ -33,7 +33,7 @@ class DcaeAppSimulatorLibrary: def reset_DCAE_app_simulator(self, app_url): logger.info("DELETE at: " + app_url) - resp = HttpRequests.session_without_env().delete(app_url, timeout=5) + resp = HttpRequests.session_without_env().delete(app_url, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) def assert_DCAE_app_consumed_proper_messages(self, app_url, message_filepath): @@ -42,5 +42,5 @@ class DcaeAppSimulatorLibrary: data = file.read() file.close() - resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=5) + resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) diff --git a/test/csit/tests/externalapi-nbi/healthcheck/healthcheck.robot b/test/csit/tests/externalapi-nbi/healthcheck/healthcheck.robot index 21c084894..6c3ec2961 100644 --- a/test/csit/tests/externalapi-nbi/healthcheck/healthcheck.robot +++ b/test/csit/tests/externalapi-nbi/healthcheck/healthcheck.robot @@ -7,7 +7,7 @@ Library Collections ${GLOBAL_NBI_SERVER_PROTOCOL} http ${GLOBAL_INJECTED_NBI_IP_ADDR} localhost ${GLOBAL_NBI_SERVER_PORT} 8080 -${NBI_HEALTH_CHECK_PATH} /nbi/api/v1/status +${NBI_HEALTH_CHECK_PATH} /nbi/api/v3/status ${NBI_ENDPOINT} ${GLOBAL_NBI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_NBI_IP_ADDR}:${GLOBAL_NBI_SERVER_PORT} *** Test Cases *** diff --git a/test/csit/tests/music/music-suite/music-test.robot b/test/csit/tests/music/music-suite/music-test.robot index 9fc937e49..4eda86919 100644 --- a/test/csit/tests/music/music-suite/music-test.robot +++ b/test/csit/tests/music/music-suite/music-test.robot @@ -49,6 +49,26 @@ Check Music War Docker Container Should Be Equal As Integers ${rc} 0 Should Contain ${output} music-war +Healthcheck Cassandra + [Documentation] It sends a REST GET request to retrieve the Music.war version + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/service/pingCassandra/ONE headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +Healthcheck Zookeeper + [Documentation] It sends a REST GET request to retrieve the Music.war version + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/service/pingZookeeper headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Get Music Version [Documentation] It sends a REST GET request to retrieve the Music.war version Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} |