Skip to content
代码片段 群组 项目
提交 45c73b72 编辑于 作者: Dylan Griffith's avatar Dylan Griffith
浏览文件

Add simple integration test to just run housekeeper

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181613 you can
see it was easy to accidentally completely break housekeeper as there is
no integration test for it. That kind of problem (missing a `require`)
cannot be spotted by running RSpec because the order dependence of tests
might (and did) mask the issue.

Adding an integration test here is an easy way to reduce the risk of this
happening again.
上级 62956efa
No related branches found
No related tags found
无相关合并请求
......@@ -2,3 +2,15 @@ include:
- local: gems/gem.gitlab-ci.yml
inputs:
gem_name: "gitlab-housekeeper"
gitlab-housekeeper-integration-test:
script:
- mkdir -p keeps
- cp spec/fixtures/pretty_useless_keep.rb keeps/
- git init --initial-branch=master
- 'git config --global user.email "test@example.com"'
- 'git config --global user.name "Test User"'
- 'git commit --allow-empty -m "Initial commit"'
- bundle exec bin/gitlab-housekeeper -k Keeps::PrettyUselessKeep -d
- bundle exec bin/gitlab-housekeeper -k Keeps::PrettyUselessKeep -d -m 3
- bundle exec bin/gitlab-housekeeper -k Keeps::PrettyUselessKeep -d -m 3 --filter-identifiers=2
......@@ -90,7 +90,7 @@ module Keeps
This MR makes a new file #{file_name}
MARKDOWN
change.labels = %w(type::feature)
change.labels = %w[type::feature]
change.changed_files = [file_name]
......
#!/usr/bin/env ruby
$:.unshift File.expand_path("../lib", __dir__)
require "optparse"
require 'gitlab/housekeeper'
......
# frozen_string_literal: true
module Keeps
class PrettyUselessKeep < ::Gitlab::Housekeeper::Keep
def each_change
(1..3).each do |i|
file_name = "new_file#{i}.txt"
`touch #{file_name}`
change = ::Gitlab::Housekeeper::Change.new
change.identifiers = [self.class.name.demodulize, "new_file#{i}"]
change.title = "Make new file #{file_name}"
change.description = <<~MARKDOWN
## New files
This MR makes a new file #{file_name}
MARKDOWN
change.labels = %w[type::feature]
change.changed_files = [file_name]
# to push changes without triggering a pipeline.
change.push_options.ci_skip = true
yield(change)
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册