gitlab-qa 6.23.0 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +31 -30
- data/docs/configuring_omnibus.md +208 -0
- data/docs/what_tests_can_be_run.md +12 -8
- data/gitlab-qa.gemspec +6 -4
- data/lib/gitlab/qa.rb +7 -0
- data/lib/gitlab/qa/component/base.rb +2 -2
- data/lib/gitlab/qa/component/elasticsearch.rb +1 -1
- data/lib/gitlab/qa/component/gitlab.rb +21 -24
- data/lib/gitlab/qa/component/internet_tunnel.rb +4 -1
- data/lib/gitlab/qa/component/jira.rb +1 -1
- data/lib/gitlab/qa/component/ldap.rb +1 -1
- data/lib/gitlab/qa/component/mail_hog.rb +1 -1
- data/lib/gitlab/qa/component/minio.rb +3 -11
- data/lib/gitlab/qa/component/postgresql.rb +1 -1
- data/lib/gitlab/qa/component/saml.rb +1 -1
- data/lib/gitlab/qa/component/specs.rb +2 -2
- data/lib/gitlab/qa/docker/engine.rb +28 -3
- data/lib/gitlab/qa/runner.rb +52 -5
- data/lib/gitlab/qa/runtime/env.rb +1 -0
- data/lib/gitlab/qa/runtime/omnibus_configuration.rb +80 -0
- data/lib/gitlab/qa/runtime/omnibus_configurations/default.rb +25 -0
- data/lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb +48 -0
- data/lib/gitlab/qa/runtime/omnibus_configurations/packages.rb +17 -0
- data/lib/gitlab/qa/scenario/cli_commands.rb +3 -3
- data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +1 -3
- data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/actioncable.rb +1 -3
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +4 -5
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +4 -5
- data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/instance_saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +1 -4
- data/lib/gitlab/qa/scenario/test/integration/ldap_no_server.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ldap_tls.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/mattermost.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/mtls.rb +2 -2
- data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb +1 -1
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +12 -9
- data/lib/gitlab/qa/scenario/test/integration/object_storage.rb +0 -64
- data/lib/gitlab/qa/scenario/test/integration/packages.rb +0 -36
data/gitlab-qa.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'gitlab/qa/version'
|
@@ -5,11 +7,11 @@ require 'gitlab/qa/version'
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = 'gitlab-qa'
|
7
9
|
spec.version = Gitlab::QA::VERSION
|
8
|
-
spec.authors = ['
|
9
|
-
spec.email = ['
|
10
|
+
spec.authors = ['GitLab Quality']
|
11
|
+
spec.email = ['gitlab-qa@gmail.com']
|
10
12
|
|
11
13
|
spec.summary = 'Integration tests for GitLab'
|
12
|
-
spec.homepage = 'http://about.gitlab.com'
|
14
|
+
spec.homepage = 'http://about.gitlab.com/'
|
13
15
|
spec.license = 'MIT'
|
14
16
|
|
15
17
|
spec.files = `git ls-files -z`
|
@@ -31,5 +33,5 @@ Gem::Specification.new do |spec|
|
|
31
33
|
spec.add_runtime_dependency 'gitlab', '~> 4.16.1'
|
32
34
|
spec.add_runtime_dependency 'http', '4.3.0'
|
33
35
|
spec.add_runtime_dependency 'nokogiri', '~> 1.10'
|
34
|
-
spec.add_runtime_dependency 'table_print', '1.5.
|
36
|
+
spec.add_runtime_dependency 'table_print', '1.5.7'
|
35
37
|
end
|
data/lib/gitlab/qa.rb
CHANGED
@@ -8,6 +8,13 @@ module Gitlab
|
|
8
8
|
autoload :Env, 'gitlab/qa/runtime/env'
|
9
9
|
autoload :Scenario, 'gitlab/qa/runtime/scenario'
|
10
10
|
autoload :TokenFinder, 'gitlab/qa/runtime/token_finder'
|
11
|
+
autoload :OmnibusConfiguration, 'gitlab/qa/runtime/omnibus_configuration'
|
12
|
+
|
13
|
+
module OmnibusConfigurations
|
14
|
+
autoload :Default, 'gitlab/qa/runtime/omnibus_configurations/default'
|
15
|
+
autoload :Packages, 'gitlab/qa/runtime/omnibus_configurations/packages'
|
16
|
+
autoload :ObjectStorage, 'gitlab/qa/runtime/omnibus_configurations/object_storage'
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
module Scenario
|
@@ -78,7 +78,7 @@ module Gitlab
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def start # rubocop:disable Metrics/AbcSize
|
81
|
-
docker.run(image, tag) do |command|
|
81
|
+
docker.run(image: image, tag: tag) do |command|
|
82
82
|
command << "-d"
|
83
83
|
command << "--name #{name}"
|
84
84
|
command << "--net #{network}"
|
@@ -129,7 +129,7 @@ module Gitlab
|
|
129
129
|
def pull
|
130
130
|
return if Runtime::Env.skip_pull?
|
131
131
|
|
132
|
-
docker.pull(image, tag)
|
132
|
+
docker.pull(image: image, tag: tag)
|
133
133
|
end
|
134
134
|
|
135
135
|
def process_exec_commands
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'securerandom'
|
2
4
|
require 'net/http'
|
3
5
|
require 'uri'
|
@@ -10,39 +12,36 @@ module Gitlab
|
|
10
12
|
class Gitlab < Base
|
11
13
|
extend Forwardable
|
12
14
|
|
13
|
-
attr_reader :release
|
14
|
-
attr_accessor :tls, :
|
15
|
+
attr_reader :release, :omnibus_configuration
|
16
|
+
attr_accessor :tls, :skip_availability_check, :runner_network
|
15
17
|
attr_writer :name, :relative_path
|
16
18
|
|
17
19
|
def_delegators :release, :tag, :image, :edition
|
18
20
|
|
19
|
-
AUTHORITY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/authority'
|
20
|
-
GITLAB_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitlab'
|
21
|
-
GITALY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitaly'
|
21
|
+
AUTHORITY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/authority', __dir__)
|
22
|
+
GITLAB_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitlab', __dir__)
|
23
|
+
GITALY_CERTIFICATES_PATH = File.expand_path('../../../../tls_certificates/gitaly', __dir__)
|
22
24
|
|
23
|
-
SSL_PATH = '/etc/gitlab/ssl'
|
24
|
-
TRUSTED_PATH = '/etc/gitlab/trusted-certs'
|
25
|
+
SSL_PATH = '/etc/gitlab/ssl'
|
26
|
+
TRUSTED_PATH = '/etc/gitlab/trusted-certs'
|
25
27
|
|
26
28
|
def initialize
|
27
29
|
super
|
28
30
|
|
29
|
-
@disable_animations = true
|
30
31
|
@skip_availability_check = false
|
31
32
|
|
32
33
|
@volumes[GITLAB_CERTIFICATES_PATH] = SSL_PATH
|
33
34
|
@volumes[AUTHORITY_CERTIFICATES_PATH] = TRUSTED_PATH
|
34
35
|
|
35
|
-
|
36
|
-
end
|
36
|
+
@omnibus_configuration ||= Runtime::OmnibusConfiguration.new(Runtime::Scenario.omnibus_configuration)
|
37
37
|
|
38
|
-
|
39
|
-
@environment['GITLAB_OMNIBUS_CONFIG'] = config.tr("\n", ' ')
|
38
|
+
self.release = 'CE'
|
40
39
|
end
|
41
40
|
|
42
41
|
def set_formless_login_token
|
43
42
|
return if Runtime::Env.gitlab_qa_formless_login_token.to_s.strip.empty?
|
44
43
|
|
45
|
-
@
|
44
|
+
@omnibus_configuration << "gitlab_rails['env'] = { 'GITLAB_QA_FORMLESS_LOGIN_TOKEN' => '#{Runtime::Env.gitlab_qa_formless_login_token}' }"
|
46
45
|
end
|
47
46
|
|
48
47
|
def elastic_url=(url)
|
@@ -95,23 +94,13 @@ module Gitlab
|
|
95
94
|
end
|
96
95
|
|
97
96
|
def prepare_gitlab_omnibus_config
|
98
|
-
setup_disable_animations if disable_animations
|
99
97
|
set_formless_login_token
|
100
|
-
setup_application_settings_cache_expiry
|
101
|
-
end
|
102
|
-
|
103
|
-
def setup_disable_animations
|
104
|
-
@environment['GITLAB_OMNIBUS_CONFIG'] = "gitlab_rails['gitlab_disable_animations'] = true; #{@environment['GITLAB_OMNIBUS_CONFIG'] || ''}"
|
105
|
-
end
|
106
|
-
|
107
|
-
def setup_application_settings_cache_expiry
|
108
|
-
@environment['GITLAB_OMNIBUS_CONFIG'] = "gitlab_rails['application_settings_cache_seconds'] = 0; #{@environment['GITLAB_OMNIBUS_CONFIG'] || ''}"
|
109
98
|
end
|
110
99
|
|
111
100
|
def start # rubocop:disable Metrics/AbcSize
|
112
101
|
ensure_configured!
|
113
102
|
|
114
|
-
docker.run(image, tag) do |command|
|
103
|
+
docker.run(image: image, tag: tag) do |command|
|
115
104
|
command << "-d -p #{port}"
|
116
105
|
command << "--name #{name}"
|
117
106
|
command << "--net #{network}"
|
@@ -135,6 +124,8 @@ module Gitlab
|
|
135
124
|
end
|
136
125
|
|
137
126
|
def reconfigure
|
127
|
+
setup_omnibus
|
128
|
+
|
138
129
|
@docker.attach(name) do |line, wait|
|
139
130
|
puts line
|
140
131
|
# TODO, workaround which allows to detach from the container
|
@@ -170,6 +161,12 @@ module Gitlab
|
|
170
161
|
raise 'Please configure an instance first!' unless [name, release, network].all?
|
171
162
|
end
|
172
163
|
|
164
|
+
def setup_omnibus
|
165
|
+
@docker.write_files(name) do |f|
|
166
|
+
f.write('/etc/gitlab/gitlab.rb', @omnibus_configuration.to_s)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
173
170
|
class Availability
|
174
171
|
def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
|
175
172
|
@docker = Docker::Engine.new
|
@@ -49,7 +49,10 @@ module Gitlab
|
|
49
49
|
def start
|
50
50
|
raise "Must set gitlab_hostname" unless @gitlab_hostname
|
51
51
|
|
52
|
-
@docker.run(
|
52
|
+
@docker.run(
|
53
|
+
image: DOCKER_IMAGE,
|
54
|
+
tag: DOCKER_IMAGE_TAG,
|
55
|
+
args: ["-o StrictHostKeyChecking=no -N -R #{subdomain}:#{@gitlab_hostname}:80 #{ENV.fetch('TUNNEL_SSH_USER')}@#{tunnel_server_hostname}"]) do |command|
|
53
56
|
command << '-d '
|
54
57
|
command << "--name #{name}"
|
55
58
|
command << "--net #{network}"
|
@@ -63,7 +63,7 @@ module Gitlab
|
|
63
63
|
def start
|
64
64
|
# copy-service needed for bootstraping LDAP user:
|
65
65
|
# https://github.com/osixia/docker-openldap#seed-ldap-database-with-ldif
|
66
|
-
docker.run(image, tag, '--copy-service') do |command|
|
66
|
+
docker.run(image: image, tag: tag, args: ['--copy-service']) do |command|
|
67
67
|
command << '-d '
|
68
68
|
command << "--name #{name}"
|
69
69
|
command << "--net #{network}"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'securerandom'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'yaml'
|
3
4
|
|
4
5
|
# This component sets up the Minio (https://hub.docker.com/r/minio/minio)
|
5
6
|
# image with the proper configuration for GitLab users to use object storage.
|
@@ -23,18 +24,12 @@ module Gitlab
|
|
23
24
|
@buckets = []
|
24
25
|
end
|
25
26
|
|
26
|
-
def instance
|
27
|
-
raise 'Please provide a block!' unless block_given?
|
28
|
-
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
27
|
def add_bucket(name)
|
33
28
|
@buckets << name
|
34
29
|
end
|
35
30
|
|
36
31
|
def to_config
|
37
|
-
|
32
|
+
YAML.safe_load <<~CFG
|
38
33
|
provider: AWS
|
39
34
|
aws_access_key_id: #{AWS_ACCESS_KEY}
|
40
35
|
aws_secret_access_key: #{AWS_SECRET_KEY}
|
@@ -43,9 +38,6 @@ module Gitlab
|
|
43
38
|
endpoint: http://#{hostname}:#{port}
|
44
39
|
path_style: true
|
45
40
|
CFG
|
46
|
-
|
47
|
-
# Quotes get eaten up when the string is set in the environment
|
48
|
-
config.to_s.gsub('"', '\\"')
|
49
41
|
end
|
50
42
|
|
51
43
|
private
|
@@ -78,7 +70,7 @@ module Gitlab
|
|
78
70
|
def start # rubocop:disable Metrics/AbcSize
|
79
71
|
# --compat needed until https://gitlab.com/gitlab-org/gitlab-workhorse/issues/210
|
80
72
|
# is resolved
|
81
|
-
docker.run(image, tag, "server", "--compat", DATA_DIR) do |command|
|
73
|
+
docker.run(image: image, tag: tag, args: ["server", "--compat", DATA_DIR]) do |command|
|
82
74
|
command << '-d '
|
83
75
|
command << "--name #{name}"
|
84
76
|
command << "--net #{network}"
|
@@ -23,7 +23,7 @@ module Gitlab
|
|
23
23
|
|
24
24
|
@docker.login(**release.login_params) if release.login_params
|
25
25
|
|
26
|
-
@docker.pull(qa_image) unless Runtime::Env.skip_pull?
|
26
|
+
@docker.pull(image: qa_image) unless Runtime::Env.skip_pull?
|
27
27
|
|
28
28
|
puts "Running test suite `#{suite}` for #{release.project_name}"
|
29
29
|
|
@@ -43,7 +43,7 @@ module Gitlab
|
|
43
43
|
feature_flag_sets << [] unless feature_flag_sets.any?
|
44
44
|
|
45
45
|
feature_flag_sets.each do |feature_flag_set|
|
46
|
-
@docker.run(qa_image,
|
46
|
+
@docker.run(image: qa_image, args: [suite, *args_with_flags(args, feature_flag_set)]) do |command|
|
47
47
|
command << "-t --rm --net=#{network || 'bridge'}"
|
48
48
|
|
49
49
|
env.merge(Runtime::Env.variables).each do |key, value|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module QA
|
3
5
|
module Docker
|
@@ -13,11 +15,11 @@ module Gitlab
|
|
13
15
|
Docker::Command.execute(%(login --username "#{username}" --password "#{password}" #{registry}), mask_secrets: password)
|
14
16
|
end
|
15
17
|
|
16
|
-
def pull(image
|
18
|
+
def pull(image:, tag: nil)
|
17
19
|
Docker::Command.execute("pull #{full_image_name(image, tag)}")
|
18
20
|
end
|
19
21
|
|
20
|
-
def run(image
|
22
|
+
def run(image:, tag: nil, args: [])
|
21
23
|
Docker::Command.new('run').tap do |command|
|
22
24
|
yield command if block_given?
|
23
25
|
|
@@ -36,10 +38,33 @@ module Gitlab
|
|
36
38
|
false
|
37
39
|
end
|
38
40
|
|
41
|
+
# Write to file(s) in the Docker container specified by @param name
|
42
|
+
# @param name The name of the Docker Container
|
43
|
+
# @example
|
44
|
+
# engine.write_files('gitlab-abc123') do |files|
|
45
|
+
# files.append('/etc/hosts', '127.0.0.1 localhost')
|
46
|
+
# files.write('/opt/other', <<~TEXT
|
47
|
+
# This is content
|
48
|
+
# That goes within /opt/other
|
49
|
+
# TEXT)
|
50
|
+
def write_files(name)
|
51
|
+
exec(name, yield(
|
52
|
+
Class.new do
|
53
|
+
def self.write(file, contents)
|
54
|
+
%(echo "#{contents}" > #{file};)
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.append(file, contents)
|
58
|
+
%(echo "#{contents}" >> #{file};)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
))
|
62
|
+
end
|
63
|
+
|
39
64
|
def exec(name, command)
|
40
65
|
cmd = ['exec']
|
41
66
|
cmd << '--privileged' if privileged_command?(command)
|
42
|
-
Docker::Command.execute(
|
67
|
+
Docker::Command.execute(%(#{cmd.join(' ')} #{name} bash -c "#{command.gsub('"', '\\"')}"))
|
43
68
|
end
|
44
69
|
|
45
70
|
def read_file(image, tag, path, &block)
|
data/lib/gitlab/qa/runner.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'optparse'
|
4
|
+
require 'active_support/inflector'
|
2
5
|
|
3
6
|
module Gitlab
|
4
7
|
module QA
|
@@ -8,6 +11,11 @@ module Gitlab
|
|
8
11
|
Runtime::Scenario.define(:teardown, true)
|
9
12
|
Runtime::Scenario.define(:run_tests, true)
|
10
13
|
Runtime::Scenario.define(:qa_image, Runtime::Env.qa_image) if Runtime::Env.qa_image
|
14
|
+
Runtime::Scenario.define(:omnibus_configuration, Runtime::OmnibusConfiguration.new)
|
15
|
+
|
16
|
+
# Omnibus Configurators specified by flags
|
17
|
+
@active_configurators = []
|
18
|
+
@omnibus_configurations = %w[default] # always load default configuration
|
11
19
|
|
12
20
|
@options = OptionParser.new do |opts|
|
13
21
|
opts.banner = 'Usage: gitlab-qa [options] Scenario URL [[--] path] [rspec_options]'
|
@@ -31,6 +39,12 @@ module Gitlab
|
|
31
39
|
exit
|
32
40
|
end
|
33
41
|
|
42
|
+
opts.on('--omnibus-config config1[,config2,...]', 'Use Omnibus Configuration package') do |configuration|
|
43
|
+
configuration.split(',').map do |config|
|
44
|
+
@omnibus_configurations << config
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
34
48
|
opts.on_tail('-h', '--help', 'Show the usage') do
|
35
49
|
puts opts
|
36
50
|
exit
|
@@ -44,21 +58,54 @@ module Gitlab
|
|
44
58
|
end
|
45
59
|
|
46
60
|
args.reject! { |arg| gitlab_qa_options.include?(arg) }
|
47
|
-
|
48
61
|
if args.size >= 1
|
49
|
-
|
50
|
-
|
51
|
-
|
62
|
+
load_omnibus_configurations
|
63
|
+
|
64
|
+
begin
|
65
|
+
@active_configurators.compact.each do |configurator|
|
66
|
+
configurator.instance(skip_teardown: true)
|
67
|
+
end
|
68
|
+
|
69
|
+
Scenario
|
70
|
+
.const_get(args.shift)
|
71
|
+
.perform(*args)
|
72
|
+
ensure
|
73
|
+
@active_configurators.compact.each(&:teardown)
|
74
|
+
end
|
52
75
|
else
|
53
76
|
puts @options
|
54
77
|
exit 1
|
55
78
|
end
|
56
79
|
end
|
57
|
-
# rubocop:enable Metrics/AbcSize
|
58
80
|
|
59
81
|
def self.gitlab_qa_options
|
60
82
|
@gitlab_qa_options ||= @options.top.list.map(&:long).flatten
|
61
83
|
end
|
84
|
+
|
85
|
+
def self.load_omnibus_configurations
|
86
|
+
# OmnibusConfiguration::Test => --test
|
87
|
+
# OmnibusConfiguration::HelloThere => --hello_there
|
88
|
+
@omnibus_configurations.uniq.each do |config|
|
89
|
+
Runtime::OmnibusConfigurations.const_get(config.camelize).new.tap do |configurator|
|
90
|
+
@active_configurators << configurator.prepare
|
91
|
+
|
92
|
+
# */etc/gitlab/gitlab.rb*
|
93
|
+
# -----------------------
|
94
|
+
# # Runtime::OmnibusConfiguration::Packages
|
95
|
+
# gitlab_rails['packages_enabled'] = true
|
96
|
+
Runtime::Scenario.omnibus_configuration << "# #{configurator.class.name}"
|
97
|
+
|
98
|
+
# Load the configuration
|
99
|
+
configurator.configuration.split("\n").each { |c| Runtime::Scenario.omnibus_configuration << c }
|
100
|
+
end
|
101
|
+
rescue NameError
|
102
|
+
raise <<~ERROR
|
103
|
+
Invalid Omnibus Configuration `#{config}`.
|
104
|
+
Possible configurations: #{Runtime::OmnibusConfigurations.constants.map { |c| c.to_s.underscore }.join(',')}"
|
105
|
+
ERROR
|
106
|
+
end
|
107
|
+
end
|
62
108
|
end
|
109
|
+
# rubocop:enable Metrics/AbcSize
|
63
110
|
end
|
64
111
|
end
|