blob: fe59d45b27b606bcedb88a56e0cda9ff04728563 [file] [log] [blame]
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001#!/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 full interfaces walkthrough"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020022
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010023#App names to include in the test when running docker, space separated list
BjornMagnussonXAc963b732021-01-20 14:24:13 +010024DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP HTTPPROXY"
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
BjornMagnussonXAc963b732021-01-20 14:24:13 +010027KUBE_INCLUDED_IMAGES=" PRODSTUB CR ECS RICSIM CP HTTPPROXY"
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
31#Supported test environment profiles
BjornMagnussonXA89b64ab2020-12-16 09:21:01 +010032SUPPORTED_PROFILES="ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010033#Supported run modes
34SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020035
36. ../common/testcase_common.sh $@
37. ../common/ecs_api_functions.sh
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020038. ../common/prodstub_api_functions.sh
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010039. ../common/cr_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010040. ../common/control_panel_api_functions.sh
41. ../common/controller_api_functions.sh
42. ../common/ricsimulator_api_functions.sh
BjornMagnussonXAc963b732021-01-20 14:24:13 +010043. ../common/http_proxy_api_functions.sh
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020044
45#### TEST BEGIN ####
46
BjornMagnussonXA4207b832020-11-03 09:52:49 +010047FLAT_A1_EI="1"
48
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010049clean_environment
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020050
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010051use_ecs_rest_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020052
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010053use_prod_stub_https
54
55use_simulator_https
56
57use_cr_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020058
BjornMagnussonXAc963b732021-01-20 14:24:13 +010059#start_http_proxy #Uncomment this cmd to run with proxy
60
61start_ecs NOPROXY $SIM_GROUP/$ECS_COMPOSE_DIR/application.yaml #Change NOPROXY to PROXY to run with http proxy
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010062
63if [ $RUNMODE == "KUBE" ]; then
64 ecs_api_admin_reset
65fi
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020066
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020067start_prod_stub
68
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020069set_ecs_trace
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020070
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010071start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010072
73if [ "$PMS_VERSION" == "V2" ]; then
74 start_ric_simulators ricsim_g3 4 STD_2.0.0
75fi
76
77start_cr
78
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010079CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
80CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010081TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
82TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
83TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery"
84TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
85TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
86
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010087STATUS1="$CR_SERVICE_PATH/job1-status"
88STATUS2="$CR_SERVICE_PATH/job2-status"
89STATUS3="$CR_SERVICE_PATH/job3-status"
90STATUS8="$CR_SERVICE_PATH/job8-status"
91STATUS10="$CR_SERVICE_PATH/job10-status"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010092
93### Setup prodstub sim to accept calls for producers, types and jobs
94## prod-a type1
95## prod-b type1 and type2
96## prod-c no-type
97## prod-d type4
98## prod-e type6
99## prod-f type6
100
101## job1 -> prod-a
102## job2 -> prod-a
103## job3 -> prod-b
104## job4 -> prod-a
105## job6 -> prod-b
106## job8 -> prod-d
107## job10 -> prod-e and prod-f
108
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200109prodstub_arm_producer 200 prod-a
110prodstub_arm_producer 200 prod-b
111prodstub_arm_producer 200 prod-c
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200112prodstub_arm_producer 200 prod-d
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100113prodstub_arm_producer 200 prod-e
114prodstub_arm_producer 200 prod-f
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200115
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200116prodstub_arm_type 200 prod-a type1
117prodstub_arm_type 200 prod-b type2
118prodstub_arm_type 200 prod-b type3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100119prodstub_arm_type 200 prod-d type4
120prodstub_arm_type 200 prod-e type6
121prodstub_arm_type 200 prod-f type6
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200122
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200123prodstub_disarm_type 200 prod-b type3
124prodstub_arm_type 200 prod-b type1
125prodstub_disarm_type 200 prod-b type1
126
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100127
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200128prodstub_arm_job_create 200 prod-a job1
129prodstub_arm_job_create 200 prod-a job2
130prodstub_arm_job_create 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200131
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200132prodstub_arm_job_delete 200 prod-a job1
133prodstub_arm_job_delete 200 prod-a job2
134prodstub_arm_job_delete 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200135
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200136prodstub_arm_job_create 200 prod-b job4
137prodstub_arm_job_create 200 prod-a job4
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200138
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200139prodstub_arm_job_create 200 prod-b job6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200140
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100141prodstub_arm_job_create 200 prod-d job8
142
143prodstub_arm_job_create 200 prod-e job10
144prodstub_arm_job_create 200 prod-f job10
145
146### ecs status
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200147ecs_api_service_status 200
148
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100149cr_equal received_callbacks 0
150
151### Initial tests - no config made
152### GET: type ids, types, producer ids, producers, job ids, jobs
153### DELETE: jobs
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200154ecs_api_a1_get_type_ids 200 EMPTY
155ecs_api_a1_get_type 404 test-type
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200156
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200157ecs_api_edp_get_type_ids 200 EMPTY
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100158if [ $ECS_VERSION == "V1-1" ]; then
159 ecs_api_edp_get_type 404 test-type
160else
161 ecs_api_edp_get_type_2 404 test-type
162fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200163
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100164if [ $ECS_VERSION == "V1-1" ]; then
165 ecs_api_edp_get_producer_ids 200 EMPTY
166 ecs_api_edp_get_producer 404 test-prod
167else
168 ecs_api_edp_get_producer_ids_2 200 NOTYPE EMPTY
169 ecs_api_edp_get_producer_2 404 test-prod
170fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200171ecs_api_edp_get_producer_status 404 test-prod
172
173ecs_api_edp_delete_producer 404 test-prod
174
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100175if [ -z "$FLAT_A1_EI" ]; then
176 ecs_api_a1_get_job_ids 404 test-type NOWNER
177 ecs_api_a1_get_job_ids 404 test-type test-owner
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200178
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100179 ecs_api_a1_get_job 404 test-type test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200180
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100181 ecs_api_a1_get_job_status 404 test-type test-job
182else
183 ecs_api_a1_get_job_ids 200 test-type NOWNER EMPTY
184 ecs_api_a1_get_job_ids 200 test-type test-owner EMPTY
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200185
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100186 ecs_api_a1_get_job 404 test-job
187
188 ecs_api_a1_get_job_status 404 test-job
189fi
190
191if [ -z "$FLAT_A1_EI" ]; then
192 ecs_api_a1_delete_job 404 test-type test-job
193else
194 ecs_api_a1_delete_job 404 test-job
195fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200196
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100197if [ $ECS_VERSION == "V1-1" ]; then
198 ecs_api_edp_get_producer_jobs 404 test-prod
199else
200 ecs_api_edp_get_producer_jobs_2 404 test-prod
201fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200202
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100203if [ $ECS_VERSION == "V1-2" ]; then
204 ecs_api_edp_get_type_2 404 test-type
205 ecs_api_edp_delete_type_2 404 test-type
206fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200207
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100208### Setup of producer/job and testing apis ###
209
210## Setup prod-a
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100211if [ $ECS_VERSION == "V1-1" ]; then
212 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
213 ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
214else
215 #V1-2
216 ecs_api_edp_get_type_ids 200 EMPTY
217 ecs_api_edp_get_type_2 404 type1
218 ecs_api_edp_put_producer_2 404 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
219
220 # Create type, delete and create again
221 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
222 ecs_api_edp_get_type_2 200 type1
223 ecs_api_edp_get_type_ids 200 type1
224 ecs_api_edp_delete_type_2 204 type1
225 ecs_api_edp_get_type_2 404 type1
226 ecs_api_edp_get_type_ids 200 EMPTY
227 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
228 ecs_api_edp_get_type_ids 200 type1
229 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
230
231 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
232 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
233
234 ecs_api_edp_delete_type_2 406 type1
235fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100236
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200237
238ecs_api_a1_get_type_ids 200 type1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100239if [ -z "$FLAT_A1_EI" ]; then
240 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
241else
242 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
243fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200244
245ecs_api_edp_get_type_ids 200 type1
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100246if [ $ECS_VERSION == "V1-1" ]; then
247 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
248else
249 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
250fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200251
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100252if [ $ECS_VERSION == "V1-1" ]; then
253 ecs_api_edp_get_producer_ids 200 prod-a
254else
255 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a
256 ecs_api_edp_get_producer_ids_2 200 type1 prod-a
257 ecs_api_edp_get_producer_ids_2 200 type2 EMPTY
258fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100259
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100260if [ $ECS_VERSION == "V1-1" ]; then
261 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
262else
263 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
264fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200265
266ecs_api_edp_get_producer_status 200 prod-a ENABLED
267
268ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
269ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
270
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100271if [ -z "$FLAT_A1_EI" ]; then
272 ecs_api_a1_get_job 404 type1 test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200273
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100274 ecs_api_a1_get_job_status 404 type1 test-job
275else
276 ecs_api_a1_get_job 404 test-job
277
278 ecs_api_a1_get_job_status 404 test-job
279fi
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100280if [ $ECS_VERSION == "V1-1" ]; then
281 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
282else
283 ecs_api_edp_get_producer_jobs_2 200 prod-a EMPTY
284fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200285
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100286## Create a job for prod-a
287## job1 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100288if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100289 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100290else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100291 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100292fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200293
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100294# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100295if [ $ECS_VERSION == "V1-1" ]; then
296 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
297else
298 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
299fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200300
301ecs_api_a1_get_job_ids 200 type1 NOWNER job1
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100302ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
303
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100304if [ ! -z "$FLAT_A1_EI" ]; then
305 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
306fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200307
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100308if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100309 ecs_api_a1_get_job 200 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200310
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100311 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
312else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100313 ecs_api_a1_get_job 200 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100314
315 ecs_api_a1_get_job_status 200 job1 ENABLED
316fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200317
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100318prodstub_equal create/prod-a/job1 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200319
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100320if [ $ECS_VERSION == "V1-1" ]; then
321 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
322else
323 ecs_api_edp_get_producer_jobs_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
324fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200325
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100326## Create a second job for prod-a
327## job2 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100328if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100329 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100330else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100331 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100332fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200333
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100334# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100335if [ $ECS_VERSION == "V1-1" ]; then
336 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
337else
338 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
339fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200340ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100341ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
342ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100343if [ ! -z "$FLAT_A1_EI" ]; then
344 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
345fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200346
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100347if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100348 ecs_api_a1_get_job 200 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200349
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100350 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
351else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100352 ecs_api_a1_get_job 200 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100353
354 ecs_api_a1_get_job_status 200 job2 ENABLED
355fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200356
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100357prodstub_equal create/prod-a/job2 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200358
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100359if [ $ECS_VERSION == "V1-1" ]; then
360 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
361else
362 ecs_api_edp_get_producer_jobs_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
363fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200364
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100365## Setup prod-b
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100366if [ $ECS_VERSION == "V1-1" ]; then
367 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
368else
369 ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json
370 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
371fi
372
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200373
374ecs_api_a1_get_type_ids 200 type1 type2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100375if [ -z "$FLAT_A1_EI" ]; then
376 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
377 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
378else
379 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
380 ecs_api_a1_get_type 200 type2 testdata/ecs/empty-type.json
381fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200382
383ecs_api_edp_get_type_ids 200 type1 type2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100384if [ $ECS_VERSION == "V1-1" ]; then
385 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
386 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
387else
388 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
389 ecs_api_edp_get_type_2 200 type2 testdata/ecs/ei-type-2.json
390fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200391
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100392if [ $ECS_VERSION == "V1-1" ]; then
393 ecs_api_edp_get_producer_ids 200 prod-a prod-b
394else
395 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b
396fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100397
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100398if [ $ECS_VERSION == "V1-1" ]; then
399 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
400 ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
401else
402 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
403 ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
404fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200405
406ecs_api_edp_get_producer_status 200 prod-b ENABLED
407
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100408## Create job for prod-b
409## job3 - prod-b
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100410if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100411 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100412else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100413 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100414fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200415
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100416prodstub_equal create/prod-b/job3 1
417
418# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100419if [ $ECS_VERSION == "V1-1" ]; then
420 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
421else
422 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
423fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200424
425ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
426ecs_api_a1_get_job_ids 200 type2 NOWNER job3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100427ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
428ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
429ecs_api_a1_get_job_ids 200 type2 ricsim_g3_3 job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200430
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100431if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100432 ecs_api_a1_get_job 200 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200433
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100434 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
435else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100436 ecs_api_a1_get_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100437
438 ecs_api_a1_get_job_status 200 job3 ENABLED
439fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200440
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100441if [ $ECS_VERSION == "V1-1" ]; then
442 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
443 ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
444else
445 ecs_api_edp_get_producer_jobs_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
446 ecs_api_edp_get_producer_jobs_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
447fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200448
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100449## Setup prod-c (no types)
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100450if [ $ECS_VERSION == "V1-1" ]; then
451 ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
452else
453 ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
454fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100455
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100456if [ $ECS_VERSION == "V1-1" ]; then
457 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
458else
459 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
460fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200461
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100462if [ $ECS_VERSION == "V1-1" ]; then
463 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
464 ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
465 ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
466else
467 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
468 ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
469 ecs_api_edp_get_producer_2 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
470fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200471
472ecs_api_edp_get_producer_status 200 prod-c ENABLED
473
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100474
475## Delete job3 and prod-b and re-create if different order
476
477# Delete job then producer
478ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100479if [ $ECS_VERSION == "V1-1" ]; then
480 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
481else
482 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
483fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100484
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100485if [ -z "$FLAT_A1_EI" ]; then
486 ecs_api_a1_delete_job 204 type2 job3
487else
488 ecs_api_a1_delete_job 204 job3
489fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200490
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100491ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100492if [ $ECS_VERSION == "V1-1" ]; then
493 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
494else
495 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
496fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100497
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200498ecs_api_edp_delete_producer 204 prod-b
499
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100500ecs_api_edp_get_producer_status 404 prod-b
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200501
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100502ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100503if [ $ECS_VERSION == "V1-1" ]; then
504 ecs_api_edp_get_producer_ids 200 prod-a prod-c
505else
506 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
507fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200508
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100509prodstub_equal delete/prod-b/job3 1
510
511if [ -z "$FLAT_A1_EI" ]; then
512 ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
513else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100514 if [ $ECS_VERSION == "V1-1" ]; then
515 ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
516 else
517 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
518 ecs_api_a1_get_job_status 200 job3 DISABLED
519 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100520fi
521
522# Put producer then job
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100523if [ $ECS_VERSION == "V1-1" ]; then
524 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
525else
526 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
527fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100528
529ecs_api_edp_get_producer_status 200 prod-b ENABLED
530
531if [ -z "$FLAT_A1_EI" ]; then
532 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
533 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
534else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100535 if [ $ECS_VERSION == "V1-1" ]; then
536 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
537 else
538 ecs_api_a1_put_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
539 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100540 ecs_api_a1_get_job_status 200 job3 ENABLED
541fi
542
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100543if [ $ECS_VERSION == "V1-1" ]; then
544 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
545else
546 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
547fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100548
549ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100550if [ $ECS_VERSION == "V1-1" ]; then
551 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
552else
553 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
554fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100555
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100556if [ $ECS_VERSION == "V1-1" ]; then
557 prodstub_equal create/prod-b/job3 2
558else
559 prodstub_equal create/prod-b/job3 3
560fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100561prodstub_equal delete/prod-b/job3 1
562
563# Delete only the producer
564ecs_api_edp_delete_producer 204 prod-b
565
566ecs_api_edp_get_producer_status 404 prod-b
567
568ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100569if [ $ECS_VERSION == "V1-1" ]; then
570 ecs_api_edp_get_producer_ids 200 prod-a prod-c
571else
572 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
573fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100574
575if [ -z "$FLAT_A1_EI" ]; then
576 ecs_api_a1_get_job_status 200 type2 job3 DISABLED
577else
578 ecs_api_a1_get_job_status 200 job3 DISABLED
579fi
580
581cr_equal received_callbacks 1 30
582cr_equal received_callbacks?id=job3-status 1
583cr_api_check_all_ecs_events 200 job3-status DISABLED
584
585# Re-create the producer
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100586if [ $ECS_VERSION == "V1-1" ]; then
587 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
588else
589 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
590fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100591
592ecs_api_edp_get_producer_status 200 prod-b ENABLED
593
594if [ -z "$FLAT_A1_EI" ]; then
595 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
596else
597 ecs_api_a1_get_job_status 200 job3 ENABLED
598fi
599
600cr_equal received_callbacks 2 30
601cr_equal received_callbacks?id=job3-status 2
602cr_api_check_all_ecs_events 200 job3-status ENABLED
603
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100604if [ $ECS_VERSION == "V1-1" ]; then
605 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
606else
607 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
608fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100609
610## Setup prod-d
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100611if [ $ECS_VERSION == "V1-1" ]; then
612 ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
613else
614 ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-1.json
615 ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
616fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200617
618ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
619
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100620if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100621 ecs_api_a1_put_job 201 type4 job8 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100622else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100623 ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100624fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100625
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100626if [ $ECS_VERSION == "V1-1" ]; then
627 prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
628else
629 prodstub_check_jobdata_2 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
630fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100631
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200632prodstub_equal create/prod-d/job8 1
633prodstub_equal delete/prod-d/job8 0
634
635ecs_api_a1_get_job_ids 200 type4 NOWNER job8
636
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100637if [ -z "$FLAT_A1_EI" ]; then
638 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
639else
640 ecs_api_a1_get_job_status 200 job8 ENABLED
641fi
642
643# Re-PUT the producer with zero types
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100644if [ $ECS_VERSION == "V1-1" ]; then
645 ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
646else
647 ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
648fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200649
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100650if [ -z "$FLAT_A1_EI" ]; then
651 ecs_api_a1_get_job_ids 404 type4 NOWNER
652else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100653 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
654 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100655fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200656
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100657if [ -z "$FLAT_A1_EI" ]; then
658 ecs_api_a1_get_job_status 200 type4 job8 DISABLED
659else
660 ecs_api_a1_get_job_status 200 job8 DISABLED
661fi
662
663cr_equal received_callbacks 3 30
664cr_equal received_callbacks?id=job8-status 1
665cr_api_check_all_ecs_events 200 job8-status DISABLED
666
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200667prodstub_equal create/prod-d/job8 1
668prodstub_equal delete/prod-d/job8 0
669
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100670## Re-setup prod-d
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100671if [ $ECS_VERSION == "V1-1" ]; then
672 ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
673else
674 ecs_api_edp_put_type_2 200 type4 testdata/ecs/ei-type-4.json
675 ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
676fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100677
678if [ -z "$FLAT_A1_EI" ]; then
679 ecs_api_a1_get_job_ids 404 type4 NOWNER
680else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100681 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
682 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100683fi
684
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100685if [ -z "$FLAT_A1_EI" ]; then
686 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
687else
688 ecs_api_a1_get_job_status 200 job8 ENABLED
689fi
690
691ecs_api_edp_get_producer_status 200 prod-a ENABLED
692ecs_api_edp_get_producer_status 200 prod-b ENABLED
693ecs_api_edp_get_producer_status 200 prod-c ENABLED
694ecs_api_edp_get_producer_status 200 prod-d ENABLED
695
696cr_equal received_callbacks 4 30
697cr_equal received_callbacks?id=job8-status 2
698cr_api_check_all_ecs_events 200 job8-status ENABLED
699
700prodstub_equal create/prod-d/job8 2
701prodstub_equal delete/prod-d/job8 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100702
703
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100704## Setup prod-e
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100705if [ $ECS_VERSION == "V1-1" ]; then
706 ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
707else
708 ecs_api_edp_put_type_2 201 type6 testdata/ecs/ei-type-6.json
709 ecs_api_edp_put_producer_2 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6
710fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100711
712ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY
713
714if [ -z "$FLAT_A1_EI" ]; then
715 ecs_api_a1_put_job 201 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
716else
717 ecs_api_a1_put_job 201 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template.json
718fi
719
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100720if [ $ECS_VERSION == "V1-1" ]; then
721 prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
722else
723 prodstub_check_jobdata_2 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
724fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100725
726prodstub_equal create/prod-e/job10 1
727prodstub_equal delete/prod-e/job10 0
728
729ecs_api_a1_get_job_ids 200 type6 NOWNER job10
730
731if [ -z "$FLAT_A1_EI" ]; then
732 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
733else
734 ecs_api_a1_get_job_status 200 job10 ENABLED
735fi
736
737## Setup prod-f
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100738if [ $ECS_VERSION == "V1-1" ]; then
739 ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
740else
741 ecs_api_edp_put_type_2 200 type6 testdata/ecs/ei-type-6.json
742 ecs_api_edp_put_producer_2 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6
743fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100744
745ecs_api_a1_get_job_ids 200 type6 NOWNER job10
746
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100747if [ $ECS_VERSION == "V1-1" ]; then
748 prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
749else
750 prodstub_check_jobdata_2 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
751fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100752
753prodstub_equal create/prod-f/job10 1
754prodstub_equal delete/prod-f/job10 0
755
756ecs_api_a1_get_job_ids 200 type6 NOWNER job10
757
758if [ -z "$FLAT_A1_EI" ]; then
759 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
760else
761 ecs_api_a1_get_job_status 200 job10 ENABLED
762fi
763
764## Status updates prod-a and jobs
765
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100766if [ $ECS_VERSION == "V1-1" ]; then
767 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
768else
769 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
770fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100771
772ecs_api_edp_get_producer_status 200 prod-a ENABLED
773ecs_api_edp_get_producer_status 200 prod-b ENABLED
774ecs_api_edp_get_producer_status 200 prod-c ENABLED
775ecs_api_edp_get_producer_status 200 prod-d ENABLED
776ecs_api_edp_get_producer_status 200 prod-e ENABLED
777ecs_api_edp_get_producer_status 200 prod-f ENABLED
778
779# Arm producer prod-a for supervision failure
780prodstub_arm_producer 200 prod-a 400
781
782# Wait for producer prod-a to go disabled
783ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
784
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100785if [ $ECS_VERSION == "V1-1" ]; then
786 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
787else
788 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
789fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100790
791ecs_api_edp_get_producer_status 200 prod-a DISABLED
792ecs_api_edp_get_producer_status 200 prod-b ENABLED
793ecs_api_edp_get_producer_status 200 prod-c ENABLED
794ecs_api_edp_get_producer_status 200 prod-d ENABLED
795ecs_api_edp_get_producer_status 200 prod-e ENABLED
796ecs_api_edp_get_producer_status 200 prod-f ENABLED
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100797
798
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100799if [ -z "$FLAT_A1_EI" ]; then
800 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
801 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
802 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
803 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
804 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
805else
806 ecs_api_a1_get_job_status 200 job1 ENABLED
807 ecs_api_a1_get_job_status 200 job2 ENABLED
808 ecs_api_a1_get_job_status 200 job3 ENABLED
809 ecs_api_a1_get_job_status 200 job8 ENABLED
810 ecs_api_a1_get_job_status 200 job10 ENABLED
811fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100812
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100813# Arm producer prod-a for supervision
814prodstub_arm_producer 200 prod-a 200
815
816# Wait for producer prod-a to go enabled
817ecs_api_edp_get_producer_status 200 prod-a ENABLED 360
818
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100819if [ $ECS_VERSION == "V1-1" ]; then
820 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
821else
822 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
823fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100824
825ecs_api_edp_get_producer_status 200 prod-a ENABLED
826ecs_api_edp_get_producer_status 200 prod-b ENABLED
827ecs_api_edp_get_producer_status 200 prod-c ENABLED
828ecs_api_edp_get_producer_status 200 prod-d ENABLED
829ecs_api_edp_get_producer_status 200 prod-e ENABLED
830ecs_api_edp_get_producer_status 200 prod-f ENABLED
831
832if [ -z "$FLAT_A1_EI" ]; then
833 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
834 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
835 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
836 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
837 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
838else
839 ecs_api_a1_get_job_status 200 job1 ENABLED
840 ecs_api_a1_get_job_status 200 job2 ENABLED
841 ecs_api_a1_get_job_status 200 job3 ENABLED
842 ecs_api_a1_get_job_status 200 job8 ENABLED
843 ecs_api_a1_get_job_status 200 job10 ENABLED
844fi
845
846# Arm producer prod-a for supervision failure
847prodstub_arm_producer 200 prod-a 400
848
849# Wait for producer prod-a to go disabled
850ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
851
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100852if [ $ECS_VERSION == "V1-1" ]; then
853 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
854else
855 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
856fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100857
858ecs_api_edp_get_producer_status 200 prod-a DISABLED
859ecs_api_edp_get_producer_status 200 prod-b ENABLED
860ecs_api_edp_get_producer_status 200 prod-c ENABLED
861ecs_api_edp_get_producer_status 200 prod-d ENABLED
862ecs_api_edp_get_producer_status 200 prod-e ENABLED
863ecs_api_edp_get_producer_status 200 prod-f ENABLED
864
865if [ -z "$FLAT_A1_EI" ]; then
866 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
867 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
868 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
869 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
870 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
871else
872 ecs_api_a1_get_job_status 200 job1 ENABLED
873 ecs_api_a1_get_job_status 200 job2 ENABLED
874 ecs_api_a1_get_job_status 200 job3 ENABLED
875 ecs_api_a1_get_job_status 200 job8 ENABLED
876 ecs_api_a1_get_job_status 200 job10 ENABLED
877fi
878
879# Wait for producer prod-a to be removed
880ecs_equal json:ei-producer/v1/eiproducers 5 1000
881
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100882if [ $ECS_VERSION == "V1-1" ]; then
883 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
884else
885 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
886fi
887
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100888
889ecs_api_edp_get_producer_status 404 prod-a
890ecs_api_edp_get_producer_status 200 prod-b ENABLED
891ecs_api_edp_get_producer_status 200 prod-c ENABLED
892ecs_api_edp_get_producer_status 200 prod-d ENABLED
893ecs_api_edp_get_producer_status 200 prod-e ENABLED
894ecs_api_edp_get_producer_status 200 prod-f ENABLED
895
896if [ -z "$FLAT_A1_EI" ]; then
897 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
898 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
899 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
900 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
901 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
902else
903 ecs_api_a1_get_job_status 200 job1 DISABLED
904 ecs_api_a1_get_job_status 200 job2 DISABLED
905 ecs_api_a1_get_job_status 200 job3 ENABLED
906 ecs_api_a1_get_job_status 200 job8 ENABLED
907 ecs_api_a1_get_job_status 200 job10 ENABLED
908fi
909
910cr_equal received_callbacks 6 30
911cr_equal received_callbacks?id=job1-status 1
912cr_equal received_callbacks?id=job2-status 1
913
914cr_api_check_all_ecs_events 200 job1-status DISABLED
915cr_api_check_all_ecs_events 200 job2-status DISABLED
916
917
918# Arm producer prod-e for supervision failure
919prodstub_arm_producer 200 prod-e 400
920
921ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000
922
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100923if [ $ECS_VERSION == "V1-1" ]; then
924 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
925else
926 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
927fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100928
929ecs_api_edp_get_producer_status 404 prod-a
930ecs_api_edp_get_producer_status 200 prod-b ENABLED
931ecs_api_edp_get_producer_status 200 prod-c ENABLED
932ecs_api_edp_get_producer_status 200 prod-d ENABLED
933ecs_api_edp_get_producer_status 200 prod-e DISABLED
934ecs_api_edp_get_producer_status 200 prod-f ENABLED
935
936if [ -z "$FLAT_A1_EI" ]; then
937 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
938 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
939 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
940 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
941 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
942else
943 ecs_api_a1_get_job_status 200 job1 DISABLED
944 ecs_api_a1_get_job_status 200 job2 DISABLED
945 ecs_api_a1_get_job_status 200 job3 ENABLED
946 ecs_api_a1_get_job_status 200 job8 ENABLED
947 ecs_api_a1_get_job_status 200 job10 ENABLED
948fi
949
950#Disable create for job10 in prod-e
951prodstub_arm_job_create 200 prod-e job10 400
952
953#Update tjob 10 - only prod-f will be updated
954if [ -z "$FLAT_A1_EI" ]; then
955 ecs_api_a1_put_job 200 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
956else
957 ecs_api_a1_put_job 200 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template2.json
958fi
959#Reset producer and job responses
960prodstub_arm_producer 200 prod-e 200
961prodstub_arm_job_create 200 prod-e job10 200
962
963ecs_api_edp_get_producer_status 200 prod-e ENABLED 360
964
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100965if [ $ECS_VERSION == "V1-1" ]; then
966 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
967else
968 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
969fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100970
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100971#Wait for job to be updated
972sleep_wait 120
973
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100974if [ $ECS_VERSION == "V1-1" ]; then
975 prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
976else
977 prodstub_check_jobdata_2 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
978fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100979
980prodstub_arm_producer 200 prod-f 400
981
982ecs_api_edp_get_producer_status 200 prod-f DISABLED 360
983
984ecs_equal json:ei-producer/v1/eiproducers 4 1000
985
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100986if [ $ECS_VERSION == "V1-1" ]; then
987 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
988else
989 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e
990fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100991
992ecs_api_edp_get_producer_status 404 prod-a
993ecs_api_edp_get_producer_status 200 prod-b ENABLED
994ecs_api_edp_get_producer_status 200 prod-c ENABLED
995ecs_api_edp_get_producer_status 200 prod-d ENABLED
996ecs_api_edp_get_producer_status 200 prod-e ENABLED
997ecs_api_edp_get_producer_status 404 prod-f
998
999if [ -z "$FLAT_A1_EI" ]; then
1000 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
1001 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
1002 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
1003 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
1004 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
1005else
1006 ecs_api_a1_get_job_status 200 job1 DISABLED
1007 ecs_api_a1_get_job_status 200 job2 DISABLED
1008 ecs_api_a1_get_job_status 200 job3 ENABLED
1009 ecs_api_a1_get_job_status 200 job8 ENABLED
1010 ecs_api_a1_get_job_status 200 job10 ENABLED
1011fi
1012
1013cr_equal received_callbacks 6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +02001014
1015check_ecs_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001016
1017store_logs END
1018
1019#### TEST COMPLETE ####
1020
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001021print_result
1022
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +01001023auto_clean_environment