@@ -180,32 +180,59 @@ end
180
180
181
181
local role_cfg_error_cases = {
182
182
wrong_section_type = {
183
- args = {crud = ' enabled' },
184
- err = ' Configuration \\\" crud\\\" section must be a table' ,
183
+ args = ' enabled' ,
184
+ err_cartridge = ' Configuration \\\" crud\\\" section must be a table' ,
185
+ err_tarantool3 = ' Wrong config for role roles.crud-router: TarantoolRoleConfigurationError: ' ..
186
+ ' roles_cfg must be a table' ,
185
187
},
186
188
wrong_structure = {
187
- args = {crud = {crud = {stats = true }}},
188
- err = ' \\\" crud\\\" section is already presented as a name of \\\" crud.yml\\\" , ' ..
189
- ' do not use it as a top-level section name' ,
189
+ args = {crud = {stats = true }},
190
+ err_cartridge = ' \\\" crud\\\" section is already presented as a name of \\\" crud.yml\\\" , ' ..
191
+ ' do not use it as a top-level section name' ,
192
+ err_tarantool3 = ' Wrong config for role roles.crud-router: TarantoolRoleConfigurationError: ' ..
193
+ ' Unknown field \" crud\" ' ,
190
194
},
191
195
wrong_type = {
192
- args = {crud = {stats = ' enabled' }},
193
- err = ' Invalid crud configuration field \\\" stats\\\" type: expected boolean, got string' ,
196
+ args = {stats = ' enabled' },
197
+ err_cartridge = ' Invalid crud configuration field \\\" stats\\\" type: expected boolean, got string' ,
198
+ err_tarantool3 = ' Wrong config for role roles.crud-router: TarantoolRoleConfigurationError: ' ..
199
+ ' Invalid \" stats\" field type: expected boolean, got string' ,
194
200
},
195
201
wrong_value = {
196
- args = {crud = {stats_driver = ' prometheus' }},
197
- err = ' Invalid crud configuration field \\\" stats_driver\\\" value: \\\" prometheus\\\" is not supported' ,
202
+ args = {stats_driver = ' prometheus' },
203
+ err_cartridge = ' Invalid crud configuration field \\\" stats_driver\\\" value: ' ..
204
+ ' \\\" prometheus\\\" is not supported' ,
205
+ err_tarantool3 = ' Wrong config for role roles.crud-router: TarantoolRoleConfigurationError: ' ..
206
+ ' Invalid \" stats_driver\" field value: \" prometheus\" is not supported' ,
198
207
}
199
208
}
200
209
201
210
for name , case in pairs (role_cfg_error_cases ) do
202
- group [' test_role_cfg_ ' .. name ] = function (g )
211
+ group [' test_cartridge_role_cfg_ ' .. name ] = function (g )
203
212
helpers .skip_not_cartridge_backend (g .params .backend )
204
213
local success , error = pcall (function ()
205
- g .router :upload_config (case .args )
214
+ g .router :upload_config ({
215
+ crud = case .args ,
216
+ })
206
217
end )
207
218
208
219
t .assert_equals (success , false )
209
- t .assert_str_contains (error .response .body , case .err )
220
+ t .assert_str_contains (error .response .body , case .err_cartridge )
221
+ end
222
+
223
+ group [' test_tarantool3_role_cfg_' .. name ] = function (g )
224
+ helpers .skip_if_not_config_backend (g .params .backend )
225
+ local success , error = pcall (function ()
226
+ local cfg = g .cluster :cfg ()
227
+
228
+ cfg .groups [' routers' ].roles_cfg = {
229
+ [' roles.crud-router' ] = case .args ,
230
+ }
231
+
232
+ g .cluster :reload_config (cfg )
233
+ end )
234
+
235
+ t .assert_equals (success , false )
236
+ t .assert_str_contains (tostring (error ), case .err_tarantool3 )
210
237
end
211
238
end
0 commit comments