gitlab-qa 1.0.1 → 2.0.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 +50 -24
- data/.rubocop.yml +3 -0
- data/README.md +3 -3
- data/docs/README.md +1 -1
- data/docs/{run_geo_qa_against_gdk.md → run_qa_against_gdk.md} +30 -4
- data/docs/what_tests_can_be_run.md +12 -4
- data/lib/gitlab/qa.rb +2 -0
- data/lib/gitlab/qa/component/gitlab.rb +2 -4
- data/lib/gitlab/qa/component/internet_tunnel.rb +94 -0
- data/lib/gitlab/qa/component/specs.rb +8 -4
- data/lib/gitlab/qa/component/staging.rb +7 -1
- data/lib/gitlab/qa/release.rb +5 -0
- data/lib/gitlab/qa/runtime/env.rb +21 -5
- data/lib/gitlab/qa/scenario/test/instance/staging.rb +13 -2
- data/lib/gitlab/qa/scenario/test/integration/kubernetes.rb +56 -0
- data/lib/gitlab/qa/scenario/test/omnibus/update.rb +4 -6
- 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: c17e7bee760ef32484d6f507fd02608e47770000ec56f04b8ea24974e97c6c7d
|
4
|
+
data.tar.gz: cbacf02dfcda7387f1d0e9fcaad84d13ce95f123e25b36b8beb3ddcda6ac68ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6dabae50aa76d1495294821144ba623244daaf523d17fe3ff9d4503df5734880e8c4b54017d303d898d192bc638636b0352254d24cf7f62e52bac6973a3e4a1
|
7
|
+
data.tar.gz: 83f9fa4f377e1503551acb8a3eba379e301553f95e4de95c811c86a5d63dd96e54dfed864a16800629d9c0fa3434851b14ee034f939f98904dba1c975dcfb105
|
data/.gitlab-ci.yml
CHANGED
@@ -5,14 +5,12 @@ stages:
|
|
5
5
|
- check
|
6
6
|
- sanity
|
7
7
|
- test
|
8
|
-
- qa
|
9
8
|
|
10
9
|
variables:
|
11
10
|
TEST_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa
|
12
11
|
DOCKER_DRIVER: overlay
|
13
12
|
DOCKER_HOST: tcp://docker:2375
|
14
|
-
|
15
|
-
QA_LOGS_DIR: $CI_PROJECT_DIR/logs
|
13
|
+
QA_ARTIFACTS_DIR: $CI_PROJECT_DIR
|
16
14
|
|
17
15
|
before_script:
|
18
16
|
- bundle install
|
@@ -66,8 +64,24 @@ ee:version:
|
|
66
64
|
when: on_failure
|
67
65
|
expire_in: 30d
|
68
66
|
paths:
|
69
|
-
-
|
70
|
-
|
67
|
+
- ./gitlab-qa-run-*
|
68
|
+
|
69
|
+
.ce-qa: &ce-qa
|
70
|
+
only:
|
71
|
+
variables:
|
72
|
+
- $RELEASE == null
|
73
|
+
- $RELEASE =~ /gitlab-ce/
|
74
|
+
|
75
|
+
.ee-qa: &ee-qa
|
76
|
+
only:
|
77
|
+
variables:
|
78
|
+
- $RELEASE == null
|
79
|
+
- $RELEASE =~ /gitlab-ee/
|
80
|
+
|
81
|
+
.only-qa: &only-qa
|
82
|
+
except:
|
83
|
+
variables:
|
84
|
+
- $RELEASE
|
71
85
|
|
72
86
|
.high-capacity: &high-capacity
|
73
87
|
tags:
|
@@ -76,104 +90,116 @@ ee:version:
|
|
76
90
|
- triggered-packages
|
77
91
|
|
78
92
|
ce:instance:
|
79
|
-
# Checking if the build is triggered for a EE image. In that case, we need
|
80
|
-
# not run CE specific tests. This doesn't apply to nightly/regular branch
|
81
|
-
# builds as RELEASE will not match gitlab-ce in those cases.
|
82
93
|
script:
|
83
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
84
94
|
- bin/qa Test::Instance::Image ${RELEASE:=CE}
|
85
95
|
<<: *test
|
86
96
|
<<: *high-capacity
|
97
|
+
<<: *ce-qa
|
87
98
|
|
88
99
|
ee:instance:
|
89
100
|
script:
|
90
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
91
101
|
- bin/qa Test::Instance::Image ${RELEASE:=EE}
|
92
102
|
<<: *test
|
93
103
|
<<: *high-capacity
|
104
|
+
<<: *ee-qa
|
94
105
|
|
95
106
|
ce:image:
|
96
107
|
script:
|
97
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
98
108
|
- bin/qa Test::Omnibus::Image ${RELEASE:=CE}
|
99
109
|
<<: *test
|
110
|
+
<<: *ce-qa
|
100
111
|
|
101
112
|
ee:image:
|
102
113
|
script:
|
103
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
104
114
|
- bin/qa Test::Omnibus::Image ${RELEASE:=EE}
|
105
115
|
<<: *test
|
116
|
+
<<: *ee-qa
|
106
117
|
|
107
118
|
ce:update:
|
108
119
|
script:
|
109
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
110
120
|
- bin/qa Test::Omnibus::Update ${RELEASE:=CE}
|
111
121
|
<<: *test
|
112
122
|
<<: *high-capacity
|
123
|
+
<<: *ce-qa
|
113
124
|
|
114
125
|
ee:update:
|
115
126
|
script:
|
116
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
117
127
|
- bin/qa Test::Omnibus::Update ${RELEASE:=EE}
|
118
128
|
<<: *test
|
119
129
|
<<: *high-capacity
|
130
|
+
<<: *ee-qa
|
120
131
|
|
121
|
-
|
132
|
+
ce:upgrade:
|
122
133
|
script:
|
123
|
-
|
134
|
+
- bin/qa Test::Omnibus::Upgrade
|
124
135
|
<<: *test
|
125
136
|
<<: *high-capacity
|
137
|
+
<<: *only-qa
|
126
138
|
|
127
|
-
ce:
|
139
|
+
ee-previous-to-ce:update:
|
128
140
|
script:
|
129
|
-
|
130
|
-
- bin/qa Test::Omnibus::Upgrade
|
141
|
+
- bin/qa Test::Omnibus::Update EE CE
|
131
142
|
<<: *test
|
132
143
|
<<: *high-capacity
|
144
|
+
<<: *only-qa
|
133
145
|
|
134
146
|
ce:mattermost:
|
135
147
|
script:
|
136
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
137
148
|
- bin/qa Test::Integration::Mattermost ${RELEASE:=CE}
|
138
149
|
<<: *test
|
139
150
|
<<: *high-capacity
|
151
|
+
<<: *ce-qa
|
140
152
|
|
141
153
|
ee:mattermost:
|
142
154
|
script:
|
143
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
144
155
|
- bin/qa Test::Integration::Mattermost ${RELEASE:=EE}
|
145
156
|
<<: *test
|
146
157
|
<<: *high-capacity
|
158
|
+
<<: *ee-qa
|
147
159
|
|
148
160
|
ee:geo:
|
149
161
|
script:
|
150
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
151
162
|
- bin/qa Test::Integration::Geo ${RELEASE:=EE}
|
152
163
|
<<: *test
|
153
164
|
<<: *high-capacity
|
165
|
+
<<: *ee-qa
|
154
166
|
|
155
167
|
ce:ldap:
|
156
168
|
script:
|
157
169
|
- bin/qa Test::Integration::LDAP ${RELEASE:=CE}
|
158
170
|
<<: *test
|
159
171
|
<<: *high-capacity
|
172
|
+
<<: *ce-qa
|
160
173
|
|
161
174
|
ee:ldap:
|
162
175
|
script:
|
163
176
|
- bin/qa Test::Integration::LDAP ${RELEASE:=EE}
|
164
177
|
<<: *test
|
165
178
|
<<: *high-capacity
|
179
|
+
<<: *ee-qa
|
180
|
+
|
181
|
+
ce:kubernetes:
|
182
|
+
script:
|
183
|
+
- bin/qa Test::Integration::Kubernetes ${RELEASE:=CE}
|
184
|
+
<<: *test
|
185
|
+
<<: *high-capacity
|
186
|
+
<<: *ce-qa
|
187
|
+
|
188
|
+
ee:kubernetes:
|
189
|
+
script:
|
190
|
+
- bin/qa Test::Integration::Kubernetes ${RELEASE:=EE}
|
191
|
+
<<: *test
|
192
|
+
<<: *high-capacity
|
193
|
+
<<: *ee-qa
|
166
194
|
|
167
195
|
qa:staging:
|
168
196
|
script:
|
169
|
-
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
170
197
|
- export GITLAB_USERNAME="gitlab-qa"
|
171
198
|
- export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
172
199
|
- unset EE_LICENSE
|
173
200
|
- bin/qa Test::Instance::Staging
|
174
201
|
<<: *test
|
175
202
|
retry: 0
|
176
|
-
stage: qa
|
177
203
|
when: manual
|
178
204
|
except:
|
179
205
|
- triggers
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -98,9 +98,9 @@ GitLab QA tool is published as a [Ruby Gem](https://rubygems.org/gems/gitlab-qa)
|
|
98
98
|
You can install it with `gem install gitlab-qa`. It will expose a `gitlab-qa`
|
99
99
|
command in your system.
|
100
100
|
|
101
|
-
If you want to run the scenarios or develop them on Mac OS,
|
102
|
-
[
|
103
|
-
that may work differently.
|
101
|
+
If you want to run the scenarios against your GDK and/or develop them on Mac OS,
|
102
|
+
please read [Run QA tests against your GDK setup](/docs/run_qa_against_gdk.md)
|
103
|
+
as there are caveats and things that may work differently.
|
104
104
|
|
105
105
|
All the scenarios you can run are described in the
|
106
106
|
[What tests can be run?](/docs/what_tests_can_be_run.md) documentation.
|
data/docs/README.md
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
- [Architecture](architecture.md)
|
4
4
|
- [How it works](how_it_works.md)
|
5
5
|
- [What tests can be run?](what_tests_can_be_run.md)
|
6
|
-
- [Run
|
6
|
+
- [Run QA tests against your GDK setup](run_qa_against_gdk.md)
|
7
7
|
- [Trainings](trainings.md)
|
8
8
|
- [Waits](waits.md)
|
@@ -1,4 +1,30 @@
|
|
1
|
-
# Run
|
1
|
+
# Run QA tests against your GDK setup
|
2
|
+
|
3
|
+
To run the `Test::Instance::Any` scenario against your local GDK, you'll need to
|
4
|
+
make a few changes to your `gdk/gitlab/config/gitlab.yml` file.
|
5
|
+
|
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
|
+
`host: 192.168.0.12`.
|
9
|
+
1. Restart your GDK
|
10
|
+
1. Run the QA scenario as follows:
|
11
|
+
|
12
|
+
```
|
13
|
+
$ gitlab-qa Test::Instance::Any CE http://192.168.0.12:3000 -- qa/specs/features/repository/protected_branches_spec.rb:30
|
14
|
+
|
15
|
+
# Or if you want to run your local `gitlab-qa/bin/qa`:
|
16
|
+
$ bin/qa Test::Instance::Any CE http://192.168.0.12:3000 -- qa/specs/features/repository/protected_branches_spec.rb:30
|
17
|
+
|
18
|
+
# And if you want to test your local `gdk/gitlab/qa` changes, you'll need to
|
19
|
+
# build the QA image first
|
20
|
+
# In gdk/gitlab/qa:
|
21
|
+
$ docker build -t gitlab/gitlab-ce-qa:your-custom-tag .
|
22
|
+
|
23
|
+
# Then in gitlab-qa:
|
24
|
+
$ bin/qa Test::Instance::Any gitlab/gitlab-ce:your-custom-tag http://192.168.0.12:3000 -- qa/specs/features/repository/protected_branches_spec.rb:30
|
25
|
+
```
|
26
|
+
|
27
|
+
## Run Geo QA tests against your Geo GDK setup
|
2
28
|
|
3
29
|
Run from the `gdk-ee/gitlab/qa` directory with GDK primary and secondary running:
|
4
30
|
|
@@ -10,7 +36,7 @@ bin/qa QA::EE::Scenario::Test::Geo --primary-address http://localhost:3001 --sec
|
|
10
36
|
CHROME_HEADLESS=false bin/qa QA::EE::Scenario::Test::Geo --primary-address http://localhost:3001 --secondary-address http://localhost:3002 --primary-name primary --secondary-name secondary --without-setup
|
11
37
|
```
|
12
38
|
|
13
|
-
|
39
|
+
### QA Tool support on macOS
|
14
40
|
|
15
41
|
Most of our development for GitLab is done on macOS. This brings some challenges as Docker on
|
16
42
|
macOS doesn't have feature parity with it's Linux conterpart.
|
@@ -38,7 +64,7 @@ When using the `route` command to expose the internet network, you still need to
|
|
38
64
|
There is another tool called [dnsdock][dnsdock] that may do the trick. That means you need to change
|
39
65
|
your DNS and point to the IP/port of `dnsdock` application.
|
40
66
|
|
41
|
-
|
67
|
+
### Docker on macOS caveats
|
42
68
|
|
43
69
|
When using OS X Docker, you need to go to Preferences > Advanced and allocate at least **5.0 GB**,
|
44
70
|
otherwise some steps may fail to execute the `chrome-webdriver`.
|
@@ -59,7 +85,7 @@ Docker Inc [doesn't want to fix][Docker bridge issue].
|
|
59
85
|
|
60
86
|
To see if this limitation is still present, check the [documentation][Docker Networking].
|
61
87
|
|
62
|
-
|
88
|
+
#### Workarounds
|
63
89
|
|
64
90
|
One possible workaround to connect to a multi-node environment like Geo, is to run a reverse proxy on your
|
65
91
|
development machine that maps the VHOST to `localhost:port`, changing to the ports listed in `docker ps`.
|
@@ -35,10 +35,8 @@ For more details on the internals, please read the
|
|
35
35
|
* `GITLAB_LDAP_PASSWORD` - LDAP password to use when signing into GitLab
|
36
36
|
* `GITLAB_SANDBOX_NAME` - The sandbox group name the test suite is going to use (default: `gitlab-qa-sandbox`)
|
37
37
|
* `EE_LICENSE` - Enterprise Edition license
|
38
|
-
* `
|
39
|
-
will be saved (default: `/tmp/gitlab-qa
|
40
|
-
* `QA_LOGS_DIR` - Path to a directory where logs will be saved (default:
|
41
|
-
`/tmp/gitlab-qa/logs`)
|
38
|
+
* `QA_ARTIFACTS_DIR` - Path to a directory where artifacts (logs and screenshots)
|
39
|
+
for failing tests will be saved (default: `/tmp/gitlab-qa`)
|
42
40
|
* `DOCKER_HOST` - Docker host to run tests against (default: `http://localhost`)
|
43
41
|
* `CHROME_HEADLESS` - when running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run
|
44
42
|
|
@@ -248,11 +246,21 @@ in the GitLab CE project).
|
|
248
246
|
|
249
247
|
- `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
|
250
248
|
This is used to retrieve the version that staging is currently running.
|
249
|
+
This can be found in the shared 1Password vault.
|
250
|
+
|
251
|
+
**Optional environment variables:**
|
252
|
+
|
253
|
+
- `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
|
254
|
+
`gitlab-qa-bot` on `dev.gitlab.org` with the `registry` scope.
|
255
|
+
This is used to pull the QA Docker from the Omnibus GitLab `dev` Container Registry.
|
256
|
+
If the variable isn't present, the QA image from Docker Hub will be used.
|
257
|
+
This can be found in the shared 1Password vault.
|
251
258
|
|
252
259
|
Example:
|
253
260
|
|
254
261
|
```
|
255
262
|
$ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
|
263
|
+
$ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
|
256
264
|
$ export GITLAB_USERNAME="gitlab-qa"
|
257
265
|
$ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
258
266
|
|
data/lib/gitlab/qa.rb
CHANGED
@@ -29,6 +29,7 @@ module Gitlab
|
|
29
29
|
autoload :Geo, 'qa/scenario/test/integration/geo'
|
30
30
|
autoload :LDAP, 'qa/scenario/test/integration/ldap'
|
31
31
|
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
|
32
|
+
autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes'
|
32
33
|
end
|
33
34
|
|
34
35
|
module Sanity
|
@@ -39,6 +40,7 @@ module Gitlab
|
|
39
40
|
|
40
41
|
module Component
|
41
42
|
autoload :Gitlab, 'qa/component/gitlab'
|
43
|
+
autoload :InternetTunnel, 'qa/component/internet_tunnel'
|
42
44
|
autoload :LDAP, 'qa/component/ldap'
|
43
45
|
autoload :Specs, 'qa/component/specs'
|
44
46
|
autoload :Staging, 'qa/component/staging'
|
@@ -38,7 +38,7 @@ module Gitlab
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def name
|
41
|
-
@name ||= "gitlab
|
41
|
+
@name ||= "gitlab-#{edition}-#{SecureRandom.hex(4)}"
|
42
42
|
end
|
43
43
|
|
44
44
|
def address
|
@@ -83,9 +83,7 @@ module Gitlab
|
|
83
83
|
command.volume(to, from, 'Z')
|
84
84
|
end
|
85
85
|
|
86
|
-
File.join(Runtime::Env.
|
87
|
-
command.volume(logs_dir, '/var/log/gitlab', 'Z')
|
88
|
-
end
|
86
|
+
command.volume(File.join(Runtime::Env.host_artifacts_dir, name, 'logs'), '/var/log/gitlab', 'Z')
|
89
87
|
|
90
88
|
@environment.to_h.each do |key, value|
|
91
89
|
command.env(key, value)
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Component
|
6
|
+
class InternetTunnel
|
7
|
+
include Scenario::Actable
|
8
|
+
|
9
|
+
DOCKER_IMAGE = 'dylangriffith/ssh'.freeze
|
10
|
+
DOCKER_IMAGE_TAG = 'latest'.freeze
|
11
|
+
|
12
|
+
attr_writer :gitlab_hostname, :name
|
13
|
+
attr_accessor :network
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@docker = Docker::Engine.new
|
17
|
+
@volumes = {}
|
18
|
+
|
19
|
+
key_dir = ENV['CI_PROJECT_DIR'] || Dir.tmpdir
|
20
|
+
@ssh_key = Tempfile.new('tunnel-ssh-private-key', key_dir)
|
21
|
+
@ssh_key.write(ENV.fetch('TUNNEL_SSH_PRIVATE_KEY'))
|
22
|
+
@ssh_key.close
|
23
|
+
|
24
|
+
File.chmod(0o600, @ssh_key.path)
|
25
|
+
|
26
|
+
@volumes['/root/.ssh/id_rsa'] = @ssh_key.path
|
27
|
+
end
|
28
|
+
|
29
|
+
def instance
|
30
|
+
raise ArgumentError, 'Please provide a block!' unless block_given?
|
31
|
+
|
32
|
+
prepare
|
33
|
+
start
|
34
|
+
|
35
|
+
yield self
|
36
|
+
|
37
|
+
teardown
|
38
|
+
end
|
39
|
+
|
40
|
+
def url
|
41
|
+
"https://#{subdomain}.#{tunnel_server_hostname}"
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def name
|
47
|
+
@name ||= "ssh-tunnel-#{SecureRandom.hex(4)}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def prepare
|
51
|
+
@docker.pull(DOCKER_IMAGE, DOCKER_IMAGE_TAG)
|
52
|
+
|
53
|
+
return if @docker.network_exists?(network)
|
54
|
+
|
55
|
+
@docker.network_create(network)
|
56
|
+
end
|
57
|
+
|
58
|
+
def tunnel_server_hostname
|
59
|
+
ENV.fetch("TUNNEL_SERVER_HOSTNAME")
|
60
|
+
end
|
61
|
+
|
62
|
+
def subdomain
|
63
|
+
@subdomain ||= rand(20_000..30_000)
|
64
|
+
end
|
65
|
+
|
66
|
+
def start
|
67
|
+
raise "Must set gitlab_hostname" unless @gitlab_hostname
|
68
|
+
|
69
|
+
@docker.run(DOCKER_IMAGE, DOCKER_IMAGE_TAG, "-o StrictHostKeyChecking=no -N -R #{subdomain}:#{@gitlab_hostname}:80 #{ENV.fetch('TUNNEL_SSH_USER')}@#{tunnel_server_hostname}") do |command|
|
70
|
+
command << '-d '
|
71
|
+
command << "--name #{name}"
|
72
|
+
command << "--net #{network}"
|
73
|
+
|
74
|
+
@volumes.to_h.each do |to, from|
|
75
|
+
command.volume(from, to, 'Z')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def restart
|
81
|
+
@docker.restart(name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def teardown
|
85
|
+
raise 'Invalid instance name!' unless name
|
86
|
+
|
87
|
+
@docker.stop(name)
|
88
|
+
@docker.remove(name)
|
89
|
+
@ssh_key.unlink
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module QA
|
3
5
|
module Component
|
@@ -17,17 +19,19 @@ module Gitlab
|
|
17
19
|
|
18
20
|
puts "Running test suite `#{suite}` for #{release.project_name}"
|
19
21
|
|
22
|
+
name = "gitlab-#{release.edition}-qa-#{SecureRandom.hex(4)}"
|
23
|
+
|
20
24
|
@docker.run(release.qa_image, release.qa_tag, suite, *args) do |command|
|
21
25
|
command << "-t --rm --net=#{network || 'bridge'}"
|
22
26
|
|
23
|
-
|
24
|
-
variables.each do |key, value|
|
27
|
+
Runtime::Env.variables.each do |key, value|
|
25
28
|
command.env(key, value)
|
26
29
|
end
|
27
30
|
|
28
31
|
command.volume('/var/run/docker.sock', '/var/run/docker.sock')
|
29
|
-
command.volume(Runtime::Env.
|
30
|
-
|
32
|
+
command.volume(File.join(Runtime::Env.host_artifacts_dir, name), '/home/qa/tmp')
|
33
|
+
|
34
|
+
command.name(name)
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -10,8 +10,14 @@ module Gitlab
|
|
10
10
|
|
11
11
|
def self.release
|
12
12
|
version = Version.new(ADDRESS).fetch!
|
13
|
+
image =
|
14
|
+
if Runtime::Env.dev_access_token_variable
|
15
|
+
"dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee:#{version}"
|
16
|
+
else
|
17
|
+
"ee:#{version}"
|
18
|
+
end
|
13
19
|
|
14
|
-
Release.new(
|
20
|
+
Release.new(image)
|
15
21
|
rescue InvalidResponseError => ex
|
16
22
|
warn ex.message
|
17
23
|
warn "#{ex.response.code} #{ex.response.message}: #{ex.response.body}"
|
data/lib/gitlab/qa/release.rb
CHANGED
@@ -5,6 +5,7 @@ module Gitlab
|
|
5
5
|
CUSTOM_GITLAB_IMAGE_REGEX = %r{/gitlab-(?<edition>[ce]e):(?<tag>.+)\z}
|
6
6
|
DEFAULT_TAG = 'latest'.freeze
|
7
7
|
DEFAULT_CANONICAL_TAG = 'nightly'.freeze
|
8
|
+
DEV_REGISTRY = 'dev.gitlab.org:5005'.freeze
|
8
9
|
|
9
10
|
attr_reader :release
|
10
11
|
attr_writer :tag
|
@@ -72,6 +73,10 @@ module Gitlab
|
|
72
73
|
tag.sub(/\.([ce]e)/, '-\1').sub(/\.(\d+)\z/, '')
|
73
74
|
end
|
74
75
|
|
76
|
+
def dev_gitlab_org?
|
77
|
+
image.start_with?(DEV_REGISTRY)
|
78
|
+
end
|
79
|
+
|
75
80
|
private
|
76
81
|
|
77
82
|
def canonical?
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
1
3
|
module Gitlab
|
2
4
|
module QA
|
3
5
|
module Runtime
|
@@ -14,23 +16,31 @@ module Gitlab
|
|
14
16
|
'GITLAB_QA_ACCESS_TOKEN' => :qa_access_token,
|
15
17
|
'GITHUB_ACCESS_TOKEN' => :github_access_token,
|
16
18
|
'GITLAB_URL' => :gitlab_url,
|
17
|
-
'EE_LICENSE' => :ee_license
|
19
|
+
'EE_LICENSE' => :ee_license,
|
20
|
+
'GCLOUD_ACCOUNT_EMAIL' => :gcloud_account_email,
|
21
|
+
'GCLOUD_ACCOUNT_KEY' => :gcloud_account_key,
|
22
|
+
'CLOUDSDK_CORE_PROJECT' => :cloudsdk_core_project,
|
23
|
+
'GCLOUD_ZONE' => :gcloud_zone
|
18
24
|
}.freeze
|
19
25
|
|
20
26
|
ENV_VARIABLES.each_value do |accessor|
|
21
27
|
send(:attr_accessor, accessor) # rubocop:disable GitlabSecurity/PublicSend
|
22
28
|
end
|
23
29
|
|
30
|
+
def run_id
|
31
|
+
@run_id ||= "gitlab-qa-run-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(4)}"
|
32
|
+
end
|
33
|
+
|
24
34
|
def qa_access_token
|
25
35
|
ENV['GITLAB_QA_ACCESS_TOKEN']
|
26
36
|
end
|
27
37
|
|
28
|
-
def
|
29
|
-
|
38
|
+
def dev_access_token_variable
|
39
|
+
env_value_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN')
|
30
40
|
end
|
31
41
|
|
32
|
-
def
|
33
|
-
ENV['
|
42
|
+
def host_artifacts_dir
|
43
|
+
@host_artifacts_dir ||= File.join(ENV['QA_ARTIFACTS_DIR'] || '/tmp/gitlab-qa', Runtime::Env.run_id)
|
34
44
|
end
|
35
45
|
|
36
46
|
def variables
|
@@ -64,6 +74,12 @@ module Gitlab
|
|
64
74
|
raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
|
65
75
|
end
|
66
76
|
|
77
|
+
def require_kubernetes_environment!
|
78
|
+
%w[GCLOUD_ACCOUNT_EMAIL GCLOUD_ACCOUNT_KEY CLOUDSDK_CORE_PROJECT GCLOUD_ZONE].each do |env_key|
|
79
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run kubernetes specs" unless ENV.key?(env_key)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
67
83
|
private
|
68
84
|
|
69
85
|
def env_value_if_defined(variable)
|
@@ -7,15 +7,26 @@ module Gitlab
|
|
7
7
|
# Run test suite against staging.gitlab.com
|
8
8
|
#
|
9
9
|
class Staging < Scenario::Template
|
10
|
-
def perform(*)
|
10
|
+
def perform(*rspec_args)
|
11
11
|
Runtime::Env.require_no_license!
|
12
12
|
|
13
13
|
release = Component::Staging.release
|
14
14
|
|
15
|
+
if release.dev_gitlab_org?
|
16
|
+
Docker::Command.execute(
|
17
|
+
[
|
18
|
+
'login',
|
19
|
+
'--username gitlab-qa-bot',
|
20
|
+
%(--password "#{Runtime::Env.dev_access_token_variable}"),
|
21
|
+
Release::DEV_REGISTRY
|
22
|
+
]
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
15
26
|
Component::Specs.perform do |specs|
|
16
27
|
specs.suite = 'Test::Instance'
|
17
28
|
specs.release = release
|
18
|
-
specs.args = [Component::Staging::ADDRESS]
|
29
|
+
specs.args = [Component::Staging::ADDRESS, *rspec_args]
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class Kubernetes < Scenario::Template
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def perform(release)
|
11
|
+
Runtime::Env.require_kubernetes_environment!
|
12
|
+
|
13
|
+
Component::Gitlab.perform do |gitlab|
|
14
|
+
gitlab.release = release
|
15
|
+
gitlab.network = 'test'
|
16
|
+
|
17
|
+
Component::InternetTunnel.perform do |tunnel_gitlab|
|
18
|
+
Component::InternetTunnel.perform do |tunnel_registry|
|
19
|
+
tunnel_gitlab.gitlab_hostname = gitlab.hostname
|
20
|
+
tunnel_gitlab.network = 'test'
|
21
|
+
tunnel_registry.gitlab_hostname = gitlab.hostname
|
22
|
+
tunnel_registry.network = 'test'
|
23
|
+
|
24
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
25
|
+
external_url '#{tunnel_gitlab.url}';
|
26
|
+
nginx['listen_port'] = 80;
|
27
|
+
nginx['listen_https'] = false;
|
28
|
+
|
29
|
+
registry_external_url '#{tunnel_registry.url}';
|
30
|
+
registry_nginx['listen_port'] = 80;
|
31
|
+
registry_nginx['listen_https'] = false;
|
32
|
+
OMNIBUS
|
33
|
+
|
34
|
+
tunnel_gitlab.instance do
|
35
|
+
tunnel_registry.instance do
|
36
|
+
gitlab.instance do
|
37
|
+
Component::Specs.perform do |specs|
|
38
|
+
specs.suite = 'Test::Integration::Kubernetes'
|
39
|
+
specs.release = gitlab.release
|
40
|
+
specs.network = gitlab.network
|
41
|
+
specs.args = [tunnel_gitlab.url]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
# rubocop:enable Metrics/AbcSize
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -7,11 +7,9 @@ module Gitlab
|
|
7
7
|
module Test
|
8
8
|
module Omnibus
|
9
9
|
class Update < Scenario::Template
|
10
|
-
def perform(
|
11
|
-
|
12
|
-
|
13
|
-
previous_release = Release.new(previous_edition).previous_stable
|
14
|
-
next_release = Release.new(next_edition)
|
10
|
+
def perform(from_release, to_release = nil)
|
11
|
+
previous_release = Release.new(from_release).previous_stable
|
12
|
+
current_release = Release.new(to_release || from_release)
|
15
13
|
|
16
14
|
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
17
15
|
Scenario::Test::Instance::Image
|
@@ -20,7 +18,7 @@ module Gitlab
|
|
20
18
|
end
|
21
19
|
|
22
20
|
Scenario::Test::Instance::Image
|
23
|
-
.perform(
|
21
|
+
.perform(current_release) do |scenario|
|
24
22
|
scenario.volumes = volumes
|
25
23
|
end
|
26
24
|
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:
|
4
|
+
version: 2.0.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-07-
|
11
|
+
date: 2018-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -133,7 +133,7 @@ files:
|
|
133
133
|
- docs/README.md
|
134
134
|
- docs/architecture.md
|
135
135
|
- docs/how_it_works.md
|
136
|
-
- docs/
|
136
|
+
- docs/run_qa_against_gdk.md
|
137
137
|
- docs/trainings.md
|
138
138
|
- docs/waits.md
|
139
139
|
- docs/what_tests_can_be_run.md
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- gitlab-qa.gemspec
|
143
143
|
- lib/gitlab/qa.rb
|
144
144
|
- lib/gitlab/qa/component/gitlab.rb
|
145
|
+
- lib/gitlab/qa/component/internet_tunnel.rb
|
145
146
|
- lib/gitlab/qa/component/ldap.rb
|
146
147
|
- lib/gitlab/qa/component/specs.rb
|
147
148
|
- lib/gitlab/qa/component/staging.rb
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- lib/gitlab/qa/scenario/test/instance/image.rb
|
158
159
|
- lib/gitlab/qa/scenario/test/instance/staging.rb
|
159
160
|
- lib/gitlab/qa/scenario/test/integration/geo.rb
|
161
|
+
- lib/gitlab/qa/scenario/test/integration/kubernetes.rb
|
160
162
|
- lib/gitlab/qa/scenario/test/integration/ldap.rb
|
161
163
|
- lib/gitlab/qa/scenario/test/integration/mattermost.rb
|
162
164
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|