@@ -180,32 +180,59 @@ end
180180
181181local role_cfg_error_cases = {
182182 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' ,
185187 },
186188 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\" ' ,
190194 },
191195 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' ,
194200 },
195201 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' ,
198207 }
199208}
200209
201210for 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 )
203212 helpers .skip_not_cartridge_backend (g .params .backend )
204213 local success , error = pcall (function ()
205- g .router :upload_config (case .args )
214+ g .router :upload_config ({
215+ crud = case .args ,
216+ })
206217 end )
207218
208219 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 )
210237 end
211238end
0 commit comments