gitlab-qa 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +49 -0
- data/bin/expect_exit_code_and_text +36 -0
- data/docs/run_qa_against_gdk.md +7 -2
- data/docs/what_tests_can_be_run.md +21 -2
- data/exe/gitlab-qa +26 -3
- data/lib/gitlab/qa.rb +5 -0
- data/lib/gitlab/qa/component/gitlab.rb +9 -5
- data/lib/gitlab/qa/component/minio.rb +125 -0
- data/lib/gitlab/qa/component/saml.rb +123 -0
- data/lib/gitlab/qa/runtime/env.rb +4 -0
- data/lib/gitlab/qa/scenario/test/instance/image.rb +2 -2
- data/lib/gitlab/qa/scenario/test/instance/relative_url.rb +32 -0
- data/lib/gitlab/qa/scenario/test/integration/group_saml.rb +54 -0
- data/lib/gitlab/qa/scenario/test/integration/object_storage.rb +50 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ecae34a82e75238783d46d9099fdf98e0215ac93b0dde2dd043cf37779565a0
|
4
|
+
data.tar.gz: 118aa1a47570a26ab84f4cb138f9a65ff29f30412dbb54f6d599a2f31528dadf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990bf38a0d1a5eb1c805f010f94aa045dab39ffe72aa884318f24e9953bc1f8bb1b4a2cbe7d14580348091b717e0cfe4d01e1443a59c7414872531390daa5ae5
|
7
|
+
data.tar.gz: 3f4272fdf695dbf93565a4cde155d382fbcdcc556d0e36bd7c4b79969af04b0689a672710b49d4c53205475180f6a2c15a6c01596e6836461de84c64e3e76624
|
data/.gitlab-ci.yml
CHANGED
@@ -70,6 +70,20 @@ check:rspec:
|
|
70
70
|
- 7gb
|
71
71
|
- triggered-packages
|
72
72
|
|
73
|
+
ce:sanity-framework:
|
74
|
+
script:
|
75
|
+
- ./bin/expect_exit_code_and_text "bin/qa Test::Instance::Image ${RELEASE:=CE} --tag framework" 1 "2 examples, 1 failure"
|
76
|
+
<<: *test
|
77
|
+
<<: *high-capacity
|
78
|
+
<<: *ce-qa
|
79
|
+
|
80
|
+
ee:sanity-framework:
|
81
|
+
script:
|
82
|
+
- ./bin/expect_exit_code_and_text "bin/qa Test::Instance::Image ${RELEASE:=EE} --tag framework" 1 "2 examples, 1 failure"
|
83
|
+
<<: *test
|
84
|
+
<<: *high-capacity
|
85
|
+
<<: *ee-qa
|
86
|
+
|
73
87
|
ce:instance:
|
74
88
|
script:
|
75
89
|
- bin/qa Test::Instance::Image ${RELEASE:=CE}
|
@@ -84,6 +98,20 @@ ee:instance:
|
|
84
98
|
<<: *high-capacity
|
85
99
|
<<: *ee-qa
|
86
100
|
|
101
|
+
ce:relative_url:
|
102
|
+
script:
|
103
|
+
- bin/qa Test::Instance::RelativeUrl ${RELEASE:=CE}
|
104
|
+
<<: *test
|
105
|
+
<<: *high-capacity
|
106
|
+
<<: *ce-qa
|
107
|
+
|
108
|
+
ee:relative_url:
|
109
|
+
script:
|
110
|
+
- bin/qa Test::Instance::RelativeUrl ${RELEASE:=EE}
|
111
|
+
<<: *test
|
112
|
+
<<: *high-capacity
|
113
|
+
<<: *ee-qa
|
114
|
+
|
87
115
|
ce:image:
|
88
116
|
script:
|
89
117
|
- bin/qa Test::Omnibus::Image ${RELEASE:=CE}
|
@@ -159,6 +187,13 @@ ee:ldap:
|
|
159
187
|
<<: *high-capacity
|
160
188
|
<<: *ee-qa
|
161
189
|
|
190
|
+
ee:saml:
|
191
|
+
script:
|
192
|
+
- bin/qa Test::Integration::GroupSAML ${RELEASE:=EE}
|
193
|
+
<<: *test
|
194
|
+
<<: *high-capacity
|
195
|
+
<<: *ee-qa
|
196
|
+
|
162
197
|
ce:kubernetes:
|
163
198
|
script:
|
164
199
|
- bin/qa Test::Integration::Kubernetes ${RELEASE:=CE}
|
@@ -172,3 +207,17 @@ ee:kubernetes:
|
|
172
207
|
<<: *test
|
173
208
|
<<: *high-capacity
|
174
209
|
<<: *ee-qa
|
210
|
+
|
211
|
+
ce:object_storage:
|
212
|
+
script:
|
213
|
+
- bin/qa Test::Integration::ObjectStorage ${RELEASE:=CE}
|
214
|
+
<<: *test
|
215
|
+
<<: *high-capacity
|
216
|
+
<<: *ce-qa
|
217
|
+
|
218
|
+
ee:object_storage:
|
219
|
+
script:
|
220
|
+
- bin/qa Test::Integration::ObjectStorage ${RELEASE:=EE}
|
221
|
+
<<: *test
|
222
|
+
<<: *high-capacity
|
223
|
+
<<: *ee-qa
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
# Run the given SCRIPT and expect its exit code to be EXPECTED_EXIT_CODE and its
|
3
|
+
# output to include the given EXPECTED_TEXT.
|
4
|
+
# If the expectation succeeds, exit with 0, otherwise exit with 1.
|
5
|
+
# This is useful when you want don't care about a script's exit code but only
|
6
|
+
# care about its output.
|
7
|
+
|
8
|
+
SCRIPT=$1
|
9
|
+
EXPECTED_EXIT_CODE=$2
|
10
|
+
EXPECTED_TEXT=$3
|
11
|
+
|
12
|
+
mkdir -p gitlab-qa-run-expect_text
|
13
|
+
log_file="gitlab-qa-run-expect_text/log.txt"
|
14
|
+
|
15
|
+
if [ -z "$SCRIPT" ] || [ -z "$EXPECTED_EXIT_CODE" ] || [ -z "$EXPECTED_TEXT" ]; then
|
16
|
+
echo "Missing argument(s) - Use: $0 script expected_exit_code expected_text"
|
17
|
+
else
|
18
|
+
$SCRIPT > $log_file
|
19
|
+
SCRIPT_EXIT_CODE=$?
|
20
|
+
|
21
|
+
if [ "$SCRIPT_EXIT_CODE" -eq "$EXPECTED_EXIT_CODE" ]
|
22
|
+
then
|
23
|
+
echo "'$SCRIPT' exited with '$SCRIPT_EXIT_CODE', as expected!"
|
24
|
+
grep "$EXPECTED_TEXT" $log_file > /dev/null
|
25
|
+
|
26
|
+
if [ "$?" -eq "0" ]; then
|
27
|
+
echo "'$SCRIPT' outputted '$EXPECTED_TEXT', as expected!"
|
28
|
+
else
|
29
|
+
echo "'$SCRIPT' was expected to output '$EXPECTED_TEXT', but did not!"
|
30
|
+
exit 1
|
31
|
+
fi
|
32
|
+
else
|
33
|
+
echo "'$SCRIPT' was expected to exit with '$EXPECTED_EXIT_CODE', but exited with '$SCRIPT_EXIT_CODE' instead!"
|
34
|
+
exit 1
|
35
|
+
fi
|
36
|
+
fi
|
data/docs/run_qa_against_gdk.md
CHANGED
@@ -4,8 +4,13 @@ To run the `Test::Instance::Any` scenario against your local GDK, you'll need to
|
|
4
4
|
make a few changes to your `gdk/gitlab/config/gitlab.yml` file.
|
5
5
|
|
6
6
|
1. Retrieve your current local IP with `ifconfig`, e.g. `192.168.0.12`.
|
7
|
-
1. Edit `gdk/gitlab/config/gitlab.yml` and replace `host: localhost` with
|
8
|
-
|
7
|
+
1. Edit `gdk/gitlab/config/gitlab.yml` and replace `host: localhost` with
|
8
|
+
`host: 192.168.0.12`.
|
9
|
+
1. Also replace `ssh_host: localhost` (found under `gitlab_shell`) with
|
10
|
+
`ssh_host: 192.168.0.12`.
|
11
|
+
1. Enable the `sshd` service by uncommenting the relevant line in your
|
12
|
+
`Procfile`.
|
13
|
+
1. Edit `openssh/sshd_config` and set `ListenAddress` to `192.168.0.12`.
|
9
14
|
1. Restart your GDK
|
10
15
|
1. Run the QA scenario as follows:
|
11
16
|
|
@@ -32,9 +32,10 @@ For more details on the internals, please read the
|
|
32
32
|
* `GITLAB_PASSWORD` - password to use when signing into GitLab
|
33
33
|
* `GITLAB_FORKER_USERNAME` - username to use for forking a project
|
34
34
|
* `GITLAB_FORKER_PASSWORD` - password to use for forking a project
|
35
|
-
* `GITLAB_USER_TYPE` - type of user to use when signing into GitLab: standard (default), ldap
|
36
35
|
* `GITLAB_LDAP_USERNAME` - LDAP username to use when signing into GitLab
|
37
36
|
* `GITLAB_LDAP_PASSWORD` - LDAP password to use when signing into GitLab
|
37
|
+
* `GITLAB_ADMIN_USERNAME` - Admin username to use when adding a license
|
38
|
+
* `GITLAB_ADMIN_PASSWORD` - Admin password to use when adding a license
|
38
39
|
* `GITLAB_SANDBOX_NAME` - The sandbox group name the test suite is going to use (default: `gitlab-qa-sandbox`)
|
39
40
|
* `EE_LICENSE` - Enterprise Edition license
|
40
41
|
* `QA_ARTIFACTS_DIR` - Path to a directory where artifacts (logs and screenshots)
|
@@ -272,8 +273,26 @@ $ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
|
272
273
|
$ gitlab-qa Test::Instance::Staging
|
273
274
|
```
|
274
275
|
|
275
|
-
|
276
|
+
### `Test::Instance::Smoke`
|
277
|
+
|
278
|
+
This scenario will run a limited amount of tests selected from the test suite tagged by `:smoke`.
|
279
|
+
Smoke tests are quick tests that ensure that some basic functionality of GitLab works.
|
280
|
+
|
281
|
+
To run tests against the GitLab instance, a GitLab QA (`gitlab/gitlab-qa`)
|
282
|
+
container is spun up and tests are run from it by running the
|
283
|
+
`Test::Instance::Smoke` scenario (located under
|
284
|
+
[`gitlab-org/gitlab-ce@qa/qa/scenario/test/smoke.rb`][smoke-instance] in the
|
285
|
+
in the GitLab CE project).
|
286
|
+
|
287
|
+
Example:
|
288
|
+
|
289
|
+
```
|
290
|
+
$ gitlab-qa Test::Instance::Smoke ee:<tag> https://staging.gitlab.com
|
291
|
+
```
|
276
292
|
|
277
293
|
----
|
278
294
|
|
279
295
|
[Back to README.md](../README.md)
|
296
|
+
|
297
|
+
[test-instance]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/qa/scenario/test/instance/all.rb
|
298
|
+
[smoke-instance]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/qa/scenario/test/instance/smoke.rb
|
data/exe/gitlab-qa
CHANGED
@@ -1,7 +1,30 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'gitlab/qa'
|
4
|
+
require 'optparse'
|
4
5
|
|
5
|
-
|
6
|
-
.
|
7
|
-
|
6
|
+
options = OptionParser.new do |opts|
|
7
|
+
opts.banner = 'Usage: gitlab-qa [options] Scenario URL [[--] path] [rspec_options]'
|
8
|
+
|
9
|
+
opts.on('-v', '--version', 'Show the version') do
|
10
|
+
require 'gitlab/qa/version'
|
11
|
+
puts "#{$PROGRAM_NAME} : #{Gitlab::QA::VERSION}"
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
opts.on('-h', '--help', 'Show the usage') do
|
16
|
+
puts opts
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.parse!
|
21
|
+
end
|
22
|
+
|
23
|
+
if ARGV.size >= 1
|
24
|
+
Gitlab::QA::Scenario
|
25
|
+
.const_get(ARGV.shift)
|
26
|
+
.perform(*ARGV)
|
27
|
+
else
|
28
|
+
puts options
|
29
|
+
exit 1
|
30
|
+
end
|
data/lib/gitlab/qa.rb
CHANGED
@@ -16,6 +16,7 @@ module Gitlab
|
|
16
16
|
module Instance
|
17
17
|
autoload :Any, 'qa/scenario/test/instance/any'
|
18
18
|
autoload :Image, 'qa/scenario/test/instance/image'
|
19
|
+
autoload :RelativeUrl, 'qa/scenario/test/instance/relative_url'
|
19
20
|
autoload :Staging, 'qa/scenario/test/instance/staging'
|
20
21
|
autoload :Smoke, 'qa/scenario/test/instance/smoke'
|
21
22
|
end
|
@@ -29,8 +30,10 @@ module Gitlab
|
|
29
30
|
module Integration
|
30
31
|
autoload :Geo, 'qa/scenario/test/integration/geo'
|
31
32
|
autoload :LDAP, 'qa/scenario/test/integration/ldap'
|
33
|
+
autoload :GroupSAML, 'qa/scenario/test/integration/group_saml'
|
32
34
|
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
|
33
35
|
autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes'
|
36
|
+
autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage'
|
34
37
|
end
|
35
38
|
|
36
39
|
module Sanity
|
@@ -43,8 +46,10 @@ module Gitlab
|
|
43
46
|
autoload :Gitlab, 'qa/component/gitlab'
|
44
47
|
autoload :InternetTunnel, 'qa/component/internet_tunnel'
|
45
48
|
autoload :LDAP, 'qa/component/ldap'
|
49
|
+
autoload :SAML, 'qa/component/saml'
|
46
50
|
autoload :Specs, 'qa/component/specs'
|
47
51
|
autoload :Staging, 'qa/component/staging'
|
52
|
+
autoload :Minio, 'qa/component/minio'
|
48
53
|
end
|
49
54
|
|
50
55
|
module Docker
|
@@ -12,7 +12,7 @@ module Gitlab
|
|
12
12
|
|
13
13
|
attr_reader :release, :docker
|
14
14
|
attr_accessor :volumes, :network, :environment
|
15
|
-
attr_writer :name
|
15
|
+
attr_writer :name, :relative_path
|
16
16
|
|
17
17
|
def_delegators :release, :tag, :image, :edition
|
18
18
|
|
@@ -42,13 +42,17 @@ module Gitlab
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def address
|
45
|
-
"http://#{hostname}"
|
45
|
+
"http://#{hostname}#{relative_path}"
|
46
46
|
end
|
47
47
|
|
48
48
|
def hostname
|
49
49
|
"#{name}.#{network}"
|
50
50
|
end
|
51
51
|
|
52
|
+
def relative_path
|
53
|
+
@relative_path ||= ''
|
54
|
+
end
|
55
|
+
|
52
56
|
def instance
|
53
57
|
raise 'Please provide a block!' unless block_given?
|
54
58
|
|
@@ -116,7 +120,7 @@ module Gitlab
|
|
116
120
|
end
|
117
121
|
|
118
122
|
def wait
|
119
|
-
if Availability.new(name).check(180)
|
123
|
+
if Availability.new(name, relative_path: relative_path).check(180)
|
120
124
|
sleep 12 # TODO, handle that better
|
121
125
|
puts ' -> GitLab is available.'
|
122
126
|
else
|
@@ -145,13 +149,13 @@ module Gitlab
|
|
145
149
|
end
|
146
150
|
|
147
151
|
class Availability
|
148
|
-
def initialize(name)
|
152
|
+
def initialize(name, relative_path: '')
|
149
153
|
@docker = Docker::Engine.new
|
150
154
|
|
151
155
|
host = @docker.hostname
|
152
156
|
port = @docker.port(name, 80).split(':').last
|
153
157
|
|
154
|
-
@uri = URI.join("http://#{host}:#{port}", '
|
158
|
+
@uri = URI.join("http://#{host}:#{port}", "#{relative_path}/", 'help')
|
155
159
|
end
|
156
160
|
|
157
161
|
def check(retries)
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
# This component sets up the Minio (https://hub.docker.com/r/minio/minio)
|
5
|
+
# image with the proper configuration for GitLab users to use object storage.
|
6
|
+
module Gitlab
|
7
|
+
module QA
|
8
|
+
module Component
|
9
|
+
class Minio
|
10
|
+
include Scenario::Actable
|
11
|
+
|
12
|
+
MINIO_IMAGE = 'minio/minio'.freeze
|
13
|
+
MINIO_IMAGE_TAG = 'latest'.freeze
|
14
|
+
AWS_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE'.freeze
|
15
|
+
AWS_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'.freeze
|
16
|
+
DATA_DIR = '/data'.freeze
|
17
|
+
DEFAULT_PORT = 9000
|
18
|
+
|
19
|
+
attr_reader :docker
|
20
|
+
attr_accessor :volumes, :network, :environment
|
21
|
+
attr_writer :name
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@docker = Docker::Engine.new
|
25
|
+
@environment = { MINIO_ACCESS_KEY: AWS_ACCESS_KEY, MINIO_SECRET_KEY: AWS_SECRET_KEY }
|
26
|
+
@volumes = { host_data_dir => DATA_DIR }
|
27
|
+
@buckets = []
|
28
|
+
end
|
29
|
+
|
30
|
+
def instance
|
31
|
+
raise 'Please provide a block!' unless block_given?
|
32
|
+
|
33
|
+
prepare
|
34
|
+
start
|
35
|
+
|
36
|
+
yield self
|
37
|
+
|
38
|
+
teardown
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_bucket(name)
|
42
|
+
@buckets << name
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_config
|
46
|
+
config = YAML.safe_load <<~CFG
|
47
|
+
provider: AWS
|
48
|
+
aws_access_key_id: #{AWS_ACCESS_KEY}
|
49
|
+
aws_secret_access_key: #{AWS_SECRET_KEY}
|
50
|
+
aws_signature_version: 4
|
51
|
+
host: #{hostname}
|
52
|
+
endpoint: http://#{hostname}:#{port}
|
53
|
+
path_style: true
|
54
|
+
CFG
|
55
|
+
|
56
|
+
# Quotes get eaten up when the string is set in the environment
|
57
|
+
config.to_s.gsub('"', '\\"')
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def host_data_dir
|
63
|
+
base_dir = ENV['CI_PROJECT_DIR'] || '/tmp'
|
64
|
+
|
65
|
+
File.join(base_dir, 'minio')
|
66
|
+
end
|
67
|
+
|
68
|
+
def name
|
69
|
+
@name ||= "minio-#{SecureRandom.hex(4)}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def hostname
|
73
|
+
"#{name}.#{network}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def port
|
77
|
+
DEFAULT_PORT
|
78
|
+
end
|
79
|
+
|
80
|
+
def prepare
|
81
|
+
@docker.pull(MINIO_IMAGE, MINIO_IMAGE_TAG)
|
82
|
+
|
83
|
+
FileUtils.mkdir_p(host_data_dir)
|
84
|
+
|
85
|
+
@buckets.each do |bucket|
|
86
|
+
puts "Creating Minio bucket: #{bucket}"
|
87
|
+
FileUtils.mkdir_p(File.join(host_data_dir, bucket))
|
88
|
+
end
|
89
|
+
|
90
|
+
return if @docker.network_exists?(network)
|
91
|
+
|
92
|
+
@docker.network_create(network)
|
93
|
+
end
|
94
|
+
|
95
|
+
def start
|
96
|
+
docker.run(MINIO_IMAGE, MINIO_IMAGE_TAG, "server", DATA_DIR) do |command|
|
97
|
+
command << '-d '
|
98
|
+
command << "--name #{name}"
|
99
|
+
command << "--net #{network}"
|
100
|
+
command << "--hostname #{hostname}"
|
101
|
+
|
102
|
+
@volumes.to_h.each do |to, from|
|
103
|
+
command.volume(to, from, 'Z')
|
104
|
+
end
|
105
|
+
|
106
|
+
@environment.to_h.each do |key, value|
|
107
|
+
command.env(key, value)
|
108
|
+
end
|
109
|
+
|
110
|
+
@network_aliases.to_a.each do |network_alias|
|
111
|
+
command << "--network-alias #{network_alias}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def teardown
|
117
|
+
raise 'Invalid instance name!' unless name
|
118
|
+
|
119
|
+
@docker.stop(name)
|
120
|
+
@docker.remove(name)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
# This component sets up the docker-test-saml-idp (https://github.com/kristophjunge/docker-test-saml-idp)
|
4
|
+
# image with the proper configuration for SAML integration.
|
5
|
+
|
6
|
+
module Gitlab
|
7
|
+
module QA
|
8
|
+
module Component
|
9
|
+
class SAML
|
10
|
+
include Scenario::Actable
|
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
|
25
|
+
|
26
|
+
def set_entity_id(entity_id)
|
27
|
+
@environment['SIMPLESAMLPHP_SP_ENTITY_ID'] = entity_id
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_assertion_consumer_service(assertion_con_service)
|
31
|
+
@environment['SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE'] = assertion_con_service
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_network_alias(name)
|
35
|
+
@network_aliases.push(name)
|
36
|
+
end
|
37
|
+
|
38
|
+
def name
|
39
|
+
@name ||= "saml-qa-idp"
|
40
|
+
end
|
41
|
+
|
42
|
+
def hostname
|
43
|
+
"#{name}.#{network}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def group_name
|
47
|
+
@group_name ||= "saml_sso_group-#{SecureRandom.hex(4)}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def instance
|
51
|
+
raise 'Please provide a block!' unless block_given?
|
52
|
+
|
53
|
+
prepare
|
54
|
+
start
|
55
|
+
|
56
|
+
yield self
|
57
|
+
|
58
|
+
teardown
|
59
|
+
end
|
60
|
+
|
61
|
+
def prepare
|
62
|
+
pull
|
63
|
+
|
64
|
+
return if @docker.network_exists?(network)
|
65
|
+
|
66
|
+
@docker.network_create(network)
|
67
|
+
end
|
68
|
+
|
69
|
+
# rubocop:disable Metrics/AbcSize
|
70
|
+
def start
|
71
|
+
docker.run(SAML_IMAGE, SAML_IMAGE_TAG) do |command|
|
72
|
+
command << '-d '
|
73
|
+
command << "--name #{name}"
|
74
|
+
command << "--net #{network}"
|
75
|
+
command << "--hostname #{hostname}"
|
76
|
+
command << "--publish 8080:8080"
|
77
|
+
command << "--publish 8443:8443"
|
78
|
+
|
79
|
+
@volumes.to_h.each do |to, from|
|
80
|
+
command.volume(to, from, 'Z')
|
81
|
+
end
|
82
|
+
|
83
|
+
@environment.to_h.each do |key, value|
|
84
|
+
command.env(key, value)
|
85
|
+
end
|
86
|
+
|
87
|
+
@network_aliases.to_a.each do |network_alias|
|
88
|
+
command << "--network-alias #{network_alias}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
# rubocop:enable Metrics/AbcSize
|
93
|
+
|
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
|
+
def set_sandbox_name(sandbox_name)
|
110
|
+
::Gitlab::QA::Runtime::Env.gitlab_sandbox_name = sandbox_name
|
111
|
+
end
|
112
|
+
|
113
|
+
def set_simple_saml_hostname
|
114
|
+
::Gitlab::QA::Runtime::Env.simple_saml_hostname = hostname
|
115
|
+
end
|
116
|
+
|
117
|
+
def set_accept_insecure_certs
|
118
|
+
::Gitlab::QA::Runtime::Env.accept_insecure_certs = 'true'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -7,6 +7,8 @@ module Gitlab
|
|
7
7
|
extend self
|
8
8
|
|
9
9
|
ENV_VARIABLES = {
|
10
|
+
'GITLAB_ADMIN_USERNAME' => :admin_username,
|
11
|
+
'GITLAB_ADMIN_PASSWORD' => :admin_password,
|
10
12
|
'GITLAB_USERNAME' => :user_username,
|
11
13
|
'GITLAB_PASSWORD' => :user_password,
|
12
14
|
'GITLAB_LDAP_USERNAME' => :ldap_username,
|
@@ -18,6 +20,8 @@ module Gitlab
|
|
18
20
|
'GITLAB_QA_ACCESS_TOKEN' => :qa_access_token,
|
19
21
|
'GITHUB_ACCESS_TOKEN' => :github_access_token,
|
20
22
|
'GITLAB_URL' => :gitlab_url,
|
23
|
+
'SIMPLE_SAML_HOSTNAME' => :simple_saml_hostname,
|
24
|
+
'ACCEPT_INSECURE_CERTS' => :accept_insecure_certs,
|
21
25
|
'EE_LICENSE' => :ee_license,
|
22
26
|
'GCLOUD_ACCOUNT_EMAIL' => :gcloud_account_email,
|
23
27
|
'GCLOUD_ACCOUNT_KEY' => :gcloud_account_key,
|
@@ -10,7 +10,7 @@ module Gitlab
|
|
10
10
|
@volumes = {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def perform(release)
|
13
|
+
def perform(release, *rspec_args)
|
14
14
|
Component::Gitlab.perform do |gitlab|
|
15
15
|
gitlab.release = release
|
16
16
|
gitlab.volumes = @volumes
|
@@ -21,7 +21,7 @@ module Gitlab
|
|
21
21
|
specs.suite = 'Test::Instance'
|
22
22
|
specs.release = gitlab.release
|
23
23
|
specs.network = gitlab.network
|
24
|
-
specs.args = [gitlab.address]
|
24
|
+
specs.args = [gitlab.address, *rspec_args]
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Gitlab
|
2
|
+
module QA
|
3
|
+
module Scenario
|
4
|
+
module Test
|
5
|
+
module Instance
|
6
|
+
class RelativeUrl < Image
|
7
|
+
def perform(release)
|
8
|
+
Component::Gitlab.perform do |gitlab|
|
9
|
+
gitlab.release = release
|
10
|
+
gitlab.network = 'test'
|
11
|
+
gitlab.relative_path = '/relative'
|
12
|
+
|
13
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
14
|
+
external_url '#{gitlab.address}'
|
15
|
+
OMNIBUS
|
16
|
+
|
17
|
+
gitlab.instance do
|
18
|
+
Component::Specs.perform do |specs|
|
19
|
+
specs.suite = 'Test::Instance'
|
20
|
+
specs.release = gitlab.release
|
21
|
+
specs.network = gitlab.network
|
22
|
+
specs.args = [gitlab.address]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class GroupSAML < Scenario::Template
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def perform(release)
|
11
|
+
release = Release.new(release)
|
12
|
+
|
13
|
+
raise ArgumentError, 'Group SAML is EE only feature!' unless release.ee?
|
14
|
+
|
15
|
+
Component::Gitlab.perform do |gitlab|
|
16
|
+
gitlab.release = release.edition
|
17
|
+
gitlab.name = 'gitlab-saml'
|
18
|
+
gitlab.network = 'test'
|
19
|
+
|
20
|
+
Component::SAML.perform do |saml|
|
21
|
+
saml.network = 'test'
|
22
|
+
saml.set_entity_id("#{gitlab.address}/groups/#{saml.group_name}")
|
23
|
+
saml.set_assertion_consumer_service("#{gitlab.address}/groups/#{saml.group_name}/-/saml/callback")
|
24
|
+
saml.set_sandbox_name(saml.group_name)
|
25
|
+
saml.set_simple_saml_hostname
|
26
|
+
saml.set_accept_insecure_certs
|
27
|
+
|
28
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
29
|
+
gitlab_rails['omniauth_enabled'] = true;
|
30
|
+
gitlab_rails['omniauth_providers'] = [{ name: 'group_saml' }];
|
31
|
+
OMNIBUS
|
32
|
+
|
33
|
+
saml.instance do
|
34
|
+
gitlab.instance do
|
35
|
+
puts 'Running SAML specs!'
|
36
|
+
|
37
|
+
Component::Specs.perform do |specs|
|
38
|
+
specs.suite = 'QA::EE::Scenario::Test::Integration::GroupSAML'
|
39
|
+
specs.release = release
|
40
|
+
specs.network = gitlab.network
|
41
|
+
specs.args = [gitlab.address]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
# rubocop:enable Metrics/AbcSize
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class ObjectStorage < Scenario::Template
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def perform(release)
|
11
|
+
Component::Gitlab.perform do |gitlab|
|
12
|
+
gitlab.release = release
|
13
|
+
gitlab.name = 'gitlab-object-storage'
|
14
|
+
gitlab.network = 'test'
|
15
|
+
|
16
|
+
Component::Minio.perform do |minio|
|
17
|
+
minio.network = 'test'
|
18
|
+
minio.add_bucket('upload-bucket')
|
19
|
+
|
20
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
21
|
+
gitlab_rails['uploads_object_store_enabled'] = true;
|
22
|
+
gitlab_rails['uploads_object_store_remote_directory'] = 'upload-bucket';
|
23
|
+
gitlab_rails['uploads_object_store_background_upload'] = false;
|
24
|
+
gitlab_rails['uploads_object_store_direct_upload'] = true;
|
25
|
+
gitlab_rails['uploads_object_store_proxy_download'] = true;
|
26
|
+
gitlab_rails['uploads_object_store_connection'] = #{minio.to_config};
|
27
|
+
OMNIBUS
|
28
|
+
|
29
|
+
minio.instance do
|
30
|
+
gitlab.instance do
|
31
|
+
puts 'Running object store specs!'
|
32
|
+
|
33
|
+
Component::Specs.perform do |specs|
|
34
|
+
specs.suite = 'Test::Integration::ObjectStorage'
|
35
|
+
specs.release = gitlab.release
|
36
|
+
specs.network = gitlab.network
|
37
|
+
specs.args = [gitlab.address]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
# rubocop:enable Metrics/AbcSize
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
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: 2.
|
4
|
+
version: 2.5.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: 2018-
|
11
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- README.md
|
129
129
|
- Rakefile
|
130
130
|
- bin/console
|
131
|
+
- bin/expect_exit_code_and_text
|
131
132
|
- bin/qa
|
132
133
|
- bin/setup
|
133
134
|
- docs/README.md
|
@@ -144,6 +145,8 @@ files:
|
|
144
145
|
- lib/gitlab/qa/component/gitlab.rb
|
145
146
|
- lib/gitlab/qa/component/internet_tunnel.rb
|
146
147
|
- lib/gitlab/qa/component/ldap.rb
|
148
|
+
- lib/gitlab/qa/component/minio.rb
|
149
|
+
- lib/gitlab/qa/component/saml.rb
|
147
150
|
- lib/gitlab/qa/component/specs.rb
|
148
151
|
- lib/gitlab/qa/component/staging.rb
|
149
152
|
- lib/gitlab/qa/docker/command.rb
|
@@ -156,12 +159,15 @@ files:
|
|
156
159
|
- lib/gitlab/qa/scenario/template.rb
|
157
160
|
- lib/gitlab/qa/scenario/test/instance/any.rb
|
158
161
|
- lib/gitlab/qa/scenario/test/instance/image.rb
|
162
|
+
- lib/gitlab/qa/scenario/test/instance/relative_url.rb
|
159
163
|
- lib/gitlab/qa/scenario/test/instance/smoke.rb
|
160
164
|
- lib/gitlab/qa/scenario/test/instance/staging.rb
|
161
165
|
- lib/gitlab/qa/scenario/test/integration/geo.rb
|
166
|
+
- lib/gitlab/qa/scenario/test/integration/group_saml.rb
|
162
167
|
- lib/gitlab/qa/scenario/test/integration/kubernetes.rb
|
163
168
|
- lib/gitlab/qa/scenario/test/integration/ldap.rb
|
164
169
|
- lib/gitlab/qa/scenario/test/integration/mattermost.rb
|
170
|
+
- lib/gitlab/qa/scenario/test/integration/object_storage.rb
|
165
171
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|
166
172
|
- lib/gitlab/qa/scenario/test/omnibus/update.rb
|
167
173
|
- lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
|