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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
21 TC_ONELINE_DESCR="Experimental ECS test case"
23 #App names to include in the test, space separated list
24 INCLUDED_IMAGES="ECS PRODSTUB"
26 . ../common/testcase_common.sh $@
27 . ../common/ecs_api_functions.sh
28 . ../common/prodstub_api_functions.sh
48 # Setup prodstub sim to accept calls for producers, types and jobs
49 prodstub_arm_producer 200 prod-a
50 prodstub_arm_producer 200 prod-b
51 prodstub_arm_producer 200 prod-c
53 prodstub_arm_producer 200 prod-d
54 prodstub_arm_type 200 prod-d type4
55 prodstub_arm_job_create 200 prod-d job8
57 prodstub_arm_type 200 prod-a type1
58 prodstub_arm_type 200 prod-b type2
59 prodstub_arm_type 200 prod-b type3
61 prodstub_disarm_type 200 prod-b type3
62 prodstub_arm_type 200 prod-b type1
63 prodstub_disarm_type 200 prod-b type1
65 prodstub_arm_job_create 200 prod-a job1
66 prodstub_arm_job_create 200 prod-a job2
67 prodstub_arm_job_create 200 prod-b job3
69 prodstub_arm_job_delete 200 prod-a job1
70 prodstub_arm_job_delete 200 prod-a job2
71 prodstub_arm_job_delete 200 prod-b job3
73 prodstub_arm_job_create 200 prod-b job4
74 prodstub_arm_job_create 200 prod-a job4
76 prodstub_arm_job_create 200 prod-b job5
77 prodstub_arm_job_create 200 prod-a job5
78 prodstub_arm_job_delete 200 prod-a job5
80 prodstub_arm_job_create 200 prod-b job6
83 ecs_api_service_status 200
85 # Initial tests - no config made
86 ecs_api_a1_get_type_ids 200 EMPTY
87 ecs_api_a1_get_type 404 test-type
89 ecs_api_edp_get_type_ids 200 EMPTY
90 ecs_api_edp_get_type 404 test-type
92 ecs_api_edp_get_producer_ids 200 EMPTY
93 ecs_api_edp_get_producer 404 test-prod
95 ecs_api_edp_get_producer_status 404 test-prod
97 ecs_api_edp_delete_producer 404 test-prod
99 if [ -z "$FLAT_A1_EI" ]; then
100 ecs_api_a1_get_job_ids 404 test-type NOWNER
101 ecs_api_a1_get_job_ids 404 test-type test-owner
103 ecs_api_a1_get_job 404 test-type test-job
105 ecs_api_a1_get_job_status 404 test-type test-job
107 ecs_api_a1_get_job_ids 200 test-type NOWNER EMPTY
108 ecs_api_a1_get_job_ids 200 test-type test-owner EMPTY
110 ecs_api_a1_get_job 404 test-job
112 ecs_api_a1_get_job_status 404 test-job
115 if [ -z "$FLAT_A1_EI" ]; then
116 ecs_api_a1_delete_job 404 test-type test-job
118 ecs_api_a1_delete_job 404 test-job
121 ecs_api_edp_get_producer_jobs 404 test-prod
124 # Setup of producer/job and test apis
126 ecs_api_edp_put_producer 201 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
127 ecs_api_edp_put_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
129 ecs_api_a1_get_type_ids 200 type1
130 if [ -z "$FLAT_A1_EI" ]; then
131 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
133 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
136 ecs_api_edp_get_type_ids 200 type1
137 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
139 ecs_api_edp_get_producer_ids 200 prod-a
140 ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
142 ecs_api_edp_get_producer_status 200 prod-a ENABLED
144 ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
145 ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
147 if [ -z "$FLAT_A1_EI" ]; then
148 ecs_api_a1_get_job 404 type1 test-job
150 ecs_api_a1_get_job_status 404 type1 test-job
152 ecs_api_a1_get_job 404 test-job
154 ecs_api_a1_get_job_status 404 test-job
157 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
161 if [ -z "$FLAT_A1_EI" ]; then
162 ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
164 ecs_api_a1_put_job 201 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
167 prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
169 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
170 ecs_api_a1_get_job_ids 200 type1 ric1 job1
171 if [ ! -z "$FLAT_A1_EI" ]; then
172 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
175 if [ -z "$FLAT_A1_EI" ]; then
176 ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
178 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
180 ecs_api_a1_get_job 200 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
182 ecs_api_a1_get_job_status 200 job1 ENABLED
185 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
189 if [ -z "$FLAT_A1_EI" ]; then
190 ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
192 ecs_api_a1_put_job 201 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
195 prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
197 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
198 ecs_api_a1_get_job_ids 200 type1 ric1 job1
199 ecs_api_a1_get_job_ids 200 type1 ric2 job2
200 if [ ! -z "$FLAT_A1_EI" ]; then
201 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
204 if [ -z "$FLAT_A1_EI" ]; then
205 ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
207 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
209 ecs_api_a1_get_job 200 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
211 ecs_api_a1_get_job_status 200 job2 ENABLED
214 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
218 ecs_api_edp_put_producer 201 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
220 ecs_api_a1_get_type_ids 200 type1 type2
221 if [ -z "$FLAT_A1_EI" ]; then
222 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
223 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
225 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
226 ecs_api_a1_get_type 200 type2 testdata/ecs/empty-type.json
229 ecs_api_edp_get_type_ids 200 type1 type2
230 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
231 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
233 ecs_api_edp_get_producer_ids 200 prod-a prod-b
234 ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
235 ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
237 ecs_api_edp_get_producer_status 200 prod-b ENABLED
241 if [ -z "$FLAT_A1_EI" ]; then
242 ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
244 ecs_api_a1_put_job 201 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
247 prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
249 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
250 ecs_api_a1_get_job_ids 200 type2 NOWNER job3
251 ecs_api_a1_get_job_ids 200 type1 ric1 job1
252 ecs_api_a1_get_job_ids 200 type1 ric2 job2
253 ecs_api_a1_get_job_ids 200 type2 ric3 job3
255 if [ -z "$FLAT_A1_EI" ]; then
256 ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
258 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
260 ecs_api_a1_get_job 200 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
262 ecs_api_a1_get_job_status 200 job3 ENABLED
265 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
266 ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
270 ecs_api_edp_put_producer 201 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c NOTYPE
272 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
273 ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
274 ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
275 ecs_api_edp_get_producer 200 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c EMPTY
277 ecs_api_edp_get_producer_status 200 prod-c ENABLED
279 if [ -z "$FLAT_A1_EI" ]; then
280 ecs_api_a1_delete_job 204 type2 job3
282 ecs_api_a1_delete_job 204 job3
285 ecs_api_edp_delete_producer 204 prod-b
288 prodstub_equal create/prod-d/job8 0
289 prodstub_equal delete/prod-d/job8 0
291 ecs_api_edp_put_producer 201 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
293 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
295 if [ -z "$FLAT_A1_EI" ]; then
296 ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
298 ecs_api_a1_put_job 201 job8 type4 http://localhost:80/target8 ric4 http://localhost:80/status4 testdata/ecs/job-template.json
301 prodstub_equal create/prod-d/job8 1
302 prodstub_equal delete/prod-d/job8 0
304 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
306 ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d NOTYPE
308 if [ -z "$FLAT_A1_EI" ]; then
309 ecs_api_a1_get_job_ids 404 type4 NOWNER
311 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
312 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
315 prodstub_equal create/prod-d/job8 1
316 prodstub_equal delete/prod-d/job8 0
320 ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
322 if [ -z "$FLAT_A1_EI" ]; then
323 ecs_api_a1_get_job_ids 404 type4 NOWNER
325 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
326 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
340 #### TEST COMPLETE ####
345 auto_clean_containers