blob: 03342462e956439c516d616daff5622537cb2018 [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
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010024DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP HTTPPROXY 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="PRODSTUB CR ECS RICSIM CP HTTPPROXY 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
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010029KUBE_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
34CONDITIONALLY_IGNORED_IMAGES="NGW"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010035
36#Supported test environment profiles
BjornMagnussonXA89b64ab2020-12-16 09:21:01 +010037SUPPORTED_PROFILES="ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020040
41. ../common/testcase_common.sh $@
42. ../common/ecs_api_functions.sh
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020043. ../common/prodstub_api_functions.sh
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010044. ../common/cr_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010045. ../common/control_panel_api_functions.sh
46. ../common/controller_api_functions.sh
47. ../common/ricsimulator_api_functions.sh
BjornMagnussonXAc963b732021-01-20 14:24:13 +010048. ../common/http_proxy_api_functions.sh
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010049. ../common/kube_proxy_api_functions.sh
50. ../common/gateway_api_functions.sh
51
52setup_testenvironment
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020053
54#### TEST BEGIN ####
55
BjornMagnussonXA4207b832020-11-03 09:52:49 +010056FLAT_A1_EI="1"
57
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010058clean_environment
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020059
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010060if [ $RUNMODE == "KUBE" ]; then
61 start_kube_proxy
62fi
63
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010064use_ecs_rest_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020065
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010066use_prod_stub_https
67
68use_simulator_https
69
70use_cr_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020071
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010072start_http_proxy
BjornMagnussonXAc963b732021-01-20 14:24:13 +010073
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010074start_ecs NOPROXY $SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_CONFIG_FILE #Change NOPROXY to PROXY to run with http proxy
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010075
76if [ $RUNMODE == "KUBE" ]; then
77 ecs_api_admin_reset
78fi
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020079
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020080start_prod_stub
81
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020082set_ecs_trace
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020083
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010084start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
85
86if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
87 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
88fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010089
90if [ "$PMS_VERSION" == "V2" ]; then
91 start_ric_simulators ricsim_g3 4 STD_2.0.0
92fi
93
94start_cr
95
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010096CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
97CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010098TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
99TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
100TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery"
101TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
102TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
103
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100104STATUS1="$CR_SERVICE_PATH/job1-status"
105STATUS2="$CR_SERVICE_PATH/job2-status"
106STATUS3="$CR_SERVICE_PATH/job3-status"
107STATUS8="$CR_SERVICE_PATH/job8-status"
108STATUS10="$CR_SERVICE_PATH/job10-status"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100109
110### Setup prodstub sim to accept calls for producers, types and jobs
111## prod-a type1
112## prod-b type1 and type2
113## prod-c no-type
114## prod-d type4
115## prod-e type6
116## prod-f type6
117
118## job1 -> prod-a
119## job2 -> prod-a
120## job3 -> prod-b
121## job4 -> prod-a
122## job6 -> prod-b
123## job8 -> prod-d
124## job10 -> prod-e and prod-f
125
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200126prodstub_arm_producer 200 prod-a
127prodstub_arm_producer 200 prod-b
128prodstub_arm_producer 200 prod-c
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200129prodstub_arm_producer 200 prod-d
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100130prodstub_arm_producer 200 prod-e
131prodstub_arm_producer 200 prod-f
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200132
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200133prodstub_arm_type 200 prod-a type1
134prodstub_arm_type 200 prod-b type2
135prodstub_arm_type 200 prod-b type3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100136prodstub_arm_type 200 prod-d type4
137prodstub_arm_type 200 prod-e type6
138prodstub_arm_type 200 prod-f type6
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200139
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200140prodstub_disarm_type 200 prod-b type3
141prodstub_arm_type 200 prod-b type1
142prodstub_disarm_type 200 prod-b type1
143
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100144
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200145prodstub_arm_job_create 200 prod-a job1
146prodstub_arm_job_create 200 prod-a job2
147prodstub_arm_job_create 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200148
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200149prodstub_arm_job_delete 200 prod-a job1
150prodstub_arm_job_delete 200 prod-a job2
151prodstub_arm_job_delete 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200152
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200153prodstub_arm_job_create 200 prod-b job4
154prodstub_arm_job_create 200 prod-a job4
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200155
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200156prodstub_arm_job_create 200 prod-b job6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200157
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100158prodstub_arm_job_create 200 prod-d job8
159
160prodstub_arm_job_create 200 prod-e job10
161prodstub_arm_job_create 200 prod-f job10
162
163### ecs status
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200164ecs_api_service_status 200
165
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100166cr_equal received_callbacks 0
167
168### Initial tests - no config made
169### GET: type ids, types, producer ids, producers, job ids, jobs
170### DELETE: jobs
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200171ecs_api_a1_get_type_ids 200 EMPTY
172ecs_api_a1_get_type 404 test-type
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200173
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200174ecs_api_edp_get_type_ids 200 EMPTY
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100175if [ $ECS_VERSION == "V1-1" ]; then
176 ecs_api_edp_get_type 404 test-type
177else
178 ecs_api_edp_get_type_2 404 test-type
179fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200180
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100181if [ $ECS_VERSION == "V1-1" ]; then
182 ecs_api_edp_get_producer_ids 200 EMPTY
183 ecs_api_edp_get_producer 404 test-prod
184else
185 ecs_api_edp_get_producer_ids_2 200 NOTYPE EMPTY
186 ecs_api_edp_get_producer_2 404 test-prod
187fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200188ecs_api_edp_get_producer_status 404 test-prod
189
190ecs_api_edp_delete_producer 404 test-prod
191
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100192if [ -z "$FLAT_A1_EI" ]; then
193 ecs_api_a1_get_job_ids 404 test-type NOWNER
194 ecs_api_a1_get_job_ids 404 test-type test-owner
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200195
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100196 ecs_api_a1_get_job 404 test-type test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200197
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100198 ecs_api_a1_get_job_status 404 test-type test-job
199else
200 ecs_api_a1_get_job_ids 200 test-type NOWNER EMPTY
201 ecs_api_a1_get_job_ids 200 test-type test-owner EMPTY
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200202
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100203 ecs_api_a1_get_job 404 test-job
204
205 ecs_api_a1_get_job_status 404 test-job
206fi
207
208if [ -z "$FLAT_A1_EI" ]; then
209 ecs_api_a1_delete_job 404 test-type test-job
210else
211 ecs_api_a1_delete_job 404 test-job
212fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200213
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100214if [ $ECS_VERSION == "V1-1" ]; then
215 ecs_api_edp_get_producer_jobs 404 test-prod
216else
217 ecs_api_edp_get_producer_jobs_2 404 test-prod
218fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200219
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100220if [ $ECS_VERSION == "V1-2" ]; then
221 ecs_api_edp_get_type_2 404 test-type
222 ecs_api_edp_delete_type_2 404 test-type
223fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200224
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100225### Setup of producer/job and testing apis ###
226
227## Setup prod-a
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100228if [ $ECS_VERSION == "V1-1" ]; then
229 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
230 ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
231else
232 #V1-2
233 ecs_api_edp_get_type_ids 200 EMPTY
234 ecs_api_edp_get_type_2 404 type1
235 ecs_api_edp_put_producer_2 404 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
236
237 # Create type, delete and create again
238 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
239 ecs_api_edp_get_type_2 200 type1
240 ecs_api_edp_get_type_ids 200 type1
241 ecs_api_edp_delete_type_2 204 type1
242 ecs_api_edp_get_type_2 404 type1
243 ecs_api_edp_get_type_ids 200 EMPTY
244 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
245 ecs_api_edp_get_type_ids 200 type1
246 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
247
248 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
249 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
250
251 ecs_api_edp_delete_type_2 406 type1
252fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100253
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200254
255ecs_api_a1_get_type_ids 200 type1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100256if [ -z "$FLAT_A1_EI" ]; then
257 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
258else
259 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
260fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200261
262ecs_api_edp_get_type_ids 200 type1
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100263if [ $ECS_VERSION == "V1-1" ]; then
264 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
265else
266 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
267fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200268
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100269if [ $ECS_VERSION == "V1-1" ]; then
270 ecs_api_edp_get_producer_ids 200 prod-a
271else
272 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a
273 ecs_api_edp_get_producer_ids_2 200 type1 prod-a
274 ecs_api_edp_get_producer_ids_2 200 type2 EMPTY
275fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100276
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100277if [ $ECS_VERSION == "V1-1" ]; then
278 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
279else
280 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
281fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200282
283ecs_api_edp_get_producer_status 200 prod-a ENABLED
284
285ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
286ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
287
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100288if [ -z "$FLAT_A1_EI" ]; then
289 ecs_api_a1_get_job 404 type1 test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200290
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100291 ecs_api_a1_get_job_status 404 type1 test-job
292else
293 ecs_api_a1_get_job 404 test-job
294
295 ecs_api_a1_get_job_status 404 test-job
296fi
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100297if [ $ECS_VERSION == "V1-1" ]; then
298 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
299else
300 ecs_api_edp_get_producer_jobs_2 200 prod-a EMPTY
301fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200302
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100303## Create a job for prod-a
304## job1 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100305if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100306 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100307else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100308 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100309fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200310
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100311# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100312if [ $ECS_VERSION == "V1-1" ]; then
313 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
314else
315 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
316fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200317
318ecs_api_a1_get_job_ids 200 type1 NOWNER job1
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100319ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
320
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100321if [ ! -z "$FLAT_A1_EI" ]; then
322 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
323fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200324
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100325if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100326 ecs_api_a1_get_job 200 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200327
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100328 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
329else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100330 ecs_api_a1_get_job 200 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100331
332 ecs_api_a1_get_job_status 200 job1 ENABLED
333fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200334
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100335prodstub_equal create/prod-a/job1 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200336
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100337if [ $ECS_VERSION == "V1-1" ]; then
338 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
339else
340 ecs_api_edp_get_producer_jobs_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
341fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200342
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100343## Create a second job for prod-a
344## job2 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100345if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100346 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100347else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100348 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100349fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200350
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100351# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100352if [ $ECS_VERSION == "V1-1" ]; then
353 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
354else
355 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
356fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200357ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100358ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
359ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100360if [ ! -z "$FLAT_A1_EI" ]; then
361 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
362fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200363
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100364if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100365 ecs_api_a1_get_job 200 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200366
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100367 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
368else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100369 ecs_api_a1_get_job 200 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100370
371 ecs_api_a1_get_job_status 200 job2 ENABLED
372fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200373
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100374prodstub_equal create/prod-a/job2 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200375
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100376if [ $ECS_VERSION == "V1-1" ]; then
377 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
378else
379 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
380fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200381
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100382## Setup prod-b
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100383if [ $ECS_VERSION == "V1-1" ]; then
384 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
385else
386 ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json
387 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
388fi
389
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200390
391ecs_api_a1_get_type_ids 200 type1 type2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100392if [ -z "$FLAT_A1_EI" ]; then
393 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
394 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
395else
396 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
397 ecs_api_a1_get_type 200 type2 testdata/ecs/empty-type.json
398fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200399
400ecs_api_edp_get_type_ids 200 type1 type2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100401if [ $ECS_VERSION == "V1-1" ]; then
402 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
403 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
404else
405 ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
406 ecs_api_edp_get_type_2 200 type2 testdata/ecs/ei-type-2.json
407fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200408
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100409if [ $ECS_VERSION == "V1-1" ]; then
410 ecs_api_edp_get_producer_ids 200 prod-a prod-b
411else
412 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b
413fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100414
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100415if [ $ECS_VERSION == "V1-1" ]; then
416 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
417 ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
418else
419 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
420 ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
421fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200422
423ecs_api_edp_get_producer_status 200 prod-b ENABLED
424
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100425## Create job for prod-b
426## job3 - prod-b
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100427if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100428 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100429else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100430 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100431fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200432
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100433prodstub_equal create/prod-b/job3 1
434
435# Check the job data in the producer
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100436if [ $ECS_VERSION == "V1-1" ]; then
437 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
438else
439 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
440fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200441
442ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
443ecs_api_a1_get_job_ids 200 type2 NOWNER job3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100444ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
445ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
446ecs_api_a1_get_job_ids 200 type2 ricsim_g3_3 job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200447
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100448if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100449 ecs_api_a1_get_job 200 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200450
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100451 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
452else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100453 ecs_api_a1_get_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100454
455 ecs_api_a1_get_job_status 200 job3 ENABLED
456fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200457
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100458if [ $ECS_VERSION == "V1-1" ]; then
459 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
460 ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
461else
462 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
463 ecs_api_edp_get_producer_jobs_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
464fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200465
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100466## Setup prod-c (no types)
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100467if [ $ECS_VERSION == "V1-1" ]; then
468 ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
469else
470 ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
471fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100472
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100473if [ $ECS_VERSION == "V1-1" ]; then
474 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
475else
476 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
477fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200478
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100479if [ $ECS_VERSION == "V1-1" ]; then
480 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
481 ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
482 ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
483else
484 ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
485 ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
486 ecs_api_edp_get_producer_2 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
487fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200488
489ecs_api_edp_get_producer_status 200 prod-c ENABLED
490
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100491
492## Delete job3 and prod-b and re-create if different order
493
494# Delete job then producer
495ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100496if [ $ECS_VERSION == "V1-1" ]; then
497 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
498else
499 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
500fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100501
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100502if [ -z "$FLAT_A1_EI" ]; then
503 ecs_api_a1_delete_job 204 type2 job3
504else
505 ecs_api_a1_delete_job 204 job3
506fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200507
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100508ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100509if [ $ECS_VERSION == "V1-1" ]; then
510 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
511else
512 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
513fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100514
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200515ecs_api_edp_delete_producer 204 prod-b
516
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100517ecs_api_edp_get_producer_status 404 prod-b
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200518
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100519ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100520if [ $ECS_VERSION == "V1-1" ]; then
521 ecs_api_edp_get_producer_ids 200 prod-a prod-c
522else
523 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
524fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200525
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100526prodstub_equal delete/prod-b/job3 1
527
528if [ -z "$FLAT_A1_EI" ]; then
529 ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
530else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100531 if [ $ECS_VERSION == "V1-1" ]; then
532 ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
533 else
534 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
535 ecs_api_a1_get_job_status 200 job3 DISABLED
536 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100537fi
538
539# Put producer then job
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100540if [ $ECS_VERSION == "V1-1" ]; then
541 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
542else
543 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
544fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100545
546ecs_api_edp_get_producer_status 200 prod-b ENABLED
547
548if [ -z "$FLAT_A1_EI" ]; then
549 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
550 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
551else
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100552 if [ $ECS_VERSION == "V1-1" ]; then
553 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
554 else
555 ecs_api_a1_put_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
556 fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100557 ecs_api_a1_get_job_status 200 job3 ENABLED
558fi
559
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100560if [ $ECS_VERSION == "V1-1" ]; then
561 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
562else
563 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
564fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100565
566ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100567if [ $ECS_VERSION == "V1-1" ]; then
568 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
569else
570 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
571fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100572
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100573if [ $ECS_VERSION == "V1-1" ]; then
574 prodstub_equal create/prod-b/job3 2
575else
576 prodstub_equal create/prod-b/job3 3
577fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100578prodstub_equal delete/prod-b/job3 1
579
580# Delete only the producer
581ecs_api_edp_delete_producer 204 prod-b
582
583ecs_api_edp_get_producer_status 404 prod-b
584
585ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100586if [ $ECS_VERSION == "V1-1" ]; then
587 ecs_api_edp_get_producer_ids 200 prod-a prod-c
588else
589 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
590fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100591
592if [ -z "$FLAT_A1_EI" ]; then
593 ecs_api_a1_get_job_status 200 type2 job3 DISABLED
594else
595 ecs_api_a1_get_job_status 200 job3 DISABLED
596fi
597
598cr_equal received_callbacks 1 30
599cr_equal received_callbacks?id=job3-status 1
600cr_api_check_all_ecs_events 200 job3-status DISABLED
601
602# Re-create the producer
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100603if [ $ECS_VERSION == "V1-1" ]; then
604 ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
605else
606 ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
607fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100608
609ecs_api_edp_get_producer_status 200 prod-b ENABLED
610
611if [ -z "$FLAT_A1_EI" ]; then
612 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
613else
614 ecs_api_a1_get_job_status 200 job3 ENABLED
615fi
616
617cr_equal received_callbacks 2 30
618cr_equal received_callbacks?id=job3-status 2
619cr_api_check_all_ecs_events 200 job3-status ENABLED
620
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100621if [ $ECS_VERSION == "V1-1" ]; then
622 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
623else
624 prodstub_check_jobdata_2 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
625fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100626
627## Setup prod-d
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100628if [ $ECS_VERSION == "V1-1" ]; then
629 ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
630else
631 ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-1.json
632 ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
633fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200634
635ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
636
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100637if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100638 ecs_api_a1_put_job 201 type4 job8 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100639else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100640 ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100641fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100642
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100643if [ $ECS_VERSION == "V1-1" ]; then
644 prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
645else
646 prodstub_check_jobdata_2 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
647fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100648
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200649prodstub_equal create/prod-d/job8 1
650prodstub_equal delete/prod-d/job8 0
651
652ecs_api_a1_get_job_ids 200 type4 NOWNER job8
653
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100654if [ -z "$FLAT_A1_EI" ]; then
655 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
656else
657 ecs_api_a1_get_job_status 200 job8 ENABLED
658fi
659
660# Re-PUT the producer with zero types
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100661if [ $ECS_VERSION == "V1-1" ]; then
662 ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
663else
664 ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
665fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200666
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100667if [ -z "$FLAT_A1_EI" ]; then
668 ecs_api_a1_get_job_ids 404 type4 NOWNER
669else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100670 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
671 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100672fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200673
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100674if [ -z "$FLAT_A1_EI" ]; then
675 ecs_api_a1_get_job_status 200 type4 job8 DISABLED
676else
677 ecs_api_a1_get_job_status 200 job8 DISABLED
678fi
679
680cr_equal received_callbacks 3 30
681cr_equal received_callbacks?id=job8-status 1
682cr_api_check_all_ecs_events 200 job8-status DISABLED
683
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200684prodstub_equal create/prod-d/job8 1
685prodstub_equal delete/prod-d/job8 0
686
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100687## Re-setup prod-d
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100688if [ $ECS_VERSION == "V1-1" ]; then
689 ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
690else
691 ecs_api_edp_put_type_2 200 type4 testdata/ecs/ei-type-4.json
692 ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
693fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100694
695if [ -z "$FLAT_A1_EI" ]; then
696 ecs_api_a1_get_job_ids 404 type4 NOWNER
697else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100698 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
699 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100700fi
701
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100702if [ -z "$FLAT_A1_EI" ]; then
703 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
704else
705 ecs_api_a1_get_job_status 200 job8 ENABLED
706fi
707
708ecs_api_edp_get_producer_status 200 prod-a ENABLED
709ecs_api_edp_get_producer_status 200 prod-b ENABLED
710ecs_api_edp_get_producer_status 200 prod-c ENABLED
711ecs_api_edp_get_producer_status 200 prod-d ENABLED
712
713cr_equal received_callbacks 4 30
714cr_equal received_callbacks?id=job8-status 2
715cr_api_check_all_ecs_events 200 job8-status ENABLED
716
717prodstub_equal create/prod-d/job8 2
718prodstub_equal delete/prod-d/job8 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100719
720
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100721## Setup prod-e
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100722if [ $ECS_VERSION == "V1-1" ]; then
723 ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
724else
725 ecs_api_edp_put_type_2 201 type6 testdata/ecs/ei-type-6.json
726 ecs_api_edp_put_producer_2 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6
727fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100728
729ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY
730
731if [ -z "$FLAT_A1_EI" ]; then
732 ecs_api_a1_put_job 201 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
733else
734 ecs_api_a1_put_job 201 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template.json
735fi
736
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100737if [ $ECS_VERSION == "V1-1" ]; then
738 prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
739else
740 prodstub_check_jobdata_2 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
741fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100742
743prodstub_equal create/prod-e/job10 1
744prodstub_equal delete/prod-e/job10 0
745
746ecs_api_a1_get_job_ids 200 type6 NOWNER job10
747
748if [ -z "$FLAT_A1_EI" ]; then
749 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
750else
751 ecs_api_a1_get_job_status 200 job10 ENABLED
752fi
753
754## Setup prod-f
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100755if [ $ECS_VERSION == "V1-1" ]; then
756 ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
757else
758 ecs_api_edp_put_type_2 200 type6 testdata/ecs/ei-type-6.json
759 ecs_api_edp_put_producer_2 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6
760fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100761
762ecs_api_a1_get_job_ids 200 type6 NOWNER job10
763
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100764if [ $ECS_VERSION == "V1-1" ]; then
765 prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
766else
767 prodstub_check_jobdata_2 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
768fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100769
770prodstub_equal create/prod-f/job10 1
771prodstub_equal delete/prod-f/job10 0
772
773ecs_api_a1_get_job_ids 200 type6 NOWNER job10
774
775if [ -z "$FLAT_A1_EI" ]; then
776 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
777else
778 ecs_api_a1_get_job_status 200 job10 ENABLED
779fi
780
781## Status updates prod-a and jobs
782
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100783if [ $ECS_VERSION == "V1-1" ]; then
784 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
785else
786 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
787fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100788
789ecs_api_edp_get_producer_status 200 prod-a ENABLED
790ecs_api_edp_get_producer_status 200 prod-b ENABLED
791ecs_api_edp_get_producer_status 200 prod-c ENABLED
792ecs_api_edp_get_producer_status 200 prod-d ENABLED
793ecs_api_edp_get_producer_status 200 prod-e ENABLED
794ecs_api_edp_get_producer_status 200 prod-f ENABLED
795
796# Arm producer prod-a for supervision failure
797prodstub_arm_producer 200 prod-a 400
798
799# Wait for producer prod-a to go disabled
800ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
801
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100802if [ $ECS_VERSION == "V1-1" ]; then
803 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
804else
805 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
806fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100807
808ecs_api_edp_get_producer_status 200 prod-a DISABLED
809ecs_api_edp_get_producer_status 200 prod-b ENABLED
810ecs_api_edp_get_producer_status 200 prod-c ENABLED
811ecs_api_edp_get_producer_status 200 prod-d ENABLED
812ecs_api_edp_get_producer_status 200 prod-e ENABLED
813ecs_api_edp_get_producer_status 200 prod-f ENABLED
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100814
815
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100816if [ -z "$FLAT_A1_EI" ]; then
817 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
818 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
819 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
820 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
821 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
822else
823 ecs_api_a1_get_job_status 200 job1 ENABLED
824 ecs_api_a1_get_job_status 200 job2 ENABLED
825 ecs_api_a1_get_job_status 200 job3 ENABLED
826 ecs_api_a1_get_job_status 200 job8 ENABLED
827 ecs_api_a1_get_job_status 200 job10 ENABLED
828fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100829
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100830# Arm producer prod-a for supervision
831prodstub_arm_producer 200 prod-a 200
832
833# Wait for producer prod-a to go enabled
834ecs_api_edp_get_producer_status 200 prod-a ENABLED 360
835
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100836if [ $ECS_VERSION == "V1-1" ]; then
837 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
838else
839 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
840fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100841
842ecs_api_edp_get_producer_status 200 prod-a ENABLED
843ecs_api_edp_get_producer_status 200 prod-b ENABLED
844ecs_api_edp_get_producer_status 200 prod-c ENABLED
845ecs_api_edp_get_producer_status 200 prod-d ENABLED
846ecs_api_edp_get_producer_status 200 prod-e ENABLED
847ecs_api_edp_get_producer_status 200 prod-f ENABLED
848
849if [ -z "$FLAT_A1_EI" ]; then
850 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
851 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
852 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
853 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
854 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
855else
856 ecs_api_a1_get_job_status 200 job1 ENABLED
857 ecs_api_a1_get_job_status 200 job2 ENABLED
858 ecs_api_a1_get_job_status 200 job3 ENABLED
859 ecs_api_a1_get_job_status 200 job8 ENABLED
860 ecs_api_a1_get_job_status 200 job10 ENABLED
861fi
862
863# Arm producer prod-a for supervision failure
864prodstub_arm_producer 200 prod-a 400
865
866# Wait for producer prod-a to go disabled
867ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
868
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100869if [ $ECS_VERSION == "V1-1" ]; then
870 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
871else
872 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
873fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100874
875ecs_api_edp_get_producer_status 200 prod-a DISABLED
876ecs_api_edp_get_producer_status 200 prod-b ENABLED
877ecs_api_edp_get_producer_status 200 prod-c ENABLED
878ecs_api_edp_get_producer_status 200 prod-d ENABLED
879ecs_api_edp_get_producer_status 200 prod-e ENABLED
880ecs_api_edp_get_producer_status 200 prod-f ENABLED
881
882if [ -z "$FLAT_A1_EI" ]; then
883 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
884 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
885 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
886 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
887 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
888else
889 ecs_api_a1_get_job_status 200 job1 ENABLED
890 ecs_api_a1_get_job_status 200 job2 ENABLED
891 ecs_api_a1_get_job_status 200 job3 ENABLED
892 ecs_api_a1_get_job_status 200 job8 ENABLED
893 ecs_api_a1_get_job_status 200 job10 ENABLED
894fi
895
896# Wait for producer prod-a to be removed
897ecs_equal json:ei-producer/v1/eiproducers 5 1000
898
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100899if [ $ECS_VERSION == "V1-1" ]; then
900 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
901else
902 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
903fi
904
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100905
906ecs_api_edp_get_producer_status 404 prod-a
907ecs_api_edp_get_producer_status 200 prod-b ENABLED
908ecs_api_edp_get_producer_status 200 prod-c ENABLED
909ecs_api_edp_get_producer_status 200 prod-d ENABLED
910ecs_api_edp_get_producer_status 200 prod-e ENABLED
911ecs_api_edp_get_producer_status 200 prod-f ENABLED
912
913if [ -z "$FLAT_A1_EI" ]; then
914 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
915 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
916 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
917 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
918 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
919else
920 ecs_api_a1_get_job_status 200 job1 DISABLED
921 ecs_api_a1_get_job_status 200 job2 DISABLED
922 ecs_api_a1_get_job_status 200 job3 ENABLED
923 ecs_api_a1_get_job_status 200 job8 ENABLED
924 ecs_api_a1_get_job_status 200 job10 ENABLED
925fi
926
927cr_equal received_callbacks 6 30
928cr_equal received_callbacks?id=job1-status 1
929cr_equal received_callbacks?id=job2-status 1
930
931cr_api_check_all_ecs_events 200 job1-status DISABLED
932cr_api_check_all_ecs_events 200 job2-status DISABLED
933
934
935# Arm producer prod-e for supervision failure
936prodstub_arm_producer 200 prod-e 400
937
938ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000
939
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100940if [ $ECS_VERSION == "V1-1" ]; then
941 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
942else
943 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
944fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100945
946ecs_api_edp_get_producer_status 404 prod-a
947ecs_api_edp_get_producer_status 200 prod-b ENABLED
948ecs_api_edp_get_producer_status 200 prod-c ENABLED
949ecs_api_edp_get_producer_status 200 prod-d ENABLED
950ecs_api_edp_get_producer_status 200 prod-e DISABLED
951ecs_api_edp_get_producer_status 200 prod-f ENABLED
952
953if [ -z "$FLAT_A1_EI" ]; then
954 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
955 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
956 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
957 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
958 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
959else
960 ecs_api_a1_get_job_status 200 job1 DISABLED
961 ecs_api_a1_get_job_status 200 job2 DISABLED
962 ecs_api_a1_get_job_status 200 job3 ENABLED
963 ecs_api_a1_get_job_status 200 job8 ENABLED
964 ecs_api_a1_get_job_status 200 job10 ENABLED
965fi
966
967#Disable create for job10 in prod-e
968prodstub_arm_job_create 200 prod-e job10 400
969
970#Update tjob 10 - only prod-f will be updated
971if [ -z "$FLAT_A1_EI" ]; then
972 ecs_api_a1_put_job 200 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
973else
974 ecs_api_a1_put_job 200 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template2.json
975fi
976#Reset producer and job responses
977prodstub_arm_producer 200 prod-e 200
978prodstub_arm_job_create 200 prod-e job10 200
979
980ecs_api_edp_get_producer_status 200 prod-e ENABLED 360
981
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100982if [ $ECS_VERSION == "V1-1" ]; then
983 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
984else
985 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
986fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100987
BjornMagnussonXA27db02f2021-01-19 08:13:00 +0100988#Wait for job to be updated
989sleep_wait 120
990
BjornMagnussonXAc963b732021-01-20 14:24:13 +0100991if [ $ECS_VERSION == "V1-1" ]; then
992 prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
993else
994 prodstub_check_jobdata_2 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
995fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100996
997prodstub_arm_producer 200 prod-f 400
998
999ecs_api_edp_get_producer_status 200 prod-f DISABLED 360
1000
1001ecs_equal json:ei-producer/v1/eiproducers 4 1000
1002
BjornMagnussonXA27db02f2021-01-19 08:13:00 +01001003if [ $ECS_VERSION == "V1-1" ]; then
1004 ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
1005else
1006 ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e
1007fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +01001008
1009ecs_api_edp_get_producer_status 404 prod-a
1010ecs_api_edp_get_producer_status 200 prod-b ENABLED
1011ecs_api_edp_get_producer_status 200 prod-c ENABLED
1012ecs_api_edp_get_producer_status 200 prod-d ENABLED
1013ecs_api_edp_get_producer_status 200 prod-e ENABLED
1014ecs_api_edp_get_producer_status 404 prod-f
1015
1016if [ -z "$FLAT_A1_EI" ]; then
1017 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
1018 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
1019 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
1020 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
1021 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
1022else
1023 ecs_api_a1_get_job_status 200 job1 DISABLED
1024 ecs_api_a1_get_job_status 200 job2 DISABLED
1025 ecs_api_a1_get_job_status 200 job3 ENABLED
1026 ecs_api_a1_get_job_status 200 job8 ENABLED
1027 ecs_api_a1_get_job_status 200 job10 ENABLED
1028fi
1029
1030cr_equal received_callbacks 6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +02001031
1032check_ecs_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001033
1034store_logs END
1035
1036#### TEST COMPLETE ####
1037
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001038print_result
1039
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +01001040auto_clean_environment