Admin batched background migrations and operations APIs return 500 for a database that isn't configured
The admin batched background migrations and background operations APIs accept every name in Gitlab::Database.all_database_names as their database parameter, including databases that aren't configured. For an unconfigured database, such as geo or embedding, every endpoint returns a 500. mr_diff joins that list when !266521 merges.
The endpoints should return a 404, like /admin/migrations does (Database '<name>' is not configured).
Details
base_modelisnilwhen the database isn't configured (lib/api/admin/batched_background_migrations.rb:166), and every endpoint callsbase_model.connection(lines 41, 71, 106 and 146), which raisesNoMethodError.lib/api/admin/batched_background_operations.rbhas the samebase_modelhelper, and its endpoints fail the same way.lib/api/admin/migrations.rb:104already returns a404for the same input.
Edited by 🤖 GitLab Bot 🤖