blob: 01f0178892c123665846291b7f7fef0ba0e54795 [file] [log] [blame]
BjornMagnussonXA7b36db62020-11-23 10:57:57 +01001#!/bin/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
BjornMagnussonXAc963b732021-01-20 14:24:13 +010021TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persistency"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010022
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010023#App names to include in the test when running docker, space separated list
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010024DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR CP NGW"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010025
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010026#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010027KUBE_INCLUDED_IMAGES="ECS PRODSTUB CP CR KUBEPROXY NGW"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010028#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29KUBE_PRESTARTED_IMAGES=""
30
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010031#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
34CONDITIONALLY_IGNORED_IMAGES="NGW"
35
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010036#Supported test environment profiles
BjornMagnussonXA674793d2021-05-06 19:49:17 +020037SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010040
41. ../common/testcase_common.sh $@
42. ../common/ecs_api_functions.sh
43. ../common/prodstub_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010044. ../common/control_panel_api_functions.sh
45. ../common/controller_api_functions.sh
BjornMagnussonXA27db02f2021-01-19 08:13:00 +010046. ../common/cr_api_functions.sh
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010047. ../common/kube_proxy_api_functions.sh
48. ../common/gateway_api_functions.sh
49
50setup_testenvironment
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010051
52#### TEST BEGIN ####
53
54FLAT_A1_EI="1"
55
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010056clean_environment
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010057
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010058if [ $RUNMODE == "KUBE" ]; then
59 start_kube_proxy
60fi
61
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010062use_ecs_rest_http
63
64use_prod_stub_http
65
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010066start_ecs NOPROXY $SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_CONFIG_FILE
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010067
68start_prod_stub
69
70set_ecs_trace
71
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010072start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
73
74if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
75 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
76fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010077
78start_cr
79
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010080CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
81CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010082TARGET="http://localhost:80/target" # Dummy target
83
84NUM_JOBS=10000
85
86# Setup prodstub sim to accept calls for producers, types and jobs
87prodstub_arm_producer 200 prod-a
88prodstub_arm_producer 200 prod-b
89prodstub_arm_producer 200 prod-c
90prodstub_arm_producer 200 prod-d
91
92prodstub_arm_type 200 prod-a type1
93
94prodstub_arm_type 200 prod-b type1
95prodstub_arm_type 200 prod-b type2
96
97prodstub_arm_type 200 prod-c type1
98prodstub_arm_type 200 prod-c type2
99prodstub_arm_type 200 prod-c type3
100
101prodstub_arm_type 200 prod-d type4
102prodstub_arm_type 200 prod-d type5
103
104for ((i=1; i<=$NUM_JOBS; i++))
105do
106 if [ $(($i%5)) -eq 0 ]; then
107 prodstub_arm_job_create 200 prod-a job$i
108 prodstub_arm_job_create 200 prod-b job$i
109 prodstub_arm_job_create 200 prod-c job$i
110 fi
111 if [ $(($i%5)) -eq 1 ]; then
112 prodstub_arm_job_create 200 prod-b job$i
113 prodstub_arm_job_create 200 prod-c job$i
114 fi
115 if [ $(($i%5)) -eq 2 ]; then
116 prodstub_arm_job_create 200 prod-c job$i
117 fi
118 if [ $(($i%5)) -eq 3 ]; then
119 prodstub_arm_job_create 200 prod-d job$i
120 fi
121 if [ $(($i%5)) -eq 4 ]; then
122 prodstub_arm_job_create 200 prod-d job$i
123 fi
124done
125
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100126if [ $ECS_VERSION == "V1-1" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100127
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100128 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100129
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100130 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100131
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100132 ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
133
134 ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
135
136else
137
138 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
139 ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json
140 ecs_api_edp_put_type_2 201 type3 testdata/ecs/ei-type-3.json
141 ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-4.json
142 ecs_api_edp_put_type_2 201 type5 testdata/ecs/ei-type-5.json
143
144 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
145
146 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2
147
148 ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3
149
150 ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5
151fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100152
153ecs_equal json:ei-producer/v1/eiproducers 4
154
155ecs_api_edp_get_producer_status 200 prod-a ENABLED
156ecs_api_edp_get_producer_status 200 prod-b ENABLED
157ecs_api_edp_get_producer_status 200 prod-c ENABLED
158ecs_api_edp_get_producer_status 200 prod-d ENABLED
159
160for ((i=1; i<=$NUM_JOBS; i++))
161do
162 if [ $(($i%5)) -eq 0 ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100163 ecs_api_a1_put_job 201 job$i type1 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100164 if [ -z "$FLAT_A1_EI" ]; then
165 ecs_api_a1_get_job_status 200 type1 job$i ENABLED
166 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100167 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100168 fi
169 fi
170 if [ $(($i%5)) -eq 1 ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100171 ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100172 if [ -z "$FLAT_A1_EI" ]; then
173 ecs_api_a1_get_job_status 200 type2 job$i ENABLED
174 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100175 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100176 fi
177 fi
178 if [ $(($i%5)) -eq 2 ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100179 ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100180 if [ -z "$FLAT_A1_EI" ]; then
181 ecs_api_a1_get_job_status 200 type3 job$i ENABLED
182 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100183 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100184 fi
185 fi
186 if [ $(($i%5)) -eq 3 ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100187 ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100188 if [ -z "$FLAT_A1_EI" ]; then
189 ecs_api_a1_get_job_status 200 type4 job$i ENABLED
190 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100191 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100192 fi
193 fi
194 if [ $(($i%5)) -eq 4 ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100195 ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100196 if [ -z "$FLAT_A1_EI" ]; then
197 ecs_api_a1_get_job_status 200 type5 job$i ENABLED
198 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100199 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100200 fi
201 fi
202done
203
204if [ -z "$FLAT_A1_EI" ]; then
205 ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5))
206 ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5))
207 ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5))
208 ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5))
209 ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5))
210else
211 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
212 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
213 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
214 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
215 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
216fi
217
BjornMagnussonXAa69cd902021-04-22 23:46:10 +0200218stop_ecs
219
220start_stopped_ecs
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100221
222set_ecs_trace
223
224for ((i=1; i<=$NUM_JOBS; i++))
225do
226 if [ $(($i%5)) -eq 0 ]; then
227 prodstub_delete_jobdata 204 prod-a job$i
228 prodstub_delete_jobdata 204 prod-b job$i
229 prodstub_delete_jobdata 204 prod-c job$i
230 fi
231 if [ $(($i%5)) -eq 1 ]; then
232 prodstub_delete_jobdata 204 prod-b job$i
233 prodstub_delete_jobdata 204 prod-c job$i
234 fi
235 if [ $(($i%5)) -eq 2 ]; then
236 prodstub_delete_jobdata 204 prod-c job$i
237 fi
238 if [ $(($i%5)) -eq 3 ]; then
239 prodstub_delete_jobdata 204 prod-d job$i
240 fi
241 if [ $(($i%5)) -eq 4 ]; then
242 prodstub_delete_jobdata 204 prod-d job$i
243 fi
244done
245
246ecs_api_edp_get_producer_status 404 prod-a
247ecs_api_edp_get_producer_status 404 prod-b
248ecs_api_edp_get_producer_status 404 prod-c
249ecs_api_edp_get_producer_status 404 prod-d
250
251for ((i=1; i<=$NUM_JOBS; i++))
252do
253 if [ $(($i%5)) -eq 0 ]; then
254 if [ -z "$FLAT_A1_EI" ]; then
255 ecs_api_a1_get_job_status 200 type1 job$i DISABLED
256 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100257 ecs_api_a1_get_job_status 200 job$i DISABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100258 fi
259 fi
260 if [ $(($i%5)) -eq 1 ]; then
261 if [ -z "$FLAT_A1_EI" ]; then
262 ecs_api_a1_get_job_status 200 type2 job$i DISABLED
263 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100264 ecs_api_a1_get_job_status 200 job$i DISABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100265 fi
266 fi
267 if [ $(($i%5)) -eq 2 ]; then
268 if [ -z "$FLAT_A1_EI" ]; then
269 ecs_api_a1_get_job_status 200 type3 job$i DISABLED
270 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100271 ecs_api_a1_get_job_status 200 job$i DISABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100272 fi
273 fi
274 if [ $(($i%5)) -eq 3 ]; then
275 if [ -z "$FLAT_A1_EI" ]; then
276 ecs_api_a1_get_job_status 200 type4 job$i DISABLED
277 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100278 ecs_api_a1_get_job_status 200 job$i DISABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100279 fi
280 fi
281 if [ $(($i%5)) -eq 4 ]; then
282 if [ -z "$FLAT_A1_EI" ]; then
283 ecs_api_a1_get_job_status 200 type5 job$i DISABLED
284 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100285 ecs_api_a1_get_job_status 200 job$i DISABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100286 fi
287 fi
288done
289
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100290if [ $ECS_VERSION == "V1-1" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100291
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100292 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100293
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100294 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100295
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100296 ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100297
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100298 ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
299
300else
301 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
302
303 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2
304
305 ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3
306
307 ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5
308
309fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100310
311ecs_equal json:ei-producer/v1/eiproducers 4
312
313ecs_api_edp_get_producer_status 200 prod-a ENABLED
314ecs_api_edp_get_producer_status 200 prod-b ENABLED
315ecs_api_edp_get_producer_status 200 prod-c ENABLED
316ecs_api_edp_get_producer_status 200 prod-d ENABLED
317
318for ((i=1; i<=$NUM_JOBS; i++))
319do
320 if [ $(($i%5)) -eq 0 ]; then
321 if [ -z "$FLAT_A1_EI" ]; then
322 ecs_api_a1_get_job_status 200 type1 job$i ENABLED
323 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100324 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100325 fi
326 fi
327 if [ $(($i%5)) -eq 1 ]; then
328 if [ -z "$FLAT_A1_EI" ]; then
329 ecs_api_a1_get_job_status 200 type2 job$i ENABLED
330 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100331 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100332 fi
333 fi
334 if [ $(($i%5)) -eq 2 ]; then
335 if [ -z "$FLAT_A1_EI" ]; then
336 ecs_api_a1_get_job_status 200 type3 job$i ENABLED
337 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100338 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100339 fi
340 fi
341 if [ $(($i%5)) -eq 3 ]; then
342 if [ -z "$FLAT_A1_EI" ]; then
343 ecs_api_a1_get_job_status 200 type4 job$i ENABLED
344 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100345 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100346 fi
347 fi
348 if [ $(($i%5)) -eq 4 ]; then
349 if [ -z "$FLAT_A1_EI" ]; then
350 ecs_api_a1_get_job_status 200 type5 job$i ENABLED
351 else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100352 ecs_api_a1_get_job_status 200 job$i ENABLED 120
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100353 fi
354 fi
355done
356
357
358if [ -z "$FLAT_A1_EI" ]; then
359 ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5))
360 ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5))
361 ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5))
362 ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5))
363 ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5))
364else
365 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
366 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
367 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
368 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
369 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
370fi
371
372for ((i=1; i<=$NUM_JOBS; i++))
373do
374 if [ $(($i%5)) -eq 0 ]; then
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100375 if [ $ECS_VERSION == "V1-1" ]; then
376 prodstub_check_jobdata 200 prod-a job$i type1 $TARGET ric1 testdata/ecs/job-template.json
377 prodstub_check_jobdata 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json
378 prodstub_check_jobdata 200 prod-c job$i type1 $TARGET ric1 testdata/ecs/job-template.json
379 else
380 prodstub_check_jobdata_2 200 prod-a job$i type1 $TARGET ric1 testdata/ecs/job-template.json
381 prodstub_check_jobdata_2 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json
382 prodstub_check_jobdata_2 200 prod-c job$i type1 $TARGET ric1 testdata/ecs/job-template.json
383 fi
384
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100385 fi
386 if [ $(($i%5)) -eq 1 ]; then
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100387 if [ $ECS_VERSION == "V1-1" ]; then
388 prodstub_check_jobdata 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json
389 prodstub_check_jobdata 200 prod-c job$i type2 $TARGET ric1 testdata/ecs/job-template.json
390 else
391 prodstub_check_jobdata_2 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json
392 prodstub_check_jobdata_2 200 prod-c job$i type2 $TARGET ric1 testdata/ecs/job-template.json
393 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100394 fi
395 if [ $(($i%5)) -eq 2 ]; then
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100396 if [ $ECS_VERSION == "V1-1" ]; then
397 prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json
398 else
399 prodstub_check_jobdata_2 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json
400 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100401 fi
402 if [ $(($i%5)) -eq 3 ]; then
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100403 if [ $ECS_VERSION == "V1-1" ]; then
404 prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json
405 else
406 prodstub_check_jobdata_2 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json
407 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100408 fi
409 if [ $(($i%5)) -eq 4 ]; then
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100410 if [ $ECS_VERSION == "V1-1" ]; then
411 prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json
412 else
413 prodstub_check_jobdata_2 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json
414 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100415 fi
416done
417
418
419for ((i=1; i<=$NUM_JOBS; i++))
420do
421 if [ $(($i%5)) -eq 0 ]; then
422 ecs_api_a1_delete_job 204 job$i
423 fi
424 if [ $(($i%5)) -eq 1 ]; then
425 ecs_api_a1_delete_job 204 job$i
426 fi
427 if [ $(($i%5)) -eq 2 ]; then
428 ecs_api_a1_delete_job 204 job$i
429 fi
430 if [ $(($i%5)) -eq 3 ]; then
431 ecs_api_a1_delete_job 204 job$i
432 fi
433 if [ $(($i%5)) -eq 4 ]; then
434 ecs_api_a1_delete_job 204 job$i
435 fi
436done
437
438ecs_equal json:ei-producer/v1/eiproducers 4
439
440ecs_api_edp_get_producer_status 200 prod-a ENABLED
441ecs_api_edp_get_producer_status 200 prod-b ENABLED
442ecs_api_edp_get_producer_status 200 prod-c ENABLED
443ecs_api_edp_get_producer_status 200 prod-d ENABLED
444
445if [ -z "$FLAT_A1_EI" ]; then
446 ecs_equal json:A1-EI/v1/eitypes/type1/eijobs 0
447 ecs_equal json:A1-EI/v1/eitypes/type2/eijobs 0
448 ecs_equal json:A1-EI/v1/eitypes/type3/eijobs 0
449 ecs_equal json:A1-EI/v1/eitypes/type4/eijobs 0
450 ecs_equal json:A1-EI/v1/eitypes/type5/eijobs 0
451else
452 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
453 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
454 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
455 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
456 ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
457fi
458
459check_ecs_logs
460
461store_logs END
462
463#### TEST COMPLETE ####
464
465
466print_result
467
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100468auto_clean_environment