gitlab-qa 5.13.4 → 5.14.1
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/.gitlab-ci.yml +2 -0
- data/docs/run_qa_against_gdk.md +3 -0
- data/docs/what_tests_can_be_run.md +20 -5
- data/lib/gitlab/qa.rb +1 -0
- data/lib/gitlab/qa/component/base.rb +5 -1
- data/lib/gitlab/qa/component/gitlab.rb +2 -1
- data/lib/gitlab/qa/component/specs.rb +3 -1
- data/lib/gitlab/qa/docker/engine.rb +13 -2
- data/lib/gitlab/qa/release.rb +9 -3
- data/lib/gitlab/qa/runtime/env.rb +4 -6
- data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +68 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b5afa85b80b6c367a00f9e0077782d761bf5ad69d851aa95e5ea4f7ec4af78
|
4
|
+
data.tar.gz: b6940307fb5981a4f7c4468be522916ae4a01f2e65ddb0a5847037ce7099556f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95347f6df44ef53110ac29177e3373fecba8d0ea2535f5a642233519c87d4c97edef9120d6a48e22b05739a00e4b01eccd090743894f1f0db52ba6a1ee4e0995
|
7
|
+
data.tar.gz: a688557eb3fb7738f7288dfbd18bf804fbfdbf668ffd1e17f155f1df3fce5b38b5618af10460355f516e26091e93f290651f364ac5f09531827c6a06b4b0fee5
|
data/.gitlab-ci.yml
CHANGED
@@ -31,6 +31,8 @@ workflow:
|
|
31
31
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
32
32
|
# For tags, create a pipeline.
|
33
33
|
- if: '$CI_COMMIT_TAG'
|
34
|
+
# For triggers from GitLab MR pipelines (and pipelines from other projects), create a pipeline
|
35
|
+
- if: '$CI_PIPELINE_SOURCE == "pipeline"'
|
34
36
|
|
35
37
|
.default-rules:
|
36
38
|
rules:
|
data/docs/run_qa_against_gdk.md
CHANGED
@@ -42,6 +42,9 @@ make a few changes to your `gdk/gitlab/config/gitlab.yml` file.
|
|
42
42
|
$ exe/gitlab-qa Test::Instance::Any gitlab/gitlab-ce:your-custom-tag http://192.168.0.12:3000 -- qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
|
43
43
|
```
|
44
44
|
|
45
|
+
**Note:** The hostname of the URL provided to `gitlab-qa` must match the hostname configured for GDK.
|
46
|
+
If they do not match, a test will be signed out when it visits a page directly because the hostname of the URL visited will be different from the hostname that was used when signing in.
|
47
|
+
|
45
48
|
### Running EE tests
|
46
49
|
|
47
50
|
When running EE tests you'll need to have a license available. GitLab engineers can [request a license](https://about.gitlab.com/handbook/developer-onboarding/#working-on-gitlab-ee).
|
@@ -57,14 +57,14 @@ For more details on the internals, please read the
|
|
57
57
|
| `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
|
58
58
|
| `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
|
59
59
|
| `CHROME_HEADLESS` |- | When running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run. | No|
|
60
|
-
| `QA_ADDITIONAL_REPOSITORY_STORAGE` |- | The name of additional, non-default storage to be used with tests tagged `repository_storage`, run via the `Test::Instance::RepositoryStorage` scenario. | No|
|
61
|
-
| `QA_PRAEFECT_REPOSITORY_STORAGE` |- | The name of repository storage using Praefect. | No|
|
60
|
+
| `QA_ADDITIONAL_REPOSITORY_STORAGE` |- | The name of additional, non-default storage to be used with tests tagged `repository_storage`, run via the `Test::Instance::RepositoryStorage` scenario. Note: Admin access is required to change repository storage. | No|
|
61
|
+
| `QA_PRAEFECT_REPOSITORY_STORAGE` |- | The name of repository storage using Praefect. Note: Admin access is required to change repository storage. | No|
|
62
62
|
| `QA_COOKIES` |- | Optionally set to "cookie1=value;cookie2=value" in order to add a cookie to every request. This can be used to set the canary cookie by setting it to "gitlab_canary=true". | No|
|
63
63
|
| `QA_DEBUG` |- | Set to `true` to verbosely log page object actions. Note: if enabled be aware that sensitive data might be logged. If an input element has a QA selector with `password` in the name, data entered into the input element will be masked. If the element doesn't have `password` in its name it won't be masked. | No|
|
64
64
|
| `QA_LOG_PATH` |- | Path to output debug logging to. If not set logging will be output to STDOUT. | No|
|
65
|
-
| `QA_CAN_TEST_GIT_PROTOCOL_V2`
|
66
|
-
| `QA_CAN_TEST_ADMIN_FEATURES`
|
67
|
-
| `QA_CAN_TEST_PRAEFECT`
|
65
|
+
| `QA_CAN_TEST_GIT_PROTOCOL_V2` | `true` | Set to `false` to skip tests that require Git protocol v2 if your environment doesn't support it. | No|
|
66
|
+
| `QA_CAN_TEST_ADMIN_FEATURES` | `true` | Set to `false` to skip tests that require admin access. | No|
|
67
|
+
| `QA_CAN_TEST_PRAEFECT` | `true` | Set to `false` to skip tests that require Praefect to be running. | No|
|
68
68
|
| `QA_DISABLE_RSPEC_RETRY` |- | Set to `true` to turn off retrying tests on failure. | No|
|
69
69
|
| `QA_SIMULATE_SLOW_CONNECTION` |- | Set to `true` to configure Chrome's network settings to simulate a slow connection. | No|
|
70
70
|
| `QA_SLOW_CONNECTION_LATENCY_MS` | `2000` | The additional latency (in ms) of the simulated slow connection. | No|
|
@@ -618,6 +618,21 @@ $ export QA_ADDITIONAL_REPOSITORY_STORAGE=secondary
|
|
618
618
|
$ gitlab-qa Test::Instance::RepositoryStorage
|
619
619
|
```
|
620
620
|
|
621
|
+
### `Test::Instance::Airgapped`
|
622
|
+
|
623
|
+
This scenario will run tests from the test suite against an airgapped instance.
|
624
|
+
The airgapped instance is set up by using `iptables` in the GitLab container to block network traffic other than testable ports, and by using runners
|
625
|
+
in a shared internal network.
|
626
|
+
|
627
|
+
Example:
|
628
|
+
|
629
|
+
```
|
630
|
+
# For EE
|
631
|
+
$ export EE_LICENSE=$(cat /path/to/gitlab_license)
|
632
|
+
|
633
|
+
$ gitlab-qa Test::Instance::Airgapped EE -- --tag smoke
|
634
|
+
```
|
635
|
+
|
621
636
|
----
|
622
637
|
|
623
638
|
[Back to README.md](../README.md)
|
data/lib/gitlab/qa.rb
CHANGED
@@ -29,6 +29,7 @@ module Gitlab
|
|
29
29
|
autoload :Release, 'gitlab/qa/scenario/test/instance/release'
|
30
30
|
autoload :Geo, 'gitlab/qa/scenario/test/instance/geo'
|
31
31
|
autoload :StagingGeo, 'gitlab/qa/scenario/test/instance/staging_geo'
|
32
|
+
autoload :Airgapped, 'gitlab/qa/scenario/test/instance/airgapped'
|
32
33
|
end
|
33
34
|
|
34
35
|
module Omnibus
|
@@ -5,7 +5,7 @@ module Gitlab
|
|
5
5
|
include Scenario::Actable
|
6
6
|
|
7
7
|
attr_reader :docker
|
8
|
-
attr_accessor :volumes, :network, :environment
|
8
|
+
attr_accessor :volumes, :network, :environment, :runner_network
|
9
9
|
attr_writer :name, :exec_commands
|
10
10
|
|
11
11
|
def initialize
|
@@ -67,6 +67,10 @@ module Gitlab
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def prepare_network
|
70
|
+
if runner_network && !docker.network_exists?(runner_network)
|
71
|
+
docker.network_create("--driver=bridge --internal #{runner_network}")
|
72
|
+
end
|
73
|
+
|
70
74
|
return if docker.network_exists?(network)
|
71
75
|
|
72
76
|
docker.network_create(network)
|
@@ -11,7 +11,7 @@ module Gitlab
|
|
11
11
|
extend Forwardable
|
12
12
|
|
13
13
|
attr_reader :release
|
14
|
-
attr_accessor :tls, :disable_animations, :skip_availability_check
|
14
|
+
attr_accessor :tls, :disable_animations, :skip_availability_check, :runner_network
|
15
15
|
attr_writer :name, :relative_path
|
16
16
|
|
17
17
|
def_delegators :release, :tag, :image, :edition
|
@@ -116,6 +116,7 @@ module Gitlab
|
|
116
116
|
command << "--network-alias #{network_alias}"
|
117
117
|
end
|
118
118
|
end
|
119
|
+
Docker::Command.execute("network connect --alias #{name}.#{network} --alias #{name}.#{runner_network} #{runner_network} #{name}") if runner_network
|
119
120
|
end
|
120
121
|
|
121
122
|
def reconfigure
|
@@ -8,7 +8,7 @@ module Gitlab
|
|
8
8
|
# the `qa/` directory located in GitLab CE / EE repositories.
|
9
9
|
#
|
10
10
|
class Specs < Scenario::Template
|
11
|
-
attr_accessor :suite, :release, :network, :args, :volumes, :env
|
11
|
+
attr_accessor :suite, :release, :network, :args, :volumes, :env, :runner_network
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@docker = Docker::Engine.new
|
@@ -19,6 +19,8 @@ module Gitlab
|
|
19
19
|
def perform # rubocop:disable Metrics/AbcSize
|
20
20
|
raise ArgumentError unless [suite, release].all?
|
21
21
|
|
22
|
+
@docker.login(**release.login_params) if release.login_params
|
23
|
+
|
22
24
|
puts "Running test suite `#{suite}` for #{release.project_name}"
|
23
25
|
|
24
26
|
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
|
@@ -3,13 +3,14 @@ module Gitlab
|
|
3
3
|
module Docker
|
4
4
|
class Engine
|
5
5
|
DOCKER_HOST = ENV['DOCKER_HOST'] || 'http://localhost'
|
6
|
+
PRIVILEGED_COMMANDS = [/^iptables.*/].freeze
|
6
7
|
|
7
8
|
def hostname
|
8
9
|
URI(DOCKER_HOST).host
|
9
10
|
end
|
10
11
|
|
11
12
|
def login(username:, password:, registry:)
|
12
|
-
Docker::Command.execute(
|
13
|
+
Docker::Command.execute(%(login --username "#{username}" --password "#{password}" #{registry}))
|
13
14
|
end
|
14
15
|
|
15
16
|
def pull(image, tag)
|
@@ -27,8 +28,18 @@ module Gitlab
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
31
|
+
def privileged_command?(command)
|
32
|
+
PRIVILEGED_COMMANDS.each do |privileged_regex|
|
33
|
+
return true if command.match(privileged_regex)
|
34
|
+
end
|
35
|
+
|
36
|
+
false
|
37
|
+
end
|
38
|
+
|
30
39
|
def exec(name, command)
|
31
|
-
|
40
|
+
cmd = ['exec']
|
41
|
+
cmd << '--privileged' if privileged_command?(command)
|
42
|
+
Docker::Command.execute("#{cmd.join(' ')} #{name} bash -c '#{command}'")
|
32
43
|
end
|
33
44
|
|
34
45
|
def read_file(image, tag, path, &block)
|
data/lib/gitlab/qa/release.rb
CHANGED
@@ -145,11 +145,17 @@ module Gitlab
|
|
145
145
|
registry: DEV_REGISTRY
|
146
146
|
}
|
147
147
|
elsif omnibus_mirror?
|
148
|
-
Runtime::Env.
|
148
|
+
username, password = if Runtime::Env.ci_job_token
|
149
|
+
['gitlab-ci-token', Runtime::Env.ci_job_token]
|
150
|
+
else
|
151
|
+
Runtime::Env.require_qa_access_token!
|
152
|
+
|
153
|
+
[Runtime::Env.gitlab_username, Runtime::Env.qa_access_token]
|
154
|
+
end
|
149
155
|
|
150
156
|
{
|
151
|
-
username:
|
152
|
-
password:
|
157
|
+
username: username,
|
158
|
+
password: password,
|
153
159
|
registry: COM_REGISTRY
|
154
160
|
}
|
155
161
|
end
|
@@ -104,6 +104,10 @@ module Gitlab
|
|
104
104
|
ENV['CI_JOB_NAME']
|
105
105
|
end
|
106
106
|
|
107
|
+
def ci_job_token
|
108
|
+
ENV['CI_JOB_TOKEN']
|
109
|
+
end
|
110
|
+
|
107
111
|
def ci_job_url
|
108
112
|
ENV['CI_JOB_URL']
|
109
113
|
end
|
@@ -207,12 +211,6 @@ module Gitlab
|
|
207
211
|
end
|
208
212
|
end
|
209
213
|
|
210
|
-
def require_gitlab_bot_multi_project_pipeline_polling_token!
|
211
|
-
return unless ENV['GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN'].to_s.strip.empty?
|
212
|
-
|
213
|
-
raise ArgumentError, "Please provide GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN"
|
214
|
-
end
|
215
|
-
|
216
214
|
def skip_pull?
|
217
215
|
enabled?(ENV['QA_SKIP_PULL'], default: false)
|
218
216
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Gitlab
|
2
|
+
module QA
|
3
|
+
module Scenario
|
4
|
+
module Test
|
5
|
+
module Instance
|
6
|
+
class Airgapped < Scenario::Template
|
7
|
+
require 'resolv'
|
8
|
+
attr_accessor :commands
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
gitlab_ip = Resolv.getaddress('registry.gitlab.com')
|
12
|
+
@commands = <<~AIRGAP_AND_VERIFY_COMMAND.split(/\n+/)
|
13
|
+
# Should not fail before airgapping due to eg. DNS failure
|
14
|
+
# Ping and wget check
|
15
|
+
apt-get update && apt-get install -y iptables netcat
|
16
|
+
nc -zv -w 10 #{gitlab_ip} 80 && (echo \"Regular connectivity netcat check passed.\" && exit 0) || (echo \"Regular connectivity netcat check failed.\" && exit 1)
|
17
|
+
echo "Checking regular connectivity..." \
|
18
|
+
&& wget --retry-connrefused --waitretry=1 --read-timeout=15 --timeout=10 -t 2 http://registry.gitlab.com > /dev/null 2>&1 \
|
19
|
+
&& (echo "Regular connectivity wget check passed." && exit 0) || (echo "Regular connectivity wget check failed." && exit 1)
|
20
|
+
|
21
|
+
iptables -P INPUT DROP && iptables -P OUTPUT DROP
|
22
|
+
iptables -A INPUT -i lo -j ACCEPT && iptables -A OUTPUT -o lo -j ACCEPT # LOOPBACK
|
23
|
+
iptables -I INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
24
|
+
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
25
|
+
|
26
|
+
# Jenkins on port 8080 and 50000
|
27
|
+
iptables -A OUTPUT -p tcp -m tcp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT \
|
28
|
+
&& iptables -A OUTPUT -p tcp -m tcp --dport 50000 -m state --state NEW,ESTABLISHED -j ACCEPT
|
29
|
+
iptables -A OUTPUT -p tcp -m tcp --sport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
|
30
|
+
iptables -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
|
31
|
+
iptables -A OUTPUT -p tcp -m tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
32
|
+
iptables -A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
33
|
+
|
34
|
+
# Should now fail to ping and wget, port 80 should be open
|
35
|
+
nc -zv -w 10 #{gitlab_ip} 80 && (echo \"Airgapped network faulty. Connectivity netcat check failed.\" && exit 1) || (echo \"Connectivity netcat check passed.\" && exit 0)
|
36
|
+
nc -zv -w 10 127.0.0.1 22 && (echo "Airgapped connectivity port 22 check passed." && exit 0) || (echo "Airgapped connectivity port 22 check failed." && exit 1)
|
37
|
+
nc -zv -w 10 127.0.0.1 80 && (echo "Airgapped connectivity port 80 check passed." && exit 0) || (echo "Airgapped connectivity port 80 check failed." && exit 1)
|
38
|
+
echo "Checking airgapped connectivity..." \
|
39
|
+
&& wget --retry-connrefused --waitretry=1 --read-timeout=15 --timeout=10 -t 2 http://registry.gitlab.com > /dev/null 2>&1 \
|
40
|
+
&& (echo "Airgapped network faulty. Connectivity wget check failed." && exit 1) || (echo "Airgapped network confirmed. Connectivity wget check passed." && exit 0)
|
41
|
+
AIRGAP_AND_VERIFY_COMMAND
|
42
|
+
end
|
43
|
+
|
44
|
+
def perform(release, *rspec_args)
|
45
|
+
Component::Gitlab.perform do |gitlab|
|
46
|
+
gitlab.release = release
|
47
|
+
gitlab.network = 'test'
|
48
|
+
gitlab.runner_network = 'airgapped'
|
49
|
+
gitlab.exec_commands = @commands
|
50
|
+
rspec_args << "--" unless rspec_args.include?('--')
|
51
|
+
rspec_args << %w[--tag ~orchestrated]
|
52
|
+
gitlab.instance do
|
53
|
+
Component::Specs.perform do |specs|
|
54
|
+
specs.suite = 'Test::Instance::Airgapped'
|
55
|
+
specs.release = gitlab.release
|
56
|
+
specs.network = gitlab.network
|
57
|
+
specs.runner_network = gitlab.runner_network
|
58
|
+
specs.args = [gitlab.address, *rspec_args]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
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: 5.
|
4
|
+
version: 5.14.1
|
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-06-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- lib/gitlab/qa/scenario/actable.rb
|
270
270
|
- lib/gitlab/qa/scenario/cli_commands.rb
|
271
271
|
- lib/gitlab/qa/scenario/template.rb
|
272
|
+
- lib/gitlab/qa/scenario/test/instance/airgapped.rb
|
272
273
|
- lib/gitlab/qa/scenario/test/instance/any.rb
|
273
274
|
- lib/gitlab/qa/scenario/test/instance/deployment_base.rb
|
274
275
|
- lib/gitlab/qa/scenario/test/instance/geo.rb
|
@@ -329,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
330
|
- !ruby/object:Gem::Version
|
330
331
|
version: '0'
|
331
332
|
requirements: []
|
332
|
-
rubygems_version: 3.1.
|
333
|
+
rubygems_version: 3.1.4
|
333
334
|
signing_key:
|
334
335
|
specification_version: 4
|
335
336
|
summary: Integration tests for GitLab
|