gitlab-qa 14.20.0 → 14.21.0
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/Gemfile.lock +1 -1
- data/lib/gitlab/qa/scenario/test/integration/import.rb +123 -25
- data/lib/gitlab/qa/scenario/test/integration/import_with_smtp.rb +30 -0
- data/lib/gitlab/qa/version.rb +1 -1
- data/lib/gitlab/qa.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d84483452fba7a39c684e4b5b7f772a63712c6d400027b579dca7769ce231c7e
|
4
|
+
data.tar.gz: 64e52ceaa976d1dc0a3f513a26e71f4e529c5a9d9eea8c39474f683da963d718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8633d6f704664548214395cf5e3b8560e6776f0052d5dcf1da91d3239e5489236877495b9bc077043f4efeb588e15272c595dfda0dc147386818d2a3c505d476
|
7
|
+
data.tar.gz: ca524f4c69c44fab4241cfd836bf2ed0f10047a3b030f942474ed360c8f7356a3ee678aa56dbb59a38697add270dcc8a881789a84fc3c675eb5b65f6395d0425
|
data/Gemfile.lock
CHANGED
@@ -15,19 +15,41 @@ module Gitlab
|
|
15
15
|
class Import < Scenario::Template
|
16
16
|
def initialize
|
17
17
|
@network = Runtime::Env.docker_network
|
18
|
-
|
19
|
-
@
|
20
|
-
@
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
|
19
|
+
@source_gitlab = new_gitlab_instance
|
20
|
+
@target_gitlab = new_gitlab_instance
|
21
|
+
@mock_server = new_mock_server
|
22
|
+
@mail_hog_server = new_mail_hog_server
|
23
|
+
@spec_suite = 'Test::Integration::Import'
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :source_gitlab, :target_gitlab, :mock_server, :network, :spec_suite, :mail_hog_server
|
27
|
+
|
28
|
+
def configure_omnibus(gitlab, mail_hog)
|
29
|
+
raise NotImplementedError
|
24
30
|
end
|
25
31
|
|
26
|
-
|
32
|
+
# Import tests that spins up two gitlab instances
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# perform(gitlab-ee, gitlab-ee:17.4.0-ee.0)
|
36
|
+
# => will perform import from gitlab-ee:17.4.0-ee.0 to gitlab-ee
|
37
|
+
#
|
38
|
+
# @param [String] target_release target gitlab instance version release docker image(default)
|
39
|
+
# @param [String] source_release source gitlab instance version, if its not passed takes the target release as default
|
40
|
+
# @param [Array] *rspec_args rspec arguments
|
41
|
+
# @return [void]
|
42
|
+
def perform(target_release, source_release = nil, *rspec_args)
|
43
|
+
# When source_release isn't actually passed but RSpec args arg passed with `-- rspec_args...`,
|
44
|
+
# source_release is wrongly set to `--`, so we fix that here.
|
45
|
+
if source_release == "--"
|
46
|
+
rspec_args.prepend('--')
|
47
|
+
source_release = nil
|
48
|
+
end
|
27
49
|
|
28
|
-
|
50
|
+
source_release = target_release if source_release.nil?
|
29
51
|
start_mock_server
|
30
|
-
start_gitlab_instances(
|
52
|
+
start_gitlab_instances(source_release, target_release)
|
31
53
|
|
32
54
|
run_specs(rspec_args)
|
33
55
|
ensure
|
@@ -38,6 +60,45 @@ module Gitlab
|
|
38
60
|
|
39
61
|
private
|
40
62
|
|
63
|
+
# Initialize a mailhog instance
|
64
|
+
#
|
65
|
+
# @note this does not start the instance
|
66
|
+
# @return [Gitlab::QA::Component::MailHog] Mailhog instance
|
67
|
+
def new_mail_hog_server
|
68
|
+
Component::MailHog.new.tap do |mail_hog|
|
69
|
+
mail_hog.network = @network
|
70
|
+
mail_hog.set_mailhog_hostname
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check if MailHog server is needed
|
75
|
+
#
|
76
|
+
# @param [Hash] gitlab_instance
|
77
|
+
# @return [Boolean]
|
78
|
+
def mail_hog_server_needed?(gitlab_instance)
|
79
|
+
respond_to?(:orchestrate_mail_hog_server) && gitlab_instance[:name] == "import-target"
|
80
|
+
end
|
81
|
+
|
82
|
+
# Start MailHog server
|
83
|
+
#
|
84
|
+
# @param [Hash] gitlab_instance
|
85
|
+
# @return [void]
|
86
|
+
def start_mail_hog_server(gitlab_instance)
|
87
|
+
configure_omnibus(gitlab_instance[:instance], mail_hog_server)
|
88
|
+
mail_hog_server.start_instance
|
89
|
+
end
|
90
|
+
|
91
|
+
# Initialize a mock server instance
|
92
|
+
#
|
93
|
+
# @note this does not start the instance
|
94
|
+
# @return [Gitlab::QA::Component::MockServer] mock server instance
|
95
|
+
def new_mock_server
|
96
|
+
Component::MockServer.new.tap do |server|
|
97
|
+
server.network = @network
|
98
|
+
server.tls = true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
41
102
|
# Start mock server instance
|
42
103
|
#
|
43
104
|
# @return [void]
|
@@ -45,25 +106,60 @@ module Gitlab
|
|
45
106
|
mock_server.start_instance
|
46
107
|
end
|
47
108
|
|
48
|
-
#
|
109
|
+
# Initialize a gitlab instance
|
49
110
|
#
|
50
|
-
# @
|
111
|
+
# @note this does not start the instance
|
112
|
+
# @return [Gitlab::QA::Component::Gitlab] gitlab instance
|
113
|
+
def new_gitlab_instance
|
114
|
+
Component::Gitlab.new.tap { |gitlab| gitlab.network = @network }
|
115
|
+
end
|
116
|
+
|
117
|
+
# Setup GitLab instance
|
118
|
+
#
|
119
|
+
# @param [Hash] gitlab_instance
|
51
120
|
# @return [void]
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
121
|
+
def setup_gitlab_instance(gitlab_instance)
|
122
|
+
gitlab_instance[:instance].tap do |gitlab|
|
123
|
+
configure_gitlab_instance(gitlab, gitlab_instance)
|
124
|
+
start_mail_hog_server(gitlab_instance) if mail_hog_server_needed?(gitlab_instance)
|
125
|
+
gitlab.start_instance
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Configure GitLab instance
|
130
|
+
#
|
131
|
+
# @param [Gitlab::QA::Component::Gitlab] gitlab
|
132
|
+
# @param [Hash] gitlab_instance
|
133
|
+
# @return [void]
|
134
|
+
def configure_gitlab_instance(gitlab, gitlab_instance)
|
135
|
+
gitlab.name = gitlab_instance[:name]
|
136
|
+
gitlab.release = gitlab_instance[:release]
|
137
|
+
gitlab.additional_hosts = gitlab_instance[:additional_hosts]
|
138
|
+
gitlab.seed_admin_token = true
|
139
|
+
end
|
140
|
+
|
141
|
+
# Build GitLab instances
|
142
|
+
#
|
143
|
+
# @param [Gitlab::QA::Release] source_release
|
144
|
+
# @param [Gitlab::QA::Release] target_release
|
145
|
+
# @return [Array<Hash>]
|
146
|
+
def build_gitlab_instances(source_release, target_release)
|
147
|
+
[
|
148
|
+
{ instance: source_gitlab, name: "import-source", additional_hosts: [], release: source_release },
|
149
|
+
{ instance: target_gitlab, name: "import-target", additional_hosts: mocked_hosts, release: target_release }
|
56
150
|
]
|
151
|
+
end
|
152
|
+
|
153
|
+
# Start gitlab instance
|
154
|
+
#
|
155
|
+
# @param [Gitlab::QA::Release] source_release
|
156
|
+
# @param [Gitlab::QA::Release] target_release
|
157
|
+
# @return [void]
|
158
|
+
def start_gitlab_instances(source_release, target_release)
|
159
|
+
instances = build_gitlab_instances(source_release, target_release)
|
57
160
|
|
58
161
|
::Parallel.each(instances, in_threads: 2) do |gitlab_instance|
|
59
|
-
gitlab_instance
|
60
|
-
gitlab.name = gitlab_instance[:name]
|
61
|
-
gitlab.release = release
|
62
|
-
gitlab.additional_hosts = gitlab_instance[:additional_hosts]
|
63
|
-
gitlab.seed_admin_token = true
|
64
|
-
|
65
|
-
gitlab.start_instance
|
66
|
-
end
|
162
|
+
setup_gitlab_instance(gitlab_instance)
|
67
163
|
end
|
68
164
|
end
|
69
165
|
|
@@ -71,9 +167,11 @@ module Gitlab
|
|
71
167
|
#
|
72
168
|
# @param [Array] rspec_args
|
73
169
|
# @return [void]
|
74
|
-
def run_specs(rspec_args)
|
170
|
+
def run_specs(rspec_args) # rubocop:disable Metrics/AbcSize
|
171
|
+
Runtime::Logger.info("Running #{spec_suite} specs!")
|
172
|
+
|
75
173
|
Component::Specs.perform do |specs|
|
76
|
-
specs.suite =
|
174
|
+
specs.suite = spec_suite
|
77
175
|
specs.release = target_gitlab.release
|
78
176
|
specs.network = network
|
79
177
|
specs.args = [target_gitlab.address, *rspec_args]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
# Scenario type for testing importers with smtp enabled in target gitlab instance
|
9
|
+
class ImportWithSMTP < Import
|
10
|
+
attr_reader :orchestrate_mail_hog_server
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@spec_suite = 'Test::Integration::ImportWithSMTP'
|
14
|
+
@orchestrate_mail_hog_server = true
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure_omnibus(gitlab, mail_hog)
|
19
|
+
gitlab.omnibus_configuration << <<~OMNIBUS
|
20
|
+
gitlab_rails['smtp_enable'] = true;
|
21
|
+
gitlab_rails['smtp_address'] = '#{mail_hog.hostname}';
|
22
|
+
gitlab_rails['smtp_port'] = 1025;
|
23
|
+
OMNIBUS
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/gitlab/qa/version.rb
CHANGED
data/lib/gitlab/qa.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.
|
4
|
+
version: 14.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -470,6 +470,7 @@ files:
|
|
470
470
|
- lib/gitlab/qa/scenario/test/integration/gitlab_pages.rb
|
471
471
|
- lib/gitlab/qa/scenario/test/integration/group_saml.rb
|
472
472
|
- lib/gitlab/qa/scenario/test/integration/import.rb
|
473
|
+
- lib/gitlab/qa/scenario/test/integration/import_with_smtp.rb
|
473
474
|
- lib/gitlab/qa/scenario/test/integration/instance_saml.rb
|
474
475
|
- lib/gitlab/qa/scenario/test/integration/integrations.rb
|
475
476
|
- lib/gitlab/qa/scenario/test/integration/jira.rb
|