blob: a61f1bb94915751876384ae65623af6b5ebb91a0 [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
21TC_ONELINE_DESCR="Experimental ECS test case"
22
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020023#App names to include in the test, space separated list
24INCLUDED_IMAGES="ECS PRODSTUB"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020025
26. ../common/testcase_common.sh $@
27. ../common/ecs_api_functions.sh
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020028. ../common/prodstub_api_functions.sh
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020029
30#### TEST BEGIN ####
31
32clean_containers
33
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020034use_ecs_rest_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020035
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020036use_prod_stub_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020037
38start_ecs
39
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020040start_prod_stub
41
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020042set_ecs_debug
43
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020044set_ecs_trace
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020045
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020046# Setup prodstub sim to accept calls for producers, types and jobs
47prodstub_arm_supervision 200 prod-a
48prodstub_arm_supervision 200 prod-b
49prodstub_arm_supervision 200 prod-c
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020050
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020051prodstub_arm_type 200 prod-a type1
52prodstub_arm_type 200 prod-b type2
53prodstub_arm_type 200 prod-b type3
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020054
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020055prodstub_disarm_type 200 prod-b type3
56prodstub_arm_type 200 prod-b type1
57prodstub_disarm_type 200 prod-b type1
58
59prodstub_arm_create 200 prod-a job1
60prodstub_arm_create 200 prod-a job2
61prodstub_arm_create 200 prod-b job3
62
63prodstub_arm_delete 200 prod-a job1
64prodstub_arm_delete 200 prod-a job2
65prodstub_arm_delete 200 prod-b job3
66
67prodstub_arm_create 200 prod-b job4
68prodstub_arm_create 200 prod-a job4
69
70prodstub_arm_create 200 prod-b job5
71prodstub_arm_create 200 prod-a job5
72prodstub_arm_delete 200 prod-a job5
73
74prodstub_arm_create 200 prod-b job6
75
76# ecs status
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020077ecs_api_service_status 200
78
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020079# Initial tests - no config made
80ecs_api_a1_get_type_ids 200 EMPTY
81ecs_api_a1_get_type 404 test-type
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020082
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020083ecs_api_edp_get_type_ids 200 EMPTY
84ecs_api_edp_get_type 404 test-type
85
86ecs_api_edp_get_producer_ids 200 EMPTY
87ecs_api_edp_get_producer 404 test-prod
88
89ecs_api_edp_get_producer_status 404 test-prod
90
91ecs_api_edp_delete_producer 404 test-prod
92
93ecs_api_a1_get_job_ids 404 test-type NOWNER
94ecs_api_a1_get_job_ids 404 test-type test-owner
95
96ecs_api_a1_get_job 404 test-type test-job
97
98ecs_api_a1_get_job_status 404 test-type test-job
99
100ecs_api_a1_delete_job 404 test-type test-job
101
102ecs_api_edp_get_producer_jobs 404 test-prod
103
104
105# Setup of producer/job and test apis
106#prod-a
107ecs_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
108ecs_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
109
110ecs_api_a1_get_type_ids 200 type1
111ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
112
113ecs_api_edp_get_type_ids 200 type1
114ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
115
116ecs_api_edp_get_producer_ids 200 prod-a
117ecs_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
118
119ecs_api_edp_get_producer_status 200 prod-a ENABLED
120
121ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
122ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
123
124ecs_api_a1_get_job 404 type1 test-job
125
126ecs_api_a1_get_job_status 404 type1 test-job
127
128ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
129
130
131#job1 - prod-a
132ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
133
134prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
135
136ecs_api_a1_get_job_ids 200 type1 NOWNER job1
137ecs_api_a1_get_job_ids 200 type1 ric1 job1
138
139ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
140
141ecs_api_a1_get_job_status 200 type1 job1 ENABLED
142
143ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
144
145
146#job2 - prod-a
147ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
148
149prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
150
151ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
152ecs_api_a1_get_job_ids 200 type1 ric1 job1
153ecs_api_a1_get_job_ids 200 type1 ric2 job2
154
155ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
156
157ecs_api_a1_get_job_status 200 type1 job2 ENABLED
158
159ecs_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
160
161
162#prod-b
163ecs_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
164
165ecs_api_a1_get_type_ids 200 type1 type2
166ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
167ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
168
169ecs_api_edp_get_type_ids 200 type1 type2
170ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
171ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
172
173ecs_api_edp_get_producer_ids 200 prod-a prod-b
174ecs_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
175ecs_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
176
177ecs_api_edp_get_producer_status 200 prod-b ENABLED
178
179
180#job3 - prod-b
181ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
182
183prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
184
185ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
186ecs_api_a1_get_job_ids 200 type2 NOWNER job3
187ecs_api_a1_get_job_ids 200 type1 ric1 job1
188ecs_api_a1_get_job_ids 200 type1 ric2 job2
189ecs_api_a1_get_job_ids 200 type2 ric3 job3
190
191ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
192
193ecs_api_a1_get_job_status 200 type2 job3 ENABLED
194
195ecs_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
196ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
197
198
199#prod-c (no types)
200ecs_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
201
202ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
203ecs_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
204ecs_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
205ecs_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
206
207ecs_api_edp_get_producer_status 200 prod-c ENABLED
208
209ecs_api_a1_delete_job 204 type2 job3
210
211ecs_api_edp_delete_producer 204 prod-b
212
213
214check_sndc_logs
215
216check_ecs_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200217
218store_logs END
219
220#### TEST COMPLETE ####
221
222
223print_result
224
225auto_clean_containers