diff options
author | efiacor <fiachra.corcoran@est.tech> | 2020-05-22 13:48:52 +0100 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2020-06-10 12:38:50 +0100 |
commit | b67a09344fb23f6a9b2c783f1f3570ddd723f6f6 (patch) | |
tree | 141b157c099b70067f66637c906a8b7889c9f739 /plans/dcaegen2-services-pmsh | |
parent | 60e200441cd0f81d88c63b41eb82d3e236328014 (diff) |
[PMSH] Refactoring suite to utilise new endpoint
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Issue-ID: DCAEGEN2-2154
Change-Id: Id6697259fdab19126a1878f75d24766a5f63f10b
Diffstat (limited to 'plans/dcaegen2-services-pmsh')
-rw-r--r-- | plans/dcaegen2-services-pmsh/testsuite/setup.sh | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/plans/dcaegen2-services-pmsh/testsuite/setup.sh b/plans/dcaegen2-services-pmsh/testsuite/setup.sh index 5c599069..eb2196a0 100644 --- a/plans/dcaegen2-services-pmsh/testsuite/setup.sh +++ b/plans/dcaegen2-services-pmsh/testsuite/setup.sh @@ -6,56 +6,90 @@ export DB_PASSWORD=pmsh TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite -docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d db aai-sim cbs-sim mr-sim +docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d db aai-sim cbs-sim mr-sim # Slow machine running CSITs can affect db coming up in time for PMSH echo "Waiting for postgres db to come up..." for i in {1..30}; do docker exec -i db bash -c "PGPASSWORD=$DB_PASSWORD;psql -U $DB_USER -c '\q'" db_response=$? - if [ "$db_response" = "0" ] + if [[ "$db_response" == "0" ]] then break else sleep 2 fi done -[ "$db_response" != "0" ] && echo "Error: postgres db not accessible" && exit 1 +[[ "$db_response" != "0" ]] && echo "Error: postgres db not accessible" && exit 1 -docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d pmsh +docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d pmsh PMSH_IP=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" pmsh) # Slow machine running CSITs can affect PMSH coming up before CSITs are run echo "Waiting for PMSH to come up..." for i in {1..30}; do - pmsh_response=$(curl -k -s -o /dev/null -w "%{http_code}" https://$PMSH_IP:8443/healthcheck) - if [ "$pmsh_response" = "200" ] + pmsh_response=$(curl -k -s -o /dev/null -w "%{http_code}" https://${PMSH_IP}:8443/healthcheck) + if [[ "$pmsh_response" == "200" ]] then break else sleep 2 fi done -[ "$pmsh_response" != "200" ] && echo "Error: PMSH container state not healthy" && exit 1 +[[ "$pmsh_response" != "200" ]] && echo "Error: PMSH container state not healthy" && exit 1 + +# Set log level to DEBUG +docker exec pmsh /bin/sh -c "cat > log_config.yaml <<EOF +version: 1 + +disable_existing_loggers: true + +loggers: + onap_logger: + level: DEBUG + handlers: [onap_log_handler, stdout_handler] + propagate: false +handlers: + onap_log_handler: + class: logging.handlers.RotatingFileHandler + filename: /var/log/ONAP/dcaegen2/services/pmsh/application.log + mode: a + maxBytes: 10000000 + backupCount: 10 + formatter: mdcFormatter + stdout_handler: + class: logging.StreamHandler + formatter: mdcFormatter +formatters: + mdcFormatter: + format: '%(asctime)s | %(threadName)s | %(thread)d | %(levelname)s | %(module)s + | %(funcName)s | %(mdc)s | %(message)s' + mdcfmt: '{ServiceName} | {RequestID} | {InvocationID}' + datefmt: '%Y-%m-%dT%H:%M:%S%z' + (): onaplogging.mdcformatter.MDCFormatter +EOF" # Wait for initialization of Docker containers -containers_ok=false -for i in {1..5}; do - if [ $(docker inspect --format '{{ .State.Running }}' cbs-sim) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' aai-sim) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' mr-sim) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' db) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' pmsh) ] +containers_ok="false" +for i in {0..5}; do + if [[ "$containers_ok" == "true" ]] then echo "All required docker containers are up." - containers_ok=true break else - sleep $i + sleep ${i} + fi + if [[ $(docker inspect --format '{{ .State.Running }}' cbs-sim) ]] && \ + [[ $(docker inspect --format '{{ .State.Running }}' aai-sim) ]] && \ + [[ $(docker inspect --format '{{ .State.Running }}' mr-sim) ]] && \ + [[ $(docker inspect --format '{{ .State.Running }}' db) ]] && \ + [[ $(docker inspect --format '{{ .State.Running }}' pmsh) ]] + then + containers_ok="true" fi done -[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1 +[[ "$containers_ok" == "false" ]] && echo "Error: required container not running." && exit 1 DB_IP_ADDRESS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" db) MR_SIM_IP_ADDRESS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" mr-sim) |