gitlab-qa 5.13.0 → 5.13.5
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/docs/what_tests_can_be_run.md +50 -54
- data/lib/gitlab/qa.rb +2 -0
- data/lib/gitlab/qa/component/base.rb +131 -0
- data/lib/gitlab/qa/component/elasticsearch.rb +5 -32
- data/lib/gitlab/qa/component/gitlab.rb +15 -77
- data/lib/gitlab/qa/component/internet_tunnel.rb +6 -29
- data/lib/gitlab/qa/component/jira.rb +5 -44
- data/lib/gitlab/qa/component/ldap.rb +8 -51
- data/lib/gitlab/qa/component/mail_hog.rb +5 -44
- data/lib/gitlab/qa/component/minio.rb +9 -34
- data/lib/gitlab/qa/component/postgresql.rb +4 -36
- data/lib/gitlab/qa/component/saml.rb +5 -54
- data/lib/gitlab/qa/component/specs.rb +1 -10
- data/lib/gitlab/qa/docker/engine.rb +8 -0
- data/lib/gitlab/qa/release.rb +25 -0
- data/lib/gitlab/qa/runtime/env.rb +25 -1
- data/lib/gitlab/qa/runtime/scenario.rb +36 -0
- data/lib/gitlab/qa/scenario/test/instance/any.rb +1 -1
- data/lib/gitlab/qa/scenario/test/instance/geo.rb +1 -1
- data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +1 -1
- data/lib/gitlab/qa/scenario/test/instance/smoke.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/gitaly_ha.rb +5 -5
- data/lib/gitlab/qa/scenario/test/integration/jira.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/packages.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -2
- data/lib/gitlab/qa/scenario/test/integration/saml.rb +1 -1
- data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
- data/lib/gitlab/qa/scenario/test/omnibus/update.rb +2 -2
- data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -1
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +4 -2
@@ -6,22 +6,9 @@ require 'securerandom'
|
|
6
6
|
module Gitlab
|
7
7
|
module QA
|
8
8
|
module Component
|
9
|
-
class SAML
|
10
|
-
|
11
|
-
|
12
|
-
SAML_IMAGE = 'jamedjo/test-saml-idp'.freeze
|
13
|
-
SAML_IMAGE_TAG = 'latest'.freeze
|
14
|
-
|
15
|
-
attr_reader :docker
|
16
|
-
attr_accessor :volumes, :network, :environment
|
17
|
-
attr_writer :name
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@docker = Docker::Engine.new
|
21
|
-
@environment = {}
|
22
|
-
@volumes = {}
|
23
|
-
@network_aliases = []
|
24
|
-
end
|
9
|
+
class SAML < Base
|
10
|
+
DOCKER_IMAGE = 'jamedjo/test-saml-idp'.freeze
|
11
|
+
DOCKER_IMAGE_TAG = 'latest'.freeze
|
25
12
|
|
26
13
|
def set_entity_id(entity_id)
|
27
14
|
@environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
|
@@ -31,18 +18,10 @@ module Gitlab
|
|
31
18
|
@environment['SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE'] = assertion_con_service
|
32
19
|
end
|
33
20
|
|
34
|
-
def add_network_alias(name)
|
35
|
-
@network_aliases.push(name)
|
36
|
-
end
|
37
|
-
|
38
21
|
def name
|
39
22
|
@name ||= "saml-qa-idp"
|
40
23
|
end
|
41
24
|
|
42
|
-
def hostname
|
43
|
-
"#{name}.#{network}"
|
44
|
-
end
|
45
|
-
|
46
25
|
def group_name
|
47
26
|
@group_name ||= "saml_sso_group-#{SecureRandom.hex(4)}"
|
48
27
|
end
|
@@ -50,25 +29,12 @@ module Gitlab
|
|
50
29
|
def instance
|
51
30
|
raise 'Please provide a block!' unless block_given?
|
52
31
|
|
53
|
-
|
54
|
-
start
|
55
|
-
|
56
|
-
yield self
|
57
|
-
ensure
|
58
|
-
teardown
|
59
|
-
end
|
60
|
-
|
61
|
-
def prepare
|
62
|
-
pull
|
63
|
-
|
64
|
-
return if @docker.network_exists?(network)
|
65
|
-
|
66
|
-
@docker.network_create(network)
|
32
|
+
super
|
67
33
|
end
|
68
34
|
|
69
35
|
# rubocop:disable Metrics/AbcSize
|
70
36
|
def start
|
71
|
-
docker.run(
|
37
|
+
docker.run(image, tag) do |command|
|
72
38
|
command << '-d '
|
73
39
|
command << "--name #{name}"
|
74
40
|
command << "--net #{network}"
|
@@ -91,21 +57,6 @@ module Gitlab
|
|
91
57
|
end
|
92
58
|
# rubocop:enable Metrics/AbcSize
|
93
59
|
|
94
|
-
def restart
|
95
|
-
@docker.restart(name)
|
96
|
-
end
|
97
|
-
|
98
|
-
def teardown
|
99
|
-
raise 'Invalid instance name!' unless name
|
100
|
-
|
101
|
-
@docker.stop(name)
|
102
|
-
@docker.remove(name)
|
103
|
-
end
|
104
|
-
|
105
|
-
def pull
|
106
|
-
@docker.pull(SAML_IMAGE, SAML_IMAGE_TAG)
|
107
|
-
end
|
108
|
-
|
109
60
|
def set_sandbox_name(sandbox_name)
|
110
61
|
::Gitlab::QA::Runtime::Env.gitlab_sandbox_name = sandbox_name
|
111
62
|
end
|
@@ -19,16 +19,7 @@ module Gitlab
|
|
19
19
|
def perform # rubocop:disable Metrics/AbcSize
|
20
20
|
raise ArgumentError unless [suite, release].all?
|
21
21
|
|
22
|
-
if release.
|
23
|
-
Docker::Command.execute(
|
24
|
-
[
|
25
|
-
'login',
|
26
|
-
'--username gitlab-qa-bot',
|
27
|
-
%(--password "#{Runtime::Env.dev_access_token_variable}"),
|
28
|
-
QA::Release::DEV_REGISTRY
|
29
|
-
]
|
30
|
-
)
|
31
|
-
end
|
22
|
+
@docker.login(**release.login_params) if release.login_params
|
32
23
|
|
33
24
|
puts "Running test suite `#{suite}` for #{release.project_name}"
|
34
25
|
|
@@ -8,6 +8,10 @@ module Gitlab
|
|
8
8
|
URI(DOCKER_HOST).host
|
9
9
|
end
|
10
10
|
|
11
|
+
def login(username:, password:, registry:)
|
12
|
+
Docker::Command.execute("login --username '#{username}' --password '#{password}' #{registry}")
|
13
|
+
end
|
14
|
+
|
11
15
|
def pull(image, tag)
|
12
16
|
Docker::Command.execute("pull #{image}:#{tag}")
|
13
17
|
end
|
@@ -63,6 +67,10 @@ module Gitlab
|
|
63
67
|
def port(name, port)
|
64
68
|
Docker::Command.execute("port #{name} #{port}/tcp")
|
65
69
|
end
|
70
|
+
|
71
|
+
def running?(name)
|
72
|
+
Docker::Command.execute("ps -f name=#{name}").include?(name)
|
73
|
+
end
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/gitlab/qa/release.rb
CHANGED
@@ -52,6 +52,7 @@ module Gitlab
|
|
52
52
|
DEFAULT_TAG = 'latest'.freeze
|
53
53
|
DEFAULT_CANONICAL_TAG = 'nightly'.freeze
|
54
54
|
DEV_REGISTRY = 'dev.gitlab.org:5005'.freeze
|
55
|
+
COM_REGISTRY = 'registry.gitlab.com'.freeze
|
55
56
|
|
56
57
|
InvalidImageNameError = Class.new(RuntimeError)
|
57
58
|
|
@@ -134,10 +135,34 @@ module Gitlab
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
138
|
+
def login_params
|
139
|
+
if dev_gitlab_org?
|
140
|
+
Runtime::Env.require_qa_dev_access_token!
|
141
|
+
|
142
|
+
{
|
143
|
+
username: Runtime::Env.gitlab_dev_username,
|
144
|
+
password: Runtime::Env.dev_access_token_variable,
|
145
|
+
registry: DEV_REGISTRY
|
146
|
+
}
|
147
|
+
elsif omnibus_mirror?
|
148
|
+
Runtime::Env.require_gitlab_bot_multi_project_pipeline_polling_token!
|
149
|
+
|
150
|
+
{
|
151
|
+
username: Runtime::Env.gitlab_username,
|
152
|
+
password: Runtime::Env.gitlab_bot_multi_project_pipeline_polling_token,
|
153
|
+
registry: COM_REGISTRY
|
154
|
+
}
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
137
158
|
def dev_gitlab_org?
|
138
159
|
image.start_with?(DEV_REGISTRY)
|
139
160
|
end
|
140
161
|
|
162
|
+
def omnibus_mirror?
|
163
|
+
image.start_with?("#{COM_REGISTRY}/gitlab-org/build/omnibus-gitlab-mirror/")
|
164
|
+
end
|
165
|
+
|
141
166
|
def valid?
|
142
167
|
canonical? || release.match?(CUSTOM_GITLAB_IMAGE_REGEX)
|
143
168
|
end
|
@@ -84,10 +84,22 @@ module Gitlab
|
|
84
84
|
send(:attr_accessor, accessor) # rubocop:disable GitlabSecurity/PublicSend
|
85
85
|
end
|
86
86
|
|
87
|
+
def gitlab_username
|
88
|
+
ENV['GITLAB_USERNAME'] || 'gitlab-qa'
|
89
|
+
end
|
90
|
+
|
91
|
+
def gitlab_dev_username
|
92
|
+
ENV['GITLAB_DEV_USERNAME'] || 'gitlab-qa-bot'
|
93
|
+
end
|
94
|
+
|
87
95
|
def gitlab_api_base
|
88
96
|
ENV['GITLAB_API_BASE'] || 'https://gitlab.com/api/v4'
|
89
97
|
end
|
90
98
|
|
99
|
+
def gitlab_bot_multi_project_pipeline_polling_token
|
100
|
+
ENV['GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN']
|
101
|
+
end
|
102
|
+
|
91
103
|
def ci_job_name
|
92
104
|
ENV['CI_JOB_NAME']
|
93
105
|
end
|
@@ -195,8 +207,14 @@ module Gitlab
|
|
195
207
|
end
|
196
208
|
end
|
197
209
|
|
210
|
+
def require_gitlab_bot_multi_project_pipeline_polling_token!
|
211
|
+
return unless ENV['GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN'].to_s.strip.empty?
|
212
|
+
|
213
|
+
raise ArgumentError, "Please provide GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN"
|
214
|
+
end
|
215
|
+
|
198
216
|
def skip_pull?
|
199
|
-
(ENV['QA_SKIP_PULL']
|
217
|
+
enabled?(ENV['QA_SKIP_PULL'], default: false)
|
200
218
|
end
|
201
219
|
|
202
220
|
def gitlab_qa_formless_login_token
|
@@ -205,6 +223,12 @@ module Gitlab
|
|
205
223
|
|
206
224
|
private
|
207
225
|
|
226
|
+
def enabled?(value, default: true)
|
227
|
+
return default if value.nil?
|
228
|
+
|
229
|
+
(value =~ /^(false|no|0)$/i) != 0
|
230
|
+
end
|
231
|
+
|
208
232
|
def env_value_if_defined(variable)
|
209
233
|
# Pass through the variables if they are defined in the environment
|
210
234
|
return "$#{variable}" if ENV[variable]
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Runtime
|
6
|
+
##
|
7
|
+
# Singleton approach to global test scenario arguments.
|
8
|
+
#
|
9
|
+
module Scenario
|
10
|
+
extend self
|
11
|
+
|
12
|
+
def attributes
|
13
|
+
@attributes ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def define(attribute, value)
|
17
|
+
attributes.store(attribute.to_sym, value)
|
18
|
+
|
19
|
+
define_singleton_method(attribute) do
|
20
|
+
attributes[attribute.to_sym].tap do |value|
|
21
|
+
if value.to_s.empty?
|
22
|
+
raise ArgumentError, "Empty `#{attribute}` attribute!"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# rubocop:disable Style/MethodMissing
|
29
|
+
def method_missing(name, *)
|
30
|
+
raise ArgumentError, "Scenario attribute `#{name}` not defined!"
|
31
|
+
end
|
32
|
+
# rubocop:enable Style/MethodMissing
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
def perform(edition_and_tag, address, *rspec_args)
|
12
12
|
Component::Specs.perform do |specs|
|
13
13
|
specs.suite = 'Test::Instance::All'
|
14
|
-
specs.release = Release.new(edition_and_tag)
|
14
|
+
specs.release = QA::Release.new(edition_and_tag)
|
15
15
|
specs.args = [address, *rspec_args]
|
16
16
|
end
|
17
17
|
end
|
@@ -13,7 +13,7 @@ module Gitlab
|
|
13
13
|
|
14
14
|
Component::Specs.perform do |specs|
|
15
15
|
specs.suite = 'QA::EE::Scenario::Test::Geo'
|
16
|
-
specs.release = Release.new(release)
|
16
|
+
specs.release = QA::Release.new(release)
|
17
17
|
specs.args = [
|
18
18
|
'--primary-address', primary_address,
|
19
19
|
'--secondary-address', secondary_address,
|
@@ -6,7 +6,7 @@ module Gitlab
|
|
6
6
|
class RepositoryStorage < Image
|
7
7
|
def perform(release, *rspec_args)
|
8
8
|
Component::Gitlab.perform do |gitlab|
|
9
|
-
gitlab.release = Release.new(release)
|
9
|
+
gitlab.release = QA::Release.new(release)
|
10
10
|
gitlab.name = 'gitlab'
|
11
11
|
gitlab.network = 'test'
|
12
12
|
gitlab.omnibus_config = <<~OMNIBUS
|
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
def perform(edition_and_tag, address, *rspec_args)
|
12
12
|
Component::Specs.perform do |specs|
|
13
13
|
specs.suite = 'Test::Instance::Smoke'
|
14
|
-
specs.release = Release.new(edition_and_tag)
|
14
|
+
specs.release = QA::Release.new(edition_and_tag)
|
15
15
|
specs.args = [address, *rspec_args]
|
16
16
|
end
|
17
17
|
end
|
@@ -28,16 +28,16 @@ module Gitlab
|
|
28
28
|
sql.run_psql '-d template1 -c "CREATE DATABASE praefect_production OWNER postgres"'
|
29
29
|
|
30
30
|
Component::Gitlab.perform do |praefect|
|
31
|
-
praefect.release = Release.new(release)
|
31
|
+
praefect.release = QA::Release.new(release)
|
32
32
|
praefect.name = @praefect_node
|
33
33
|
praefect.network = @network
|
34
|
-
praefect.
|
34
|
+
praefect.skip_availability_check = true
|
35
35
|
|
36
36
|
praefect.omnibus_config = praefect_omnibus_configuration
|
37
37
|
|
38
38
|
praefect.instance do
|
39
39
|
Component::Gitlab.perform do |gitlab|
|
40
|
-
gitlab.release = Release.new(release)
|
40
|
+
gitlab.release = QA::Release.new(release)
|
41
41
|
gitlab.name = gitlab_name
|
42
42
|
gitlab.network = @network
|
43
43
|
|
@@ -146,10 +146,10 @@ module Gitlab
|
|
146
146
|
|
147
147
|
def gitaly(name, release)
|
148
148
|
Component::Gitlab.perform do |gitaly|
|
149
|
-
gitaly.release = Release.new(release)
|
149
|
+
gitaly.release = QA::Release.new(release)
|
150
150
|
gitaly.name = name
|
151
151
|
gitaly.network = @network
|
152
|
-
gitaly.
|
152
|
+
gitaly.skip_availability_check = true
|
153
153
|
|
154
154
|
gitaly.omnibus_config = gitaly_omnibus_configuration
|
155
155
|
|
@@ -6,7 +6,7 @@ module Gitlab
|
|
6
6
|
class Jira < Scenario::Template
|
7
7
|
def perform(release, *rspec_args)
|
8
8
|
Component::Gitlab.perform do |gitlab|
|
9
|
-
gitlab.release = Release.new(release)
|
9
|
+
gitlab.release = QA::Release.new(release)
|
10
10
|
gitlab.network = 'test'
|
11
11
|
gitlab.name = 'gitlab-jira'
|
12
12
|
|
@@ -6,7 +6,7 @@ module Gitlab
|
|
6
6
|
class Packages < Scenario::Template
|
7
7
|
def perform(release, *rspec_args)
|
8
8
|
Component::Gitlab.perform do |gitlab|
|
9
|
-
gitlab.release = Release.new(release)
|
9
|
+
gitlab.release = QA::Release.new(release)
|
10
10
|
gitlab.name = 'gitlab-packages'
|
11
11
|
gitlab.network = 'test'
|
12
12
|
gitlab.omnibus_config = <<~OMNIBUS
|
@@ -9,7 +9,7 @@ module Gitlab
|
|
9
9
|
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
10
10
|
# Create the Praefect database before enabling Praefect
|
11
11
|
Component::Gitlab.perform do |gitlab|
|
12
|
-
gitlab.release = Release.new(release)
|
12
|
+
gitlab.release = QA::Release.new(release)
|
13
13
|
gitlab.name = 'gitlab'
|
14
14
|
gitlab.network = 'test'
|
15
15
|
gitlab.volumes = volumes
|
@@ -27,7 +27,7 @@ module Gitlab
|
|
27
27
|
|
28
28
|
# Restart GitLab with Praefect enabled and then run the tests
|
29
29
|
Component::Gitlab.perform do |gitlab|
|
30
|
-
gitlab.release = Release.new(release)
|
30
|
+
gitlab.release = QA::Release.new(release)
|
31
31
|
gitlab.name = 'gitlab'
|
32
32
|
gitlab.network = 'test'
|
33
33
|
gitlab.volumes = volumes
|
@@ -8,8 +8,8 @@ module Gitlab
|
|
8
8
|
module Omnibus
|
9
9
|
class Update < Scenario::Template
|
10
10
|
def perform(from_release, to_release = nil, *rspec_args)
|
11
|
-
previous_release = Release.new(from_release).previous_stable
|
12
|
-
current_release = Release.new(to_release || from_release)
|
11
|
+
previous_release = QA::Release.new(from_release).previous_stable
|
12
|
+
current_release = QA::Release.new(to_release || from_release)
|
13
13
|
|
14
14
|
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
15
15
|
Component::Gitlab.perform do |gitlab|
|
@@ -8,7 +8,7 @@ module Gitlab
|
|
8
8
|
module Omnibus
|
9
9
|
class Upgrade < Scenario::Template
|
10
10
|
def perform(image = 'CE', *rspec_args)
|
11
|
-
ce_release = Release.new(image)
|
11
|
+
ce_release = QA::Release.new(image)
|
12
12
|
|
13
13
|
if ce_release.ee?
|
14
14
|
raise ArgumentError, 'Only CE can be upgraded to EE!'
|