Skip to content
代码片段 群组 项目
未验证 提交 3a5fdc96 编辑于 作者: Manoj M J's avatar Manoj M J 提交者: GitLab
浏览文件

Housekeeper: Improve message on completion

上级 3e41b355
No related branches found
No related tags found
1 合并请求!2419Fix TanukiBot spec relying on outdated code
...@@ -30,7 +30,7 @@ def initialize(max_mrs: 1, dry_run: false, keeps: nil, filter_identifiers: [], t ...@@ -30,7 +30,7 @@ def initialize(max_mrs: 1, dry_run: false, keeps: nil, filter_identifiers: [], t
end end
def run def run
created = 0 mrs_created_count = 0
git.with_clean_state do git.with_clean_state do
@keeps.each do |keep_class| @keeps.each do |keep_class|
...@@ -80,14 +80,27 @@ def run ...@@ -80,14 +80,27 @@ def run
create(change, branch_name) unless @dry_run create(change, branch_name) unless @dry_run
created += 1 mrs_created_count += 1
break if created >= @max_mrs break if mrs_created_count >= @max_mrs
end end
break if created >= @max_mrs break if mrs_created_count >= @max_mrs
end end
end end
puts "Housekeeper created #{created} MRs" print_completion_message(mrs_created_count)
end
def print_completion_message(mrs_created_count)
mr_count_string = "#{mrs_created_count} #{'MR'.pluralize(mrs_created_count)}"
completion_message = if @dry_run
"Dry run complete. Housekeeper would have created #{mr_count_string} on an actual run."
else
"Housekeeper created #{mr_count_string}."
end
puts completion_message.yellowish
puts
end end
def add_standard_change_data(change) def add_standard_change_data(change)
......
...@@ -269,6 +269,16 @@ ...@@ -269,6 +269,16 @@
described_class.new(max_mrs: 2, keeps: [fake_keep]).run described_class.new(max_mrs: 2, keeps: [fake_keep]).run
end end
end end
context 'on dry run' do
context 'for completion message' do
it 'prints the expected message' do
expect do
described_class.new(max_mrs: 1, keeps: [fake_keep], dry_run: true).run
end.to output(/Dry run complete. Housekeeper would have created 1 MR on an actual run./).to_stdout
end
end
end
end end
describe '#housekeeper_fork_project_id' do describe '#housekeeper_fork_project_id' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册