Skip to content
代码片段 群组 项目
提交 cb9684c5 编辑于 作者: Thong Kuah's avatar Thong Kuah
浏览文件

Allow script to run in multi-database mode

Unfortunately we cannot run tests from this script as it holds on to
database connections. So we remove automatic test running, and let
developer run tests themselves
上级 dc09d2b8
No related branches found
No related tags found
无相关合并请求
......@@ -40,10 +40,6 @@ unless system("git diff --quiet")
raise "There are uncommitted changes. Commit to continue."
end
if Gitlab::Database.database_base_models.many?
raise 'Cannot run in multiple-databases mode. Use only `main:` in `config/database.yml`.'
end
puts "Re-creating current test database"
ActiveRecord::Tasks::DatabaseTasks.drop_current
ActiveRecord::Tasks::DatabaseTasks.create_current
......@@ -218,30 +214,6 @@ def add_test_to_specs(definition)
insert_line = lines.count - 1
lines.insert(insert_line, "\n", *spec_test.lines)
File.write(spec_path, lines.join(""))
# find a matching line
test_lines = (1..lines.count).select do |line|
lines[line-1].include?("it_behaves_like 'cleanup by a loose foreign key' do")
end.join(":")
loop do
if exec_cmd("bin/rspec", "#{spec_path}:#{test_lines}")
puts "Test seems fine?"
break
end
puts "--------------------------------------------------"
puts "Test failed:"
puts "Edit: vim #{spec_path} (lines #{test_lines})"
puts "Re-run: bin/rspec #{spec_path}:#{test_lines}"
puts "--------------------------------------------------"
puts "Running bash. To exit do 'Ctrl-D' to re-run, or do 'Ctrl-C' to break (and ignore failure)."
puts
unless exec_cmd("bash")
break
end
end
end
def update_no_cross_db_foreign_keys_spec(definition)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册