gitlab-qa 14.20.0 → 14.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2d322ac696cbbc43376ab9e0119aa17b5ca27b326a4e98c0bed1e7e62bb0d94
4
- data.tar.gz: ac29c33e952e89531a792294fe91ecbc251562b77eefb2aa17c46a969b1916a1
3
+ metadata.gz: d84483452fba7a39c684e4b5b7f772a63712c6d400027b579dca7769ce231c7e
4
+ data.tar.gz: 64e52ceaa976d1dc0a3f513a26e71f4e529c5a9d9eea8c39474f683da963d718
5
5
  SHA512:
6
- metadata.gz: e16ec9338d9c0e45854dd81c15219afd7a4960882debbccf75a5a0db426b682f416ce9b41264ba560c8f384b81f822a3bbf51f66b2a0022a9d16d78d7a406c47
7
- data.tar.gz: d4f1c16afbf492572dd0d3830c592e38c0182224b2524ab1992e5ffa1e286bcfec7f6a21da837b8de45cea4109bc703ecc6c828a64ab51c7a72d04b50e342956
6
+ metadata.gz: 8633d6f704664548214395cf5e3b8560e6776f0052d5dcf1da91d3239e5489236877495b9bc077043f4efeb588e15272c595dfda0dc147386818d2a3c505d476
7
+ data.tar.gz: ca524f4c69c44fab4241cfd836bf2ed0f10047a3b030f942474ed360c8f7356a3ee678aa56dbb59a38697add270dcc8a881789a84fc3c675eb5b65f6395d0425
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (14.20.0)
4
+ gitlab-qa (14.21.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  ffi (~> 1.17)
7
7
  gitlab (~> 4.19)
@@ -15,19 +15,41 @@ module Gitlab
15
15
  class Import < Scenario::Template
16
16
  def initialize
17
17
  @network = Runtime::Env.docker_network
18
- @source_gitlab = Component::Gitlab.new.tap { |gitlab| gitlab.network = @network }
19
- @target_gitlab = Component::Gitlab.new.tap { |gitlab| gitlab.network = @network }
20
- @mock_server = Component::MockServer.new.tap do |server|
21
- server.network = @network
22
- server.tls = true
23
- end
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
- attr_reader :source_gitlab, :target_gitlab, :mock_server, :network
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
- def perform(release, *rspec_args)
50
+ source_release = target_release if source_release.nil?
29
51
  start_mock_server
30
- start_gitlab_instances(release)
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
- # Start gitlab instance
109
+ # Initialize a gitlab instance
49
110
  #
50
- # @param [Gitlab::QA::Release] release
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 start_gitlab_instances(release)
53
- instances = [
54
- { instance: source_gitlab, name: "import-source", additional_hosts: [] },
55
- { instance: target_gitlab, name: "import-target", additional_hosts: mocked_hosts }
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[:instance].tap do |gitlab|
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 = "Test::Integration::Import"
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module QA
5
- VERSION = '14.20.0'
5
+ VERSION = '14.21.0'
6
6
  end
7
7
  end
data/lib/gitlab/qa.rb CHANGED
@@ -48,7 +48,8 @@ module Gitlab
48
48
  'registry_tls' => 'RegistryTLS',
49
49
  'jetbrains' => 'JetBrains',
50
50
  'vscode' => 'VSCode',
51
- 'cli_commands' => 'CLICommands'
51
+ 'cli_commands' => 'CLICommands',
52
+ 'import_with_smtp' => 'ImportWithSMTP'
52
53
  )
53
54
 
54
55
  loader.setup
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.20.0
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 00:00:00.000000000 Z
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