BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 1 | #!/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 | |
| 21 | TC_ONELINE_DESCR="Experimental ECS test case" |
| 22 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 23 | #App names to include in the test, space separated list |
| 24 | INCLUDED_IMAGES="ECS PRODSTUB" |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 25 | |
| 26 | . ../common/testcase_common.sh $@ |
| 27 | . ../common/ecs_api_functions.sh |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 28 | . ../common/prodstub_api_functions.sh |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 29 | |
| 30 | #### TEST BEGIN #### |
| 31 | |
| 32 | clean_containers |
| 33 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 34 | use_ecs_rest_http |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 35 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 36 | use_prod_stub_http |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 37 | |
| 38 | start_ecs |
| 39 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 40 | start_prod_stub |
| 41 | |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 42 | set_ecs_debug |
| 43 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 44 | set_ecs_trace |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 45 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 46 | # Setup prodstub sim to accept calls for producers, types and jobs |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 47 | prodstub_arm_producer 200 prod-a |
| 48 | prodstub_arm_producer 200 prod-b |
| 49 | prodstub_arm_producer 200 prod-c |
| 50 | |
| 51 | prodstub_arm_producer 200 prod-d |
| 52 | prodstub_arm_type 200 prod-d type4 |
| 53 | prodstub_arm_job_create 200 prod-d job8 |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 54 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 55 | prodstub_arm_type 200 prod-a type1 |
| 56 | prodstub_arm_type 200 prod-b type2 |
| 57 | prodstub_arm_type 200 prod-b type3 |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 58 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 59 | prodstub_disarm_type 200 prod-b type3 |
| 60 | prodstub_arm_type 200 prod-b type1 |
| 61 | prodstub_disarm_type 200 prod-b type1 |
| 62 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 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 |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 66 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 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 |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 70 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 71 | prodstub_arm_job_create 200 prod-b job4 |
| 72 | prodstub_arm_job_create 200 prod-a job4 |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 73 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 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 |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 77 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 78 | prodstub_arm_job_create 200 prod-b job6 |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 79 | |
| 80 | # ecs status |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 81 | ecs_api_service_status 200 |
| 82 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 83 | # Initial tests - no config made |
| 84 | ecs_api_a1_get_type_ids 200 EMPTY |
| 85 | ecs_api_a1_get_type 404 test-type |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 86 | |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 87 | ecs_api_edp_get_type_ids 200 EMPTY |
| 88 | ecs_api_edp_get_type 404 test-type |
| 89 | |
| 90 | ecs_api_edp_get_producer_ids 200 EMPTY |
| 91 | ecs_api_edp_get_producer 404 test-prod |
| 92 | |
| 93 | ecs_api_edp_get_producer_status 404 test-prod |
| 94 | |
| 95 | ecs_api_edp_delete_producer 404 test-prod |
| 96 | |
| 97 | ecs_api_a1_get_job_ids 404 test-type NOWNER |
| 98 | ecs_api_a1_get_job_ids 404 test-type test-owner |
| 99 | |
| 100 | ecs_api_a1_get_job 404 test-type test-job |
| 101 | |
| 102 | ecs_api_a1_get_job_status 404 test-type test-job |
| 103 | |
| 104 | ecs_api_a1_delete_job 404 test-type test-job |
| 105 | |
| 106 | ecs_api_edp_get_producer_jobs 404 test-prod |
| 107 | |
| 108 | |
| 109 | # Setup of producer/job and test apis |
| 110 | #prod-a |
| 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 |
| 113 | |
| 114 | ecs_api_a1_get_type_ids 200 type1 |
| 115 | ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json |
| 116 | |
| 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 |
| 119 | |
| 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 |
| 122 | |
| 123 | ecs_api_edp_get_producer_status 200 prod-a ENABLED |
| 124 | |
| 125 | ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY |
| 126 | ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY |
| 127 | |
| 128 | ecs_api_a1_get_job 404 type1 test-job |
| 129 | |
| 130 | ecs_api_a1_get_job_status 404 type1 test-job |
| 131 | |
| 132 | ecs_api_edp_get_producer_jobs 200 prod-a EMPTY |
| 133 | |
| 134 | |
| 135 | #job1 - prod-a |
| 136 | ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json |
| 137 | |
| 138 | prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json |
| 139 | |
| 140 | ecs_api_a1_get_job_ids 200 type1 NOWNER job1 |
| 141 | ecs_api_a1_get_job_ids 200 type1 ric1 job1 |
| 142 | |
| 143 | ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json |
| 144 | |
| 145 | ecs_api_a1_get_job_status 200 type1 job1 ENABLED |
| 146 | |
| 147 | ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json |
| 148 | |
| 149 | |
| 150 | #job2 - prod-a |
| 151 | ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json |
| 152 | |
| 153 | prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json |
| 154 | |
| 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 |
| 158 | |
| 159 | ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json |
| 160 | |
| 161 | ecs_api_a1_get_job_status 200 type1 job2 ENABLED |
| 162 | |
| 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 |
| 164 | |
| 165 | |
| 166 | #prod-b |
| 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 |
| 168 | |
| 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 |
| 172 | |
| 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 |
| 176 | |
| 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 |
| 180 | |
| 181 | ecs_api_edp_get_producer_status 200 prod-b ENABLED |
| 182 | |
| 183 | |
| 184 | #job3 - prod-b |
| 185 | ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json |
| 186 | |
| 187 | prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json |
| 188 | |
| 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 |
| 194 | |
| 195 | ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json |
| 196 | |
| 197 | ecs_api_a1_get_job_status 200 type2 job3 ENABLED |
| 198 | |
| 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 |
| 201 | |
| 202 | |
| 203 | #prod-c (no types) |
| 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 |
| 205 | |
| 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 |
| 210 | |
| 211 | ecs_api_edp_get_producer_status 200 prod-c ENABLED |
| 212 | |
| 213 | ecs_api_a1_delete_job 204 type2 job3 |
| 214 | |
| 215 | ecs_api_edp_delete_producer 204 prod-b |
| 216 | |
| 217 | |
BjornMagnussonXA | 39ad50e | 2020-10-22 09:55:25 +0200 | [diff] [blame] | 218 | prodstub_equal create/prod-d/job8 0 |
| 219 | prodstub_equal delete/prod-d/job8 0 |
| 220 | |
| 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 |
| 222 | |
| 223 | ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY |
| 224 | |
| 225 | ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json |
| 226 | |
| 227 | prodstub_equal create/prod-d/job8 1 |
| 228 | prodstub_equal delete/prod-d/job8 0 |
| 229 | |
| 230 | ecs_api_a1_get_job_ids 200 type4 NOWNER job8 |
| 231 | |
| 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 |
| 233 | |
| 234 | ecs_api_a1_get_job_ids 404 type4 NOWNER |
| 235 | |
| 236 | prodstub_equal create/prod-d/job8 1 |
| 237 | prodstub_equal delete/prod-d/job8 0 |
| 238 | |
| 239 | check_sdnc_logs |
BjornMagnussonXA | f38e1e8 | 2020-10-11 23:05:02 +0200 | [diff] [blame] | 240 | |
| 241 | check_ecs_logs |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 242 | |
| 243 | store_logs END |
| 244 | |
| 245 | #### TEST COMPLETE #### |
| 246 | |
| 247 | |
| 248 | print_result |
| 249 | |
| 250 | auto_clean_containers |