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
46 # Setup prodstub sim to accept calls for producers, types and jobs
47 prodstub_arm_producer 200 prod-a
48 prodstub_arm_producer 200 prod-b
49 prodstub_arm_producer 200 prod-c
51 prodstub_arm_producer 200 prod-d
52 prodstub_arm_type 200 prod-d type4
53 prodstub_arm_job_create 200 prod-d job8
55 prodstub_arm_type 200 prod-a type1
56 prodstub_arm_type 200 prod-b type2
57 prodstub_arm_type 200 prod-b type3
59 prodstub_disarm_type 200 prod-b type3
60 prodstub_arm_type 200 prod-b type1
61 prodstub_disarm_type 200 prod-b type1
63 prodstub_arm_job_create 200 prod-a job1
64 prodstub_arm_job_create 200 prod-a job2
65 prodstub_arm_job_create 200 prod-b job3
67 prodstub_arm_job_delete 200 prod-a job1
68 prodstub_arm_job_delete 200 prod-a job2
69 prodstub_arm_job_delete 200 prod-b job3
71 prodstub_arm_job_create 200 prod-b job4
72 prodstub_arm_job_create 200 prod-a job4
74 prodstub_arm_job_create 200 prod-b job5
75 prodstub_arm_job_create 200 prod-a job5
76 prodstub_arm_job_delete 200 prod-a job5
78 prodstub_arm_job_create 200 prod-b job6
81 ecs_api_service_status 200
83 # Initial tests - no config made
84 ecs_api_a1_get_type_ids 200 EMPTY
85 ecs_api_a1_get_type 404 test-type
87 ecs_api_edp_get_type_ids 200 EMPTY
88 ecs_api_edp_get_type 404 test-type
90 ecs_api_edp_get_producer_ids 200 EMPTY
91 ecs_api_edp_get_producer 404 test-prod
93 ecs_api_edp_get_producer_status 404 test-prod
95 ecs_api_edp_delete_producer 404 test-prod
97 ecs_api_a1_get_job_ids 404 test-type NOWNER
98 ecs_api_a1_get_job_ids 404 test-type test-owner
100 ecs_api_a1_get_job 404 test-type test-job
102 ecs_api_a1_get_job_status 404 test-type test-job
104 ecs_api_a1_delete_job 404 test-type test-job
106 ecs_api_edp_get_producer_jobs 404 test-prod
109 # Setup of producer/job and test apis
111 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
112 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
114 ecs_api_a1_get_type_ids 200 type1
115 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
117 ecs_api_edp_get_type_ids 200 type1
118 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
120 ecs_api_edp_get_producer_ids 200 prod-a
121 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
123 ecs_api_edp_get_producer_status 200 prod-a ENABLED
125 ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
126 ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
128 ecs_api_a1_get_job 404 type1 test-job
130 ecs_api_a1_get_job_status 404 type1 test-job
132 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
136 ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
138 prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
140 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
141 ecs_api_a1_get_job_ids 200 type1 ric1 job1
143 ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
145 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
147 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
151 ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
153 prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
155 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
156 ecs_api_a1_get_job_ids 200 type1 ric1 job1
157 ecs_api_a1_get_job_ids 200 type1 ric2 job2
159 ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
161 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
163 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
167 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
169 ecs_api_a1_get_type_ids 200 type1 type2
170 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
171 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
173 ecs_api_edp_get_type_ids 200 type1 type2
174 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
175 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
177 ecs_api_edp_get_producer_ids 200 prod-a prod-b
178 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
179 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
181 ecs_api_edp_get_producer_status 200 prod-b ENABLED
185 ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
187 prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
189 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
190 ecs_api_a1_get_job_ids 200 type2 NOWNER job3
191 ecs_api_a1_get_job_ids 200 type1 ric1 job1
192 ecs_api_a1_get_job_ids 200 type1 ric2 job2
193 ecs_api_a1_get_job_ids 200 type2 ric3 job3
195 ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
197 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
199 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
200 ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
204 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
206 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
207 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
208 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
209 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
211 ecs_api_edp_get_producer_status 200 prod-c ENABLED
213 ecs_api_a1_delete_job 204 type2 job3
215 ecs_api_edp_delete_producer 204 prod-b
218 prodstub_equal create/prod-d/job8 0
219 prodstub_equal delete/prod-d/job8 0
221 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
223 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
225 ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
227 prodstub_equal create/prod-d/job8 1
228 prodstub_equal delete/prod-d/job8 0
230 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
232 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
234 ecs_api_a1_get_job_ids 404 type4 NOWNER
236 prodstub_equal create/prod-d/job8 1
237 prodstub_equal delete/prod-d/job8 0
245 #### TEST COMPLETE ####
250 auto_clean_containers