From dfdca185681554d67b63ec37ed19954654223e46 Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Fri, 10 Dec 2021 10:43:32 +0100 Subject: [PATCH] Updated test for helm chart recipe Issue-ID: NONRTRIC-618 Signed-off-by: BjornMagnussonXA Change-Id: I99426c99e0e33fbbeae06103428d9b452a72f3da --- test/auto-test/FTC_HELM_E_RELEASE.sh | 46 ++++++++++++++++------- test/auto-test/README.md | 8 ++-- test/auto-test/override_ftc_helm_e_release.sh | 18 ++++++++- test/common/ricsim_api_functions.sh | 8 +++- test/common/test_env-onap-guilin.sh | 1 + test/common/test_env-onap-honolulu.sh | 1 + test/common/test_env-onap-istanbul.sh | 1 + test/common/test_env-oran-cherry.sh | 1 + test/common/test_env-oran-d-release.sh | 1 + test/common/test_env-oran-e-release.sh | 2 +- test/common/testcase_common.sh | 41 +++++++++++++------- test/http-https-proxy/Dockerfile | 2 +- test/kafka-procon/main.go | 30 ++++++++++----- test/mrstub/Dockerfile | 4 +- test/mrstub/app/main.py | 3 +- test/simulator-group/pvc-cleaner/pvc-cleaner.yaml | 4 +- 16 files changed, 122 insertions(+), 49 deletions(-) diff --git a/test/auto-test/FTC_HELM_E_RELEASE.sh b/test/auto-test/FTC_HELM_E_RELEASE.sh index 2a6a3075..dcbe7b3a 100755 --- a/test/auto-test/FTC_HELM_E_RELEASE.sh +++ b/test/auto-test/FTC_HELM_E_RELEASE.sh @@ -19,13 +19,13 @@ TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm chats - all components - E-RELEASE" # This script requires the helm charts for nonrtric, a1simulator and a1controller are installed -# There should be 2 simulator of version started +# There should be 2 simulator of each A1 interface version started #App names to include in the test when running docker, space separated list DOCKER_INCLUDED_IMAGES="" # Not used - KUBE only test script #App names to include in the test when running kubernetes, space separated list -KUBE_INCLUDED_IMAGES=" MR CR PRODSTUB KUBEPROXY" +KUBE_INCLUDED_IMAGES=" MR DMAAPMR CR PRODSTUB KUBEPROXY KAFKAPC" #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ICS RC SDNC DMAAPMED DMAAPADP" @@ -40,13 +40,14 @@ setup_testenvironment #### TEST BEGIN #### -use_mr_http #MR only supports http? +use_mr_https use_cr_https use_agent_rest_https use_sdnc_https use_simulator_https use_ics_rest_https use_prod_stub_https +use_dmaapmed_https if [ $ICS_VERSION == "V1-1" ]; then use_rapp_catalogue_http # https not yet supported @@ -67,10 +68,10 @@ fi clean_environment -pms_kube_pvc_reset - ics_kube_pvc_reset +pms_kube_pvc_reset + start_kube_proxy STD_NUM_RICS=2 @@ -88,7 +89,16 @@ start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0 echo " RIC MAPPING a1-sim-std2-0 : ric5" echo " RIC MAPPING a1-sim-std2-1 : ric6" -start_mr +start_mr "$MR_READ_TOPIC" "/events" "users/policy-agent" \ + "$MR_WRITE_TOPIC" "/events" "users/mr-stub" \ + "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \ + "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs" + +start_kafkapc + +kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text" "text/plain" + +kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text" start_control_panel @@ -313,6 +323,7 @@ do sim_equal "a1-sim-osc-"$i num_instances 2 done +cr_api_reset 0 # Reset CR to count new events echo "ADD EVENT/STATUS CHECK" echo "ADD MR CHECK" @@ -346,7 +357,7 @@ if [ $ICS_VERSION == "V1-1" ]; then else ics_api_edp_put_type_2 201 type1 testdata/ics/ei-type-1.json ics_api_edp_get_type_2 200 type1 - ics_api_edp_get_type_ids 200 type1 + ics_api_edp_get_type_ids 200 STD_Fault_Messages ExampleInformationTypeKafka ExampleInformationType type1 ics_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 ics_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 @@ -367,7 +378,7 @@ fi if [ $ICS_VERSION == "V1-1" ]; then prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json else - if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then + if [[ "$ICS_FEATURE3LEVEL" == *"INFO-TYPES"* ]]; then prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json else prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json @@ -398,13 +409,13 @@ start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE -ics_equal json:ei-producer/v1/eiproducers 2 60 +ics_equal json:data-producer/v1/info-producers 3 120 -ics_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages +ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka STD_Fault_Messages type-1 -ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer +ics_api_edp_get_producer_ids_2 200 NOTYPE prod-a DmaapGenericInfoProducer DMaaP_Mediator_Producer -NUM_JOBS=5 +NUM_JOBS=1 for ((i=1; i<=$NUM_JOBS; i++)) do @@ -414,23 +425,30 @@ done for ((i=1; i<=$NUM_JOBS; i++)) do ics_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH_0/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH_0/job_status_info-ownery$i testdata/dmaap-adapter/job-template.json + ics_api_idc_put_job 201 jobz$i ExampleInformationTypeKafka $CR_SERVICE_MR_PATH_0/jobz-data$i info-ownerz$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerz$i testdata/dmaap-adapter/job-template-1-kafka.json done for ((i=1; i<=$NUM_JOBS; i++)) do ics_api_a1_get_job_status 200 jobx$i ENABLED 30 + ics_api_a1_get_job_status 200 joby$i ENABLED 30 + ics_api_a1_get_job_status 200 jobz$i ENABLED 30 done mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}' mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}' mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}' mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}' +kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------4' +kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------6' + -cr_equal 0 received_callbacks $(($NUM_JOBS*2*2)) 60 +cr_equal 0 received_callbacks $(($NUM_JOBS*2*3)) 200 for ((i=1; i<=$NUM_JOBS; i++)) do cr_equal 0 received_callbacks?id=jobx-data$i 2 cr_equal 0 received_callbacks?id=joby-data$i 2 + cr_equal 0 received_callbacks?id=jobz-data$i 2 done for ((i=1; i<=$NUM_JOBS; i++)) @@ -439,6 +457,8 @@ do cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}' cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}' cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}' + cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------4' + cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------6' done diff --git a/test/auto-test/README.md b/test/auto-test/README.md index cd3c7787..76858fe8 100644 --- a/test/auto-test/README.md +++ b/test/auto-test/README.md @@ -48,9 +48,12 @@ ORAN D-RELEASE ORAN E-RELEASE ========= ->```./PM_EI_DEMO.sh remote-remove docker --env-file ../common/test_env-oran-e-release.sh``` +>```./PM_EI_DEMO.sh remote-remove docker release --env-file ../common/test_env-oran-e-release.sh``` ->```./PM_EI_DEMO.sh remote-remove kube --env-file ../common/test_env-oran-e-release.sh``` +>```./PM_EI_DEMO.sh remote-remove kube release --env-file ../common/test_env-oran-e-release.sh``` + +ORAN E-RELEASE with nonrtric deployed with helm charts for the "dep" repo +>```../FTC_HELM_E_RELEASE.sh remote-remove kube release --env-file ../common/test_env-oran-e-release.sh --override override_ftc_helm_e_release.sh``` ONAP GUILIN =========== @@ -72,7 +75,6 @@ ONAP ISTANBUL >```./PM_EI_DEMO.sh remote-remove kube release --env-file ../common/test_env-onap-istanbul.sh``` -Note: When istanbul is released, add the 'release' arg to run released images. ## Test case categories diff --git a/test/auto-test/override_ftc_helm_e_release.sh b/test/auto-test/override_ftc_helm_e_release.sh index c23a3105..3894acef 100644 --- a/test/auto-test/override_ftc_helm_e_release.sh +++ b/test/auto-test/override_ftc_helm_e_release.sh @@ -15,8 +15,22 @@ # limitations under the License. # ################################################################################ -# Override file example +# Override file for running the e-release helm recipe including all components -KUBE_A1SIM_NAMESPACE="a1-sim" +KUBE_A1SIM_NAMESPACE="nonrtric" +KUBE_SDNC_NAMESPACE="nonrtric" RIC_SIM_PREFIX="a1-sim" +RIC_SIM_COMMON_SVC_NAME="a1-sim" + +ICS_EXTERNAL_PORT=9082 +ICS_EXTERNAL_SECURE_PORT=9083 + +POLICY_AGENT_EXTERNAL_PORT=9080 +POLICY_AGENT_EXTERNAL_SECURE_PORT=9081 + +SDNC_EXTERNAL_PORT=8282 +SDNC_EXTERNAL_SECURE_PORT=8383 + +RAPP_CAT_EXTERNAL_PORT=9085 +RAPP_CAT_EXTERNAL_SECURE_PORT=9086 diff --git a/test/common/ricsim_api_functions.sh b/test/common/ricsim_api_functions.sh index 435c208f..bd526119 100644 --- a/test/common/ricsim_api_functions.sh +++ b/test/common/ricsim_api_functions.sh @@ -58,7 +58,7 @@ __RICSIM_kube_scale_zero() { # This function is called for prestarted apps not managed by the test script. __RICSIM_kube_scale_zero_and_wait() { #__kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-"$RIC_SIM_PREFIX - __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app # the values of the app label is not known + __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-a1simulator" } # Delete all kube resouces for the app @@ -335,7 +335,11 @@ get_kube_sim_host() { __find_sim_host() { if [ $RUNMODE == "KUBE" ]; then ricname=$(echo "$1" | tr '_' '-') # Kube does not accept underscore in names as docker do - ric_setname="${ricname%-*}" #Extract the stateful set name + if [ -z "$RIC_SIM_COMMON_SVC_NAME" ]; then + ric_setname="${ricname%-*}" #Extract the stateful set name + else + ric_setname=$RIC_SIM_COMMON_SVC_NAME # Use the common svc name in the host name of the sims + fi echo $RIC_SIM_HTTPX"://"$ricname.$ric_setname.$KUBE_A1SIM_NAMESPACE":"$RIC_SIM_PORT else if [ $DOCKER_COMPOSE_VERION == "V1" ]; then diff --git a/test/common/test_env-onap-guilin.sh b/test/common/test_env-onap-guilin.sh index 3254e062..0fdb0652 100755 --- a/test/common/test_env-onap-guilin.sh +++ b/test/common/test_env-onap-guilin.sh @@ -258,6 +258,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185 # RIC Simulator contain RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container SDNC_DISPLAY_NAME="SDNC A1 Controller" diff --git a/test/common/test_env-onap-honolulu.sh b/test/common/test_env-onap-honolulu.sh index b312518e..efb54251 100755 --- a/test/common/test_env-onap-honolulu.sh +++ b/test/common/test_env-onap-honolulu.sh @@ -314,6 +314,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185 # RIC Simulator contain RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container SDNC_DISPLAY_NAME="SDNC A1 Controller" diff --git a/test/common/test_env-onap-istanbul.sh b/test/common/test_env-onap-istanbul.sh index a8d1b0a7..9d13a815 100644 --- a/test/common/test_env-onap-istanbul.sh +++ b/test/common/test_env-onap-istanbul.sh @@ -317,6 +317,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185 # RIC Simulator contain RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container SDNC_DISPLAY_NAME="SDNC A1 Controller" diff --git a/test/common/test_env-oran-cherry.sh b/test/common/test_env-oran-cherry.sh index 6abb1339..fbf13f62 100755 --- a/test/common/test_env-oran-cherry.sh +++ b/test/common/test_env-oran-cherry.sh @@ -317,6 +317,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" # Base path for alive check +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container SDNC_DISPLAY_NAME="SDNC A1 Controller" diff --git a/test/common/test_env-oran-d-release.sh b/test/common/test_env-oran-d-release.sh index ed7670ed..51b11895 100755 --- a/test/common/test_env-oran-d-release.sh +++ b/test/common/test_env-oran-d-release.sh @@ -336,6 +336,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" # Base path for alive check +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) # Kept as reference for oran a1 adapter # SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container diff --git a/test/common/test_env-oran-e-release.sh b/test/common/test_env-oran-e-release.sh index 044ad241..65dd0afc 100755 --- a/test/common/test_env-oran-e-release.sh +++ b/test/common/test_env-oran-e-release.sh @@ -367,7 +367,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert" RIC_SIM_COMPOSE_DIR="ric" # Dir in simulator group for docker compose RIC_SIM_ALIVE_URL="/" # Base path for alive check - +RIC_SIM_COMMON_SVC_NAME="" # Name of svc if one common svc is used for all ric sim groups (stateful sets) # Kept as reference for oran a1 adapter # SDNC_APP_NAME="a1controller" # Name of the SNDC A1 Controller container # SDNC_DISPLAY_NAME="SDNC A1 Controller" diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index d8b359b3..0a253913 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -756,6 +756,7 @@ fi echo "" # auto adding system apps +__added_apps="" echo -e $BOLD"Auto adding system apps"$EBOLD if [ $RUNMODE == "KUBE" ]; then INCLUDED_IMAGES=$INCLUDED_IMAGES" "$TESTENV_KUBE_SYSTEM_APPS @@ -768,26 +769,39 @@ if [ ! -z "$TMP_APPS" ]; then for iapp in "$TMP_APPS"; do file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]') file_pointer="../common/"$file_pointer"_api_functions.sh" - echo " Auto-adding system app $iapp. Sourcing $file_pointer" + padded_iapp=$iapp + while [ ${#padded_iapp} -lt 16 ]; do + padded_iapp=$padded_iapp" " + done + echo " Auto-adding system app $padded_iapp Sourcing $file_pointer" . $file_pointer + __added_apps=" $iapp "$__added_apps done else echo " None" fi +if [ $RUNMODE == "KUBE" ]; then + TMP_APPS=$INCLUDED_IMAGES" "$KUBE_PRESTARTED_IMAGES +else + TMP_APPS=$INCLUDED_IMAGES +fi + echo -e $BOLD"Auto adding included apps"$EBOLD - for iapp in $INCLUDED_IMAGES; do - file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]') - file_pointer="../common/"$file_pointer"_api_functions.sh" - padded_iapp=$iapp - while [ ${#padded_iapp} -lt 16 ]; do - padded_iapp=$padded_iapp" " - done - echo " Auto-adding included app $padded_iapp Sourcing $file_pointer" - . $file_pointer - if [ ! -f "$file_pointer" ]; then - echo " Include file $file_pointer for app $iapp does not exist" - exit 1 + for iapp in $TMP_APPS; do + if [[ "$__added_apps" != *"$iapp"* ]]; then + file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]') + file_pointer="../common/"$file_pointer"_api_functions.sh" + padded_iapp=$iapp + while [ ${#padded_iapp} -lt 16 ]; do + padded_iapp=$padded_iapp" " + done + echo " Auto-adding included app $padded_iapp Sourcing $file_pointer" + . $file_pointer + if [ ! -f "$file_pointer" ]; then + echo " Include file $file_pointer for app $iapp does not exist" + exit 1 + fi fi done echo "" @@ -2245,6 +2259,7 @@ __kube_clean_pvc() { export PVC_CLEANER_NAMESPACE=$2 export PVC_CLEANER_CLAIMNAME=$3 export PVC_CLEANER_RM_PATH=$4 + export PVC_CLEANER_APP_NAME input_yaml=$SIM_GROUP"/"$PVC_CLEANER_COMPOSE_DIR"/"pvc-cleaner.yaml output_yaml=$PWD/tmp/$2-pvc-cleaner.yaml diff --git a/test/http-https-proxy/Dockerfile b/test/http-https-proxy/Dockerfile index d7a78ad1..7f0ef12b 100644 --- a/test/http-https-proxy/Dockerfile +++ b/test/http-https-proxy/Dockerfile @@ -13,4 +13,4 @@ COPY cert/pass . WORKDIR /usr/src/app COPY http_proxy.js . -CMD [ "node", "http_proxy.js" ] \ No newline at end of file +CMD [ "node", "http_proxy.js" ] diff --git a/test/kafka-procon/main.go b/test/kafka-procon/main.go index 6f8bad2f..43be1b5a 100644 --- a/test/kafka-procon/main.go +++ b/test/kafka-procon/main.go @@ -309,6 +309,7 @@ func getTopicCounter(w http.ResponseWriter, req *http.Request) { func startToSend(w http.ResponseWriter, req *http.Request) { t, topicId, exist := getTopicFromRequest(w, req) + fmt.Printf("Start to send to topic: %v\n", topicId) if !exist { return } @@ -324,7 +325,10 @@ func startToSend(w http.ResponseWriter, req *http.Request) { fmt.Printf("Cannot create producer for topic: %v, error details: %v\n", topicId, err) return } - defer func() { p.Close() }() + defer func() { + fmt.Printf("Closing producer for topic: %v\n", topicId) + p.Close() + }() for { q := t.messages.send if q == nil { @@ -342,12 +346,12 @@ func startToSend(w http.ResponseWriter, req *http.Request) { globalCounters.sent.step() msg := fmt.Sprintf("%v", m) if len(msg) < 500 { - fmt.Printf("Message sent on topic: %v, len: %v, msg: %v", topicId, len(msg), msg) + fmt.Printf("Message sent on topic: %v, len: %v, msg: %v\n", topicId, len(msg), msg) } else { - fmt.Printf("Message sent on topic: %v, len: %v, is larger than 500...not printed", topicId, len(msg)) + fmt.Printf("Message sent on topic: %v, len: %v, is larger than 500...not printed\n", topicId, len(msg)) } } else { - fmt.Printf("Failed to send message on topic: %v. Discarded. Error details: %v", topicId, err) + fmt.Printf("Failed to send message on topic: %v. Discarded. Error details: %v\n", topicId, err) q.Remove(0) } } else { @@ -409,9 +413,9 @@ func startToReceive(w http.ResponseWriter, req *http.Request) { msg, err := c.ReadMessage(maxDur) if err == nil { if len(msg.Value) < 500 { - fmt.Printf("Message received on topic: %v, partion: %v, len: %v, msg: %v", topicId, msg.TopicPartition, len(msg.Value), string(msg.Value)) + fmt.Printf("Message received on topic: %v, partion: %v, len: %v, msg: %v\n", topicId, msg.TopicPartition, len(msg.Value), string(msg.Value)) } else { - fmt.Printf("Message received on topic: %v, partion: %v, len: %v is larger than 500...not printed", topicId, msg.TopicPartition, len(msg.Value)) + fmt.Printf("Message received on topic: %v, partion: %v, len: %v is larger than 500...not printed\n", topicId, msg.TopicPartition, len(msg.Value)) } err = t.messages.received.Enqueue(string(msg.Value)) if err != nil { @@ -435,7 +439,9 @@ func startToReceive(w http.ResponseWriter, req *http.Request) { // Post a message to a topic // POST /send content type is specified in content type func sendToTopic(w http.ResponseWriter, req *http.Request) { + t, topicId, exist := getTopicFromRequest(w, req) + fmt.Printf("Send to topic: %v\n", topicId) if !exist { return } @@ -471,10 +477,12 @@ func sendToTopic(w http.ResponseWriter, req *http.Request) { b, err := ioutil.ReadAll(req.Body) if err == nil { if len(b) < 500 { - fmt.Printf("Json payload to send on topic: %v, msg: %v", topicId, string(b)) + fmt.Printf("Json payload to send on topic: %v, msg: %v\n", topicId, string(b)) } else { - fmt.Printf("Json payload to send on topic: %v larger than 500 bytes, not printed...", topicId) + fmt.Printf("Json payload to send on topic: %v larger than 500 bytes, not printed...\n", topicId) } + } else { + fmt.Printf("Json payload to send on topic: %v cannnot be decoded, err: %v\n", topicId, err) } err = q.Enqueue(string(b)) if err != nil { @@ -491,10 +499,12 @@ func sendToTopic(w http.ResponseWriter, req *http.Request) { b, err := ioutil.ReadAll(req.Body) if err == nil { if len(b) < 500 { - fmt.Printf("Text payload to send on topic: %v, msg: %v", topicId, string(b)) + fmt.Printf("Text payload to send on topic: %v, msg: %v\n", topicId, string(b)) } else { - fmt.Printf("Text payload to send on topic: %v larger than 500 bytes, not printed...", topicId) + fmt.Printf("Text payload to send on topic: %v larger than 500 bytes, not printed...\n", topicId) } + } else { + fmt.Printf("Text payload to send on topic: %v cannnot be decoded, err: %v\n", topicId, err) } err = q.Enqueue(string(b)) if err != nil { diff --git a/test/mrstub/Dockerfile b/test/mrstub/Dockerfile index 676c77ca..ac075bfd 100644 --- a/test/mrstub/Dockerfile +++ b/test/mrstub/Dockerfile @@ -1,5 +1,5 @@ # ============LICENSE_START=============================================== -# Copyright (C) 2020 Nordix Foundation. All rights reserved. +# Copyright (C) 2021 Nordix Foundation. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,4 +34,4 @@ RUN pip install -r requirements.txt RUN chmod +x start.sh -CMD [ "./start.sh" ] \ No newline at end of file +CMD [ "./start.sh" ] diff --git a/test/mrstub/app/main.py b/test/mrstub/app/main.py index 4b1913f7..dd80f3f9 100644 --- a/test/mrstub/app/main.py +++ b/test/mrstub/app/main.py @@ -164,7 +164,8 @@ def dmaap_generic_uploader(): while True: if (len(generic_messages)): - for topicname in generic_messages.keys(): #topicname contains the path of the topics, eg. "/event/" + keys_copy = list(generic_messages.keys()) + for topicname in keys_copy: #topicname contains the path of the topics, eg. "/event/" topic_queue=generic_messages[topicname] if (len(topic_queue)>0): if (topicname.endswith(".text")): diff --git a/test/simulator-group/pvc-cleaner/pvc-cleaner.yaml b/test/simulator-group/pvc-cleaner/pvc-cleaner.yaml index 35cf6ea7..91ed603a 100644 --- a/test/simulator-group/pvc-cleaner/pvc-cleaner.yaml +++ b/test/simulator-group/pvc-cleaner/pvc-cleaner.yaml @@ -11,8 +11,10 @@ spec: containers: - name: pvc-cleaner image: $PVC_CLEANER_IMAGE + securityContext: + runAsUser: 0 command: ["/bin/sh","-c"] - args: ["rm -rf $PVC_CLEANER_RM_PATH/*"] + args: ["rm -rf $PVC_CLEANER_RM_PATH/* ; if [ $? -ne 0 ]; then echo 'Delete failure: '$PVC_CLEANER_RM_PATH; else echo 'Delete OK: '$PVC_CLEANER_RM_PATH; fi"] volumeMounts: - mountPath: $PVC_CLEANER_RM_PATH name: pvc-cleaner-m-vol -- 2.16.6