gitlab-qa 5.13.7 → 5.14.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/docs/what_tests_can_be_run.md +15 -0
- 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 +1 -1
- data/lib/gitlab/qa/docker/engine.rb +12 -1
- data/lib/gitlab/qa/scenario/test/instance/airgapped.rb +68 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50cde662fbba863a232e44eacbb2aa7535762949816bd6281e5e0ce4fd916337
|
4
|
+
data.tar.gz: 67a222363326b5ab0767db8e894d56c351dd10a1e5c63aefd84991b009973a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd1486c1b47346d82c1bb5be090ec24ee25e0bd620232b8bbeef32e556cd6a7b8ebad3c5f05132de5ceb90636a78d10f4d5c6d4dd451784eac2d79b69429509
|
7
|
+
data.tar.gz: '0418804183dce1d3e5072381bb0ac6eef32c9eb7c0d98231a8e5ea94cc63255d43e14f94e61a91a6f47a1b3aa8ad44bf628ac7ce77544d80ccb6b13c6f8cccc5'
|
@@ -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
|
@@ -3,6 +3,7 @@ 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
|
@@ -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)
|
@@ -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.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-06-
|
11
|
+
date: 2020-06-14 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
|