gitlab-qa 5.9.0 → 5.10.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/lib/gitlab/qa.rb +2 -0
- data/lib/gitlab/qa/component/gitlab.rb +16 -3
- data/lib/gitlab/qa/component/postgresql.rb +72 -0
- data/lib/gitlab/qa/scenario/test/integration/gitaly_ha.rb +166 -0
- data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -1
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 391e977cce68dfe2121221a474f716594ba841f639e49b9c0e4e37f273141b0c
|
4
|
+
data.tar.gz: af9e8913c4ecfe5d365ba18222f1dd15a0370c2efaed6d94c91af89b0dcd5e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13946f0f1404490edff6465ca7e46a1e748e6cffc2d742e6fd9eb0c20f9ebbcf4c36217f863c07d21a3be622c2e4d45734ae3810b098ead1e1cad0dbdfbde9bc
|
7
|
+
data.tar.gz: b52d3e85cde22d8aa4819f4597e5146b7629287daeafda81bcf168e22cd833c2b7e3db5b1936503df2f3c4fbcdf20b87955c2d8bdcc084cf8e8d5076f13fd56a
|
data/lib/gitlab/qa.rb
CHANGED
@@ -51,6 +51,7 @@ module Gitlab
|
|
51
51
|
autoload :Praefect, 'gitlab/qa/scenario/test/integration/praefect'
|
52
52
|
autoload :Elasticsearch, 'gitlab/qa/scenario/test/integration/elasticsearch'
|
53
53
|
autoload :SMTP, 'gitlab/qa/scenario/test/integration/smtp'
|
54
|
+
autoload :GitalyHA, 'gitlab/qa/scenario/test/integration/gitaly_ha'
|
54
55
|
end
|
55
56
|
|
56
57
|
module Sanity
|
@@ -71,6 +72,7 @@ module Gitlab
|
|
71
72
|
autoload :Preprod, 'gitlab/qa/component/preprod'
|
72
73
|
autoload :Elasticsearch, 'gitlab/qa/component/elasticsearch'
|
73
74
|
autoload :MailHog, 'gitlab/qa/component/mail_hog'
|
75
|
+
autoload :PostgreSQL, 'gitlab/qa/component/postgresql'
|
74
76
|
end
|
75
77
|
|
76
78
|
module Support
|
@@ -13,7 +13,7 @@ module Gitlab
|
|
13
13
|
|
14
14
|
attr_reader :release, :docker
|
15
15
|
attr_accessor :volumes, :network, :environment, :tls, :disable_animations
|
16
|
-
attr_writer :name, :relative_path, :exec_commands
|
16
|
+
attr_writer :name, :relative_path, :exec_commands, :skip_check
|
17
17
|
|
18
18
|
def_delegators :release, :tag, :image, :edition
|
19
19
|
|
@@ -26,6 +26,7 @@ module Gitlab
|
|
26
26
|
@volumes = {}
|
27
27
|
@network_aliases = []
|
28
28
|
@disable_animations = true
|
29
|
+
@skip_check = false
|
29
30
|
|
30
31
|
@volumes[CERTIFICATES_PATH] = SSL_PATH
|
31
32
|
|
@@ -87,7 +88,7 @@ module Gitlab
|
|
87
88
|
prepare
|
88
89
|
start
|
89
90
|
reconfigure
|
90
|
-
wait
|
91
|
+
wait unless @skip_check
|
91
92
|
process_exec_commands
|
92
93
|
|
93
94
|
yield self if block_given?
|
@@ -98,11 +99,23 @@ module Gitlab
|
|
98
99
|
alias_method :launch_and_teardown_instance, :instance
|
99
100
|
|
100
101
|
def prepare
|
102
|
+
prepare_gitlab_omnibus_config
|
103
|
+
prepare_docker_image
|
104
|
+
prepare_network
|
105
|
+
end
|
106
|
+
|
107
|
+
def prepare_gitlab_omnibus_config
|
101
108
|
setup_disable_animations if disable_animations
|
102
109
|
set_formless_login_token
|
110
|
+
end
|
103
111
|
|
104
|
-
|
112
|
+
def prepare_docker_image
|
113
|
+
return if Runtime::Env.skip_pull?
|
114
|
+
|
115
|
+
@docker.pull(image, tag)
|
116
|
+
end
|
105
117
|
|
118
|
+
def prepare_network
|
106
119
|
return if @docker.network_exists?(network)
|
107
120
|
|
108
121
|
@docker.network_create(network)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Gitlab
|
2
|
+
module QA
|
3
|
+
module Component
|
4
|
+
class PostgreSQL
|
5
|
+
include Scenario::Actable
|
6
|
+
|
7
|
+
POSTGRES_IMAGE = 'postgres'.freeze
|
8
|
+
POSTGRES_IMAGE_TAG = '11'.freeze
|
9
|
+
|
10
|
+
attr_reader :docker
|
11
|
+
attr_accessor :environment, :network
|
12
|
+
attr_writer :name
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@docker = Docker::Engine.new
|
16
|
+
@environment = {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
@name ||= "postgres"
|
21
|
+
end
|
22
|
+
|
23
|
+
def instance
|
24
|
+
prepare
|
25
|
+
start
|
26
|
+
wait_until_ready
|
27
|
+
yield self
|
28
|
+
ensure
|
29
|
+
teardown
|
30
|
+
end
|
31
|
+
|
32
|
+
def prepare
|
33
|
+
@docker.pull(POSTGRES_IMAGE, POSTGRES_IMAGE_TAG)
|
34
|
+
return if @docker.network_exists?(network)
|
35
|
+
|
36
|
+
@docker.network_create(network)
|
37
|
+
end
|
38
|
+
|
39
|
+
def start
|
40
|
+
@docker.run(POSTGRES_IMAGE, POSTGRES_IMAGE_TAG) do |command|
|
41
|
+
command << "-d"
|
42
|
+
command << "--name #{name}"
|
43
|
+
command << "--net #{network}"
|
44
|
+
|
45
|
+
command.env("POSTGRES_PASSWORD", "SQL_PASSWORD")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def teardown
|
50
|
+
@docker.stop(name)
|
51
|
+
@docker.remove(name)
|
52
|
+
end
|
53
|
+
|
54
|
+
def run_psql(command)
|
55
|
+
@docker.exec(name, %(psql -U postgres #{command}))
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def wait_until_ready
|
61
|
+
start = Time.now
|
62
|
+
begin
|
63
|
+
run_psql 'template1'
|
64
|
+
rescue StandardError
|
65
|
+
retry if Time.now - start < 30
|
66
|
+
raise
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
module Gitlab
|
2
|
+
module QA
|
3
|
+
module Scenario
|
4
|
+
module Test
|
5
|
+
module Integration
|
6
|
+
class GitalyHA < Scenario::Template
|
7
|
+
attr_reader :gitlab_name, :spec_suite
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@gitlab_name = 'gitlab-gitaly-ha'
|
11
|
+
@primary_node = 'gitaly1'
|
12
|
+
@secondary_node = 'gitaly2'
|
13
|
+
@praefect_node = 'praefect'
|
14
|
+
@database = 'postgres'
|
15
|
+
@spec_suite = 'Test::Integration::GitalyHA'
|
16
|
+
@network = 'test'
|
17
|
+
end
|
18
|
+
|
19
|
+
# rubocop:disable Metrics/AbcSize
|
20
|
+
def perform(release, *rspec_args)
|
21
|
+
gitaly(@primary_node, release) do
|
22
|
+
gitaly(@secondary_node, release) do
|
23
|
+
Component::PostgreSQL.perform do |sql|
|
24
|
+
sql.name = @database
|
25
|
+
sql.network = @network
|
26
|
+
|
27
|
+
sql.instance do
|
28
|
+
sql.run_psql '-d template1 -c "CREATE DATABASE praefect_production OWNER postgres"'
|
29
|
+
|
30
|
+
Component::Gitlab.perform do |praefect|
|
31
|
+
praefect.release = Release.new(release)
|
32
|
+
praefect.name = @praefect_node
|
33
|
+
praefect.network = @network
|
34
|
+
praefect.skip_check = true
|
35
|
+
|
36
|
+
praefect.omnibus_config = praefect_omnibus_configuration
|
37
|
+
|
38
|
+
praefect.instance do
|
39
|
+
Component::Gitlab.perform do |gitlab|
|
40
|
+
gitlab.release = Release.new(release)
|
41
|
+
gitlab.name = gitlab_name
|
42
|
+
gitlab.network = @network
|
43
|
+
|
44
|
+
gitlab.omnibus_config = gitlab_omnibus_configuration
|
45
|
+
gitlab.instance do
|
46
|
+
puts "Running Gitaly HA specs!"
|
47
|
+
|
48
|
+
Component::Specs.perform do |specs|
|
49
|
+
specs.suite = spec_suite
|
50
|
+
specs.release = gitlab.release
|
51
|
+
specs.network = gitlab.network
|
52
|
+
specs.args = [gitlab.address, *rspec_args]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
# rubocop:enable Metrics/AbcSize
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def disable_other_services
|
68
|
+
<<~OMNIBUS
|
69
|
+
postgresql['enable'] = false;
|
70
|
+
redis['enable'] = false;
|
71
|
+
nginx['enable'] = false;
|
72
|
+
prometheus['enable'] = false;
|
73
|
+
grafana['enable'] = false;
|
74
|
+
unicorn['enable'] = false;
|
75
|
+
sidekiq['enable'] = false;
|
76
|
+
gitlab_workhorse['enable'] = false;
|
77
|
+
gitlab_rails['rake_cache_clear'] = false;
|
78
|
+
gitlab_rails['auto_migrate'] = false;
|
79
|
+
OMNIBUS
|
80
|
+
end
|
81
|
+
|
82
|
+
def praefect_omnibus_configuration
|
83
|
+
<<~OMNIBUS
|
84
|
+
#{disable_other_services}
|
85
|
+
gitaly['enable'] = false;
|
86
|
+
praefect['enable'] = true;
|
87
|
+
praefect['listen_addr'] = '0.0.0.0:2305';
|
88
|
+
praefect['prometheus_listen_addr'] = '0.0.0.0:9652';
|
89
|
+
praefect['auth_token'] = 'PRAEFECT_EXTERNAL_TOKEN';
|
90
|
+
praefect['database_host'] = '#{@database}.#{@network}';
|
91
|
+
praefect['database_user'] = 'postgres';
|
92
|
+
praefect['database_port'] = 5432;
|
93
|
+
praefect['database_password'] = 'SQL_PASSWORD';
|
94
|
+
praefect['database_dbname'] = 'praefect_production';
|
95
|
+
praefect['database_sslmode'] = 'disable';
|
96
|
+
praefect['postgres_queue_enabled'] = true;
|
97
|
+
praefect['failover_enabled'] = true;
|
98
|
+
praefect['virtual_storages'] = {
|
99
|
+
'default' => {
|
100
|
+
'#{@primary_node}' => {
|
101
|
+
'address' => 'tcp://#{@primary_node}.#{@network}:8075',
|
102
|
+
'token' => 'PRAEFECT_INTERNAL_TOKEN',
|
103
|
+
'primary' => true
|
104
|
+
},
|
105
|
+
'#{@secondary_node}' => {
|
106
|
+
'address' => 'tcp://#{@secondary_node}.#{@network}:8075',
|
107
|
+
'token' => 'PRAEFECT_INTERNAL_TOKEN'
|
108
|
+
}
|
109
|
+
}
|
110
|
+
};
|
111
|
+
OMNIBUS
|
112
|
+
end
|
113
|
+
|
114
|
+
def gitaly_omnibus_configuration
|
115
|
+
<<~OMNIBUS
|
116
|
+
#{disable_other_services}
|
117
|
+
prometheus_monitoring['enable'] = false;
|
118
|
+
gitaly['enable'] = true;
|
119
|
+
gitaly['listen_addr'] = '0.0.0.0:8075';
|
120
|
+
gitaly['prometheus_listen_addr'] = '0.0.0.0:9236';
|
121
|
+
gitaly['auth_token'] = 'PRAEFECT_INTERNAL_TOKEN';
|
122
|
+
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN';
|
123
|
+
gitlab_rails['internal_api_url'] = 'http://#{@gitlab_name}.#{@network}';
|
124
|
+
git_data_dirs({
|
125
|
+
'#{@primary_node}' => {
|
126
|
+
'path' => '/var/opt/gitlab/git-data'
|
127
|
+
},
|
128
|
+
'#{@secondary_node}' => {
|
129
|
+
'path' => '/var/opt/gitlab/git-data'
|
130
|
+
}
|
131
|
+
});
|
132
|
+
OMNIBUS
|
133
|
+
end
|
134
|
+
|
135
|
+
def gitlab_omnibus_configuration
|
136
|
+
<<~OMNIBUS
|
137
|
+
git_data_dirs({
|
138
|
+
'default' => {
|
139
|
+
'gitaly_address' => 'tcp://#{@praefect_node}.#{@network}:2305',
|
140
|
+
'gitaly_token' => 'PRAEFECT_EXTERNAL_TOKEN'
|
141
|
+
}
|
142
|
+
});
|
143
|
+
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN';
|
144
|
+
OMNIBUS
|
145
|
+
end
|
146
|
+
|
147
|
+
def gitaly(name, release)
|
148
|
+
Component::Gitlab.perform do |gitaly|
|
149
|
+
gitaly.release = Release.new(release)
|
150
|
+
gitaly.name = name
|
151
|
+
gitaly.network = @network
|
152
|
+
gitaly.skip_check = true
|
153
|
+
|
154
|
+
gitaly.omnibus_config = gitaly_omnibus_configuration
|
155
|
+
|
156
|
+
gitaly.instance do
|
157
|
+
yield self
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
@@ -15,7 +15,7 @@ module Gitlab
|
|
15
15
|
gitlab.volumes = volumes
|
16
16
|
gitlab.exec_commands = ['gitlab-psql -d template1 -c "CREATE DATABASE praefect_production OWNER gitlab"']
|
17
17
|
|
18
|
-
gitlab.act
|
18
|
+
gitlab.act do
|
19
19
|
prepare
|
20
20
|
start
|
21
21
|
reconfigure
|
@@ -34,6 +34,7 @@ module Gitlab
|
|
34
34
|
gitlab.omnibus_config = omnibus_config_with_praefect
|
35
35
|
|
36
36
|
gitlab.act do
|
37
|
+
prepare_gitlab_omnibus_config
|
37
38
|
start
|
38
39
|
reconfigure
|
39
40
|
wait
|
data/lib/gitlab/qa/version.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: 5.
|
4
|
+
version: 5.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- lib/gitlab/qa/component/ldap.rb
|
244
244
|
- lib/gitlab/qa/component/mail_hog.rb
|
245
245
|
- lib/gitlab/qa/component/minio.rb
|
246
|
+
- lib/gitlab/qa/component/postgresql.rb
|
246
247
|
- lib/gitlab/qa/component/preprod.rb
|
247
248
|
- lib/gitlab/qa/component/production.rb
|
248
249
|
- lib/gitlab/qa/component/saml.rb
|
@@ -277,6 +278,7 @@ files:
|
|
277
278
|
- lib/gitlab/qa/scenario/test/instance/staging_geo.rb
|
278
279
|
- lib/gitlab/qa/scenario/test/integration/elasticsearch.rb
|
279
280
|
- lib/gitlab/qa/scenario/test/integration/geo.rb
|
281
|
+
- lib/gitlab/qa/scenario/test/integration/gitaly_ha.rb
|
280
282
|
- lib/gitlab/qa/scenario/test/integration/group_saml.rb
|
281
283
|
- lib/gitlab/qa/scenario/test/integration/instance_saml.rb
|
282
284
|
- lib/gitlab/qa/scenario/test/integration/kubernetes.rb
|
@@ -321,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
323
|
- !ruby/object:Gem::Version
|
322
324
|
version: '0'
|
323
325
|
requirements: []
|
324
|
-
rubygems_version: 3.1.
|
326
|
+
rubygems_version: 3.1.3
|
325
327
|
signing_key:
|
326
328
|
specification_version: 4
|
327
329
|
summary: Integration tests for GitLab
|