BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
| 4 | # Copyright (C) 2020 Nordix Foundation. All rights reserved. |
| 5 | # ======================================================================== |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # ============LICENSE_END================================================= |
| 18 | # |
| 19 | |
| 20 | TC_ONELINE_DESCR="App test DMAAP Meditor and DMAAP Adapter" |
| 21 | |
| 22 | #App names to include in the test when running docker, space separated list |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 23 | DOCKER_INCLUDED_IMAGES="ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 24 | |
| 25 | #App names to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 26 | KUBE_INCLUDED_IMAGES=" ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 27 | |
| 28 | #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list |
| 29 | KUBE_PRESTARTED_IMAGES="" |
| 30 | |
| 31 | #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if |
| 32 | #the image is not configured in the supplied env_file |
| 33 | #Used for images not applicable to all supported profile |
| 34 | CONDITIONALLY_IGNORED_IMAGES="" |
| 35 | |
| 36 | #Supported test environment profiles |
| 37 | SUPPORTED_PROFILES="ORAN-E-RELEASE" |
| 38 | #Supported run modes |
| 39 | SUPPORTED_RUNMODES="DOCKER KUBE" |
| 40 | |
| 41 | . ../common/testcase_common.sh $@ |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 42 | |
| 43 | setup_testenvironment |
| 44 | |
| 45 | #### TEST BEGIN #### |
| 46 | |
| 47 | #Local vars in test script |
| 48 | ########################## |
| 49 | FLAT_A1_EI="1" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 50 | NUM_CR=10 # Number of callback receivers, divide all callbacks to this number of servers - for load sharing |
| 51 | ## Note: The number jobs must be a multiple of the number of CRs in order to calculate the number of expected event in each CR |
| 52 | NUM_JOBS=200 # Mediator and adapter gets same number of jobs for every type |
| 53 | |
| 54 | if [ $NUM_JOBS -lt $NUM_CR ]; then |
| 55 | __log_conf_fail_general "Number of jobs: $NUM_JOBS must be greater then the number of CRs: $NUM_CR" |
| 56 | fi |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 57 | |
| 58 | clean_environment |
| 59 | |
| 60 | #use_cr_https |
| 61 | use_cr_http |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 62 | use_ics_rest_https |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 63 | use_mr_https |
| 64 | use_dmaapadp_https |
| 65 | use_dmaapmed_https |
| 66 | |
| 67 | start_kube_proxy |
| 68 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 69 | start_cr $NUM_CR |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 70 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 71 | start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 72 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 73 | set_ics_trace |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 74 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 75 | start_mr "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \ |
| 76 | "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs" \ |
| 77 | "unauthenticated.dmaapadp_kafka.text" "/events" "dmaapadapterproducer/msgs" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 78 | |
| 79 | start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE |
| 80 | |
| 81 | set_dmaapadp_trace |
| 82 | |
| 83 | start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE |
| 84 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 85 | ics_equal json:data-producer/v1/info-producers 2 60 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 86 | |
| 87 | # Check producers |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 88 | ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY |
| 89 | ics_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages ExampleInformationTypeKafka |
| 90 | ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 91 | |
| 92 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 93 | # Create jobs for adapter - CR stores data as MD5 hash |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 94 | start_timer "Create adapter jobs: $NUM_JOBS" |
| 95 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 96 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 97 | cr_index=$(($i%$NUM_CR)) |
| 98 | service_mr="CR_SERVICE_MR_PATH_"$cr_index |
| 99 | service_app="CR_SERVICE_APP_PATH_"$cr_index |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 100 | ics_api_idc_put_job 201 job-adp-$i ExampleInformationType ${!service_mr}/job-adp-data$i"?storeas=md5" info-owner-adp-$i ${!service_app}/job_status_info-owner-adp-$i testdata/dmaap-adapter/job-template.json |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 101 | |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 102 | done |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 103 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 104 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 105 | # Create jobs for adapter kafka - CR stores data as MD5 hash |
| 106 | start_timer "Create adapter (kafka) jobs: $NUM_JOBS" |
| 107 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 108 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 109 | cr_index=$(($i%$NUM_CR)) |
| 110 | service_text="CR_SERVICE_TEXT_PATH_"$cr_index |
| 111 | service_app="CR_SERVICE_APP_PATH_"$cr_index |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 112 | ics_api_idc_put_job 201 job-adp-kafka-$i ExampleInformationTypeKafka ${!service_text}/job-adp-kafka-data$i"?storeas=md5" info-owner-adp-kafka-$i ${!service_app}/job_status_info-owner-adp-kafka-$i testdata/dmaap-adapter/job-template-1-kafka.json |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 113 | |
| 114 | done |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 115 | print_timer |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 116 | |
| 117 | # Create jobs for mediator - CR stores data as MD5 hash |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 118 | start_timer "Create mediator jobs: $NUM_JOBS" |
| 119 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 120 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 121 | cr_index=$(($i%$NUM_CR)) |
| 122 | service_mr="CR_SERVICE_MR_PATH_"$cr_index |
| 123 | service_app="CR_SERVICE_APP_PATH_"$cr_index |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 124 | ics_api_idc_put_job 201 job-med-$i STD_Fault_Messages ${!service_mr}/job-med-data$i"?storeas=md5" info-owner-med-$i ${!service_app}/job_status_info-owner-med-$i testdata/dmaap-adapter/job-template.json |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 125 | done |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 126 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 127 | |
| 128 | # Check job status |
| 129 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 130 | do |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 131 | ics_api_a1_get_job_status 200 job-med-$i ENABLED 30 |
| 132 | ics_api_a1_get_job_status 200 job-adp-$i ENABLED 30 |
| 133 | ics_api_a1_get_job_status 200 job-adp-kafka-$i ENABLED 30 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 134 | done |
| 135 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 136 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 137 | EXPECTED_DATA_DELIV=0 #Total delivered msg per CR |
| 138 | DATA_DELIV_JOBS=0 #Total delivered msg per job per CR |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 139 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 140 | mr_api_generate_json_payload_file 1 ./tmp/data_for_dmaap_test.json |
| 141 | mr_api_generate_text_payload_file 1 ./tmp/data_for_dmaap_test.txt |
| 142 | |
| 143 | ## Send json file via message-router to adapter |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 144 | DATA_DELIV_JOBS=5 #Each job will eventuall get 2 msgs |
| 145 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 146 | mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 147 | for ((i=0; i<$NUM_CR; i++)) |
| 148 | do |
| 149 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 150 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 151 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 152 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 153 | mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 154 | for ((i=0; i<$NUM_CR; i++)) |
| 155 | do |
| 156 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 157 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 158 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 159 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 160 | mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 161 | for ((i=0; i<$NUM_CR; i++)) |
| 162 | do |
| 163 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 164 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 165 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 166 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 167 | mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 168 | for ((i=0; i<$NUM_CR; i++)) |
| 169 | do |
| 170 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 171 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 172 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 173 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 174 | mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 175 | for ((i=0; i<$NUM_CR; i++)) |
| 176 | do |
| 177 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 178 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 179 | |
| 180 | # Check received data callbacks from adapter |
| 181 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 182 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 183 | cr_index=$(($i%$NUM_CR)) |
| 184 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json |
| 185 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json |
| 186 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json |
| 187 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json |
| 188 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 189 | done |
| 190 | |
| 191 | |
| 192 | ## Send text file via message-router to adapter kafka |
| 193 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 194 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 195 | mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 196 | for ((i=0; i<$NUM_CR; i++)) |
| 197 | do |
| 198 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 199 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 200 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 201 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 202 | mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 203 | for ((i=0; i<$NUM_CR; i++)) |
| 204 | do |
| 205 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 206 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 207 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 208 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 209 | mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 210 | for ((i=0; i<$NUM_CR; i++)) |
| 211 | do |
| 212 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 213 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 214 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 215 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 216 | mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 217 | for ((i=0; i<$NUM_CR; i++)) |
| 218 | do |
| 219 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 220 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 221 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 222 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 223 | mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 224 | for ((i=0; i<$NUM_CR; i++)) |
| 225 | do |
| 226 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 227 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 228 | |
| 229 | # Check received data callbacks from adapter kafka |
| 230 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 231 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 232 | cr_index=$(($i%$NUM_CR)) |
| 233 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt |
| 234 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt |
| 235 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt |
| 236 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt |
| 237 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 238 | done |
| 239 | |
| 240 | ## Send json file via message-router to mediator |
| 241 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 242 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 243 | mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 244 | for ((i=0; i<$NUM_CR; i++)) |
| 245 | do |
| 246 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 247 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 248 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 249 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 250 | mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 251 | for ((i=0; i<$NUM_CR; i++)) |
| 252 | do |
| 253 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 254 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 255 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 256 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 257 | mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 258 | for ((i=0; i<$NUM_CR; i++)) |
| 259 | do |
| 260 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 261 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 262 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 263 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 264 | mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 265 | for ((i=0; i<$NUM_CR; i++)) |
| 266 | do |
| 267 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 268 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 269 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 270 | EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 271 | mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 272 | for ((i=0; i<$NUM_CR; i++)) |
| 273 | do |
| 274 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 275 | done |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 276 | |
| 277 | # Check received data callbacks from mediator |
| 278 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 279 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 280 | cr_index=$(($i%$NUM_CR)) |
| 281 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json |
| 282 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json |
| 283 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json |
| 284 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json |
| 285 | cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 286 | done |
| 287 | |
| 288 | |
| 289 | # Send small json via message-router to adapter |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 290 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}' |
| 291 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}' |
| 292 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 293 | DATA_DELIV_JOBS=7 #Each job will eventuall get 5+2 msgs |
| 294 | |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 295 | # Wait for data recetption, adapter |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 296 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 297 | start_timer "Data delivery adapter, 2 json per job" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 298 | for ((i=0; i<$NUM_CR; i++)) |
| 299 | do |
| 300 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 301 | done |
| 302 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 303 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 304 | # Send small text via message-routere to adapter |
| 305 | mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------1' |
| 306 | mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------3' |
| 307 | |
| 308 | # Wait for data recetption, adapter kafka |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 309 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
| 310 | start_timer "Data delivery adapter kafka, 2 strings per job" |
| 311 | for ((i=0; i<$NUM_CR; i++)) |
| 312 | do |
| 313 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60 |
| 314 | done |
| 315 | print_timer |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 316 | |
| 317 | # Send small json via message-router to mediator |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 318 | mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}' |
| 319 | mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}' |
| 320 | |
| 321 | # Wait for data reception, mediator |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 322 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 323 | start_timer "Data delivery mediator, 2 json per job" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 324 | for ((i=0; i<$NUM_CR; i++)) |
| 325 | do |
| 326 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100 |
| 327 | done |
| 328 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 329 | |
| 330 | # Check received number of messages for mediator and adapter callbacks |
| 331 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 332 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 333 | cr_index=$(($i%$NUM_CR)) |
| 334 | cr_equal $cr_index received_callbacks?id=job-med-data$i $DATA_DELIV_JOBS |
| 335 | cr_equal $cr_index received_callbacks?id=job-adp-data$i $DATA_DELIV_JOBS |
| 336 | cr_equal $cr_index received_callbacks?id=job-adp-kafka-data$i $DATA_DELIV_JOBS |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 337 | done |
| 338 | |
| 339 | # Check received data and order for mediator and adapter callbacks |
| 340 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 341 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 342 | cr_index=$(($i%$NUM_CR)) |
| 343 | cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-0"}' |
| 344 | cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-2"}' |
| 345 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-1"}' |
| 346 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-3"}' |
| 347 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------1' |
| 348 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------3' |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 349 | done |
| 350 | |
| 351 | # Set delay in the callback receiver to slow down callbacks |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 352 | SEC_DELAY=2 |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 353 | for ((i=0; i<$NUM_CR; i++)) |
| 354 | do |
| 355 | cr_delay_callback 200 $i $SEC_DELAY |
| 356 | done |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 357 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 358 | # Send small json via message-router to adapter |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 359 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-5"}' |
| 360 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-7"}' |
| 361 | |
| 362 | # Wait for data recetption, adapter |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 363 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 364 | start_timer "Data delivery adapter with $SEC_DELAY seconds delay in consumer, 2 json per job" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 365 | for ((i=0; i<$NUM_CR; i++)) |
| 366 | do |
| 367 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100 |
| 368 | done |
| 369 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 370 | |
| 371 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 372 | # Send small text via message-router to adapter kafka |
| 373 | mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------5' |
| 374 | mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------7' |
| 375 | |
| 376 | # Wait for data recetption, adapter kafka |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 377 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 378 | start_timer "Data delivery adapter kafka with $SEC_DELAY seconds delay in consumer, 2 strings per job" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 379 | for ((i=0; i<$NUM_CR; i++)) |
| 380 | do |
| 381 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100 |
| 382 | done |
| 383 | print_timer |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 384 | |
| 385 | |
| 386 | # Send small json via message-router to mediator |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 387 | mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-4"}' |
| 388 | mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-6"}' |
| 389 | |
| 390 | # Wait for data reception, mediator |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 391 | EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV)) |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 392 | start_timer "Data delivery mediator with $SEC_DELAY seconds delay in consumer, 2 json per job" |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 393 | for ((i=0; i<$NUM_CR; i++)) |
| 394 | do |
| 395 | cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100 |
| 396 | done |
| 397 | print_timer |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 398 | |
| 399 | # Check received number of messages for mediator and adapter callbacks |
| 400 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 401 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 402 | cr_index=$(($i%$NUM_CR)) |
| 403 | cr_equal $cr_index received_callbacks?id=job-med-data$i 9 |
| 404 | cr_equal $cr_index received_callbacks?id=job-adp-data$i 9 |
| 405 | cr_equal $cr_index received_callbacks?id=job-adp-kafka-data$i 9 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 406 | done |
| 407 | |
| 408 | # Check received data and order for mediator and adapter callbacks |
| 409 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 410 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 411 | cr_index=$(($i%$NUM_CR)) |
| 412 | cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-4"}' |
| 413 | cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-6"}' |
| 414 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-5"}' |
| 415 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-7"}' |
| 416 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------5' |
| 417 | cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------7' |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 418 | done |
| 419 | |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 420 | #### TEST COMPLETE #### |
| 421 | |
| 422 | store_logs END |
| 423 | |
| 424 | print_result |
| 425 | |
BjornMagnussonXA | 6fc58fd | 2021-11-18 08:19:45 +0100 | [diff] [blame] | 426 | auto_clean_environment |