gitlab-qa 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +82 -18
- data/.rubocop.yml +19 -15
- data/README.md +90 -3
- data/docs/macos.md +114 -0
- data/fixtures/ldap/tanuki.ldif +16 -0
- data/gitlab-qa.gemspec +4 -2
- data/lib/gitlab/qa.rb +7 -3
- data/lib/gitlab/qa/component/gitlab.rb +13 -11
- data/lib/gitlab/qa/component/ldap.rb +159 -0
- data/lib/gitlab/qa/component/specs.rb +3 -3
- data/lib/gitlab/qa/component/staging.rb +63 -0
- data/lib/gitlab/qa/docker/command.rb +4 -4
- data/lib/gitlab/qa/docker/shellout.rb +1 -1
- data/lib/gitlab/qa/docker/volumes.rb +0 -1
- data/lib/gitlab/qa/runtime/env.rb +55 -6
- data/lib/gitlab/qa/scenario/test/instance/staging.rb +26 -0
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +7 -0
- data/lib/gitlab/qa/scenario/test/integration/ldap.rb +47 -0
- data/lib/gitlab/qa/scenario/test/omnibus/image.rb +7 -3
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +4 -2
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +32 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a621d1f6282fb329b8f8ae089a113b66b5129017b4dc352d9afa3d21ce4a00b4
|
4
|
+
data.tar.gz: 51ee39c46554f5c32869c8ab96e53a1671b79790d1ee954ef1de744501ba32d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be2da63340fc7348cc62698396eb295490f4e8955ca7fe27b50c3a7098827c74261fb4e6b38981346a273a8f9edc04a26783ec5c279f244679cf60d4085e24f1
|
7
|
+
data.tar.gz: f5362769d30beeeca1295783ea201b63ce5e3901bc553aa810863968fd9ea8011eac7fa98481f4cbef1b58fa3b1a1d88feab985d0e6ec24c45ecde1ddfbc37a2
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -5,6 +5,7 @@ stages:
|
|
5
5
|
- check
|
6
6
|
- sanity
|
7
7
|
- test
|
8
|
+
- qa
|
8
9
|
|
9
10
|
variables:
|
10
11
|
TEST_IMAGE: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa
|
@@ -15,6 +16,9 @@ variables:
|
|
15
16
|
|
16
17
|
before_script:
|
17
18
|
- bundle install
|
19
|
+
- if [ -n "$TRIGGERED_USER" ] && [ -n "$TRIGGER_SOURCE" ]; then
|
20
|
+
echo "Pipeline triggered by $TRIGGERED_USER at $TRIGGER_SOURCE";
|
21
|
+
fi
|
18
22
|
|
19
23
|
check:rubocop:
|
20
24
|
stage: check
|
@@ -37,8 +41,8 @@ check:rspec:
|
|
37
41
|
.sanity: &sanity
|
38
42
|
stage: sanity
|
39
43
|
image: $TEST_IMAGE
|
40
|
-
|
41
|
-
-
|
44
|
+
only:
|
45
|
+
- schedules
|
42
46
|
tags:
|
43
47
|
- docker
|
44
48
|
|
@@ -55,55 +59,115 @@ ee:version:
|
|
55
59
|
.test: &test
|
56
60
|
stage: test
|
57
61
|
image: $TEST_IMAGE
|
62
|
+
retry: 1
|
58
63
|
tags:
|
59
64
|
- docker
|
60
65
|
artifacts:
|
61
66
|
when: on_failure
|
62
67
|
expire_in: 30d
|
63
68
|
paths:
|
64
|
-
- screenshots
|
65
|
-
- logs
|
69
|
+
- screenshots/
|
70
|
+
- logs/
|
71
|
+
|
72
|
+
.high-capacity: &high-capacity
|
73
|
+
tags:
|
74
|
+
- docker
|
75
|
+
- 7gb
|
76
|
+
- triggered-packages
|
66
77
|
|
67
78
|
ce:instance:
|
68
|
-
|
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
|
+
script:
|
83
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
84
|
+
- bin/qa Test::Instance::Image ${RELEASE:=CE}
|
69
85
|
<<: *test
|
86
|
+
<<: *high-capacity
|
70
87
|
|
71
88
|
ee:instance:
|
72
|
-
script:
|
89
|
+
script:
|
90
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
91
|
+
- bin/qa Test::Instance::Image ${RELEASE:=EE}
|
73
92
|
<<: *test
|
93
|
+
<<: *high-capacity
|
74
94
|
|
75
95
|
ce:image:
|
76
|
-
script:
|
96
|
+
script:
|
97
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
98
|
+
- bin/qa Test::Omnibus::Image ${RELEASE:=CE}
|
77
99
|
<<: *test
|
78
100
|
|
79
101
|
ee:image:
|
80
|
-
script:
|
102
|
+
script:
|
103
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
104
|
+
- bin/qa Test::Omnibus::Image ${RELEASE:=EE}
|
81
105
|
<<: *test
|
82
106
|
|
83
107
|
ce:update:
|
84
|
-
script:
|
108
|
+
script:
|
109
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
110
|
+
- bin/qa Test::Omnibus::Update ${RELEASE:=CE}
|
85
111
|
<<: *test
|
112
|
+
<<: *high-capacity
|
86
113
|
|
87
114
|
ee:update:
|
88
|
-
script:
|
115
|
+
script:
|
116
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
117
|
+
- bin/qa Test::Omnibus::Update ${RELEASE:=EE}
|
89
118
|
<<: *test
|
119
|
+
<<: *high-capacity
|
90
120
|
|
91
121
|
ce:upgrade:
|
92
|
-
script:
|
122
|
+
script:
|
123
|
+
- if [[ $RELEASE ]]; then exit 0; fi
|
124
|
+
- bin/qa Test::Omnibus::Upgrade
|
93
125
|
<<: *test
|
126
|
+
<<: *high-capacity
|
94
127
|
|
95
128
|
ce:mattermost:
|
96
|
-
script:
|
129
|
+
script:
|
130
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ee); then exit 0; fi
|
131
|
+
- bin/qa Test::Integration::Mattermost ${RELEASE:=CE}
|
97
132
|
<<: *test
|
133
|
+
<<: *high-capacity
|
98
134
|
|
99
135
|
ee:mattermost:
|
100
|
-
script:
|
136
|
+
script:
|
137
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
138
|
+
- bin/qa Test::Integration::Mattermost ${RELEASE:=EE}
|
101
139
|
<<: *test
|
140
|
+
<<: *high-capacity
|
102
141
|
|
103
142
|
ee:geo:
|
104
|
-
script:
|
143
|
+
script:
|
144
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
145
|
+
- bin/qa Test::Integration::Geo ${RELEASE:=EE}
|
105
146
|
<<: *test
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
147
|
+
<<: *high-capacity
|
148
|
+
|
149
|
+
ce:ldap:
|
150
|
+
script:
|
151
|
+
- bin/qa Test::Integration::LDAP ${RELEASE:=CE}
|
152
|
+
<<: *test
|
153
|
+
<<: *high-capacity
|
154
|
+
|
155
|
+
ee:ldap:
|
156
|
+
script:
|
157
|
+
- bin/qa Test::Integration::LDAP ${RELEASE:=EE}
|
158
|
+
<<: *test
|
159
|
+
<<: *high-capacity
|
160
|
+
|
161
|
+
qa:staging:
|
162
|
+
script:
|
163
|
+
- if $(echo ${RELEASE} | grep -q gitlab-ce); then exit 0; fi
|
164
|
+
- export GITLAB_USERNAME="gitlab-qa"
|
165
|
+
- export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
166
|
+
- unset EE_LICENSE
|
167
|
+
- bin/qa Test::Instance::Staging
|
168
|
+
<<: *test
|
169
|
+
retry: 0
|
170
|
+
stage: qa
|
171
|
+
when: manual
|
172
|
+
except:
|
173
|
+
- triggers
|
data/.rubocop.yml
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require:
|
2
|
+
# Due to a probably bug in rubocop (https://github.com/bbatsov/rubocop/issues/5251)
|
3
|
+
# we need to require rubocop-rspec a second time so that RSpec/FilePath does
|
4
|
+
# not fallback to Rails/FilePath.
|
5
|
+
- rubocop-rspec
|
3
6
|
|
4
|
-
|
5
|
-
|
7
|
+
inherit_gem:
|
8
|
+
gitlab-styles:
|
9
|
+
- rubocop-default.yml
|
6
10
|
|
7
|
-
|
11
|
+
Lint/ShadowingOuterLocalVariable:
|
8
12
|
Enabled: false
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 18
|
12
16
|
|
13
|
-
|
14
|
-
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Max: 20
|
15
19
|
|
16
|
-
|
20
|
+
Rails:
|
17
21
|
Enabled: false
|
18
22
|
|
19
|
-
Style/
|
23
|
+
Style/ExtendSelf:
|
20
24
|
Enabled: false
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
Style/ModuleFunction:
|
27
|
+
Enabled: false
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
Style/SignalException:
|
30
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -14,9 +14,63 @@ The purpose of this test suite is to verify that all pieces do integrate well to
|
|
14
14
|
|
15
15
|
See the [GitLab QA architecture](/docs/architecture.md).
|
16
16
|
|
17
|
+
## Goals and objectives
|
18
|
+
|
19
|
+
### GitLab QA tests running in the CI/CD environment
|
20
|
+
|
21
|
+
GitLab QA is an automated end-to-end testing framework, which means that manual
|
22
|
+
steps should not be needed to run GitLab QA test suite. This framework is
|
23
|
+
CI/CD environment native, which means that we should add new features and tests
|
24
|
+
when we are comfortable with running new code in the CI/CD environment.
|
25
|
+
|
26
|
+
### GitLab QA test failure are reproducible locally
|
27
|
+
|
28
|
+
Despite the fact that GitLab QA has been built to run in the CI/CD environment,
|
29
|
+
it is really important to make it easy for developers to reproduce GitLab QA
|
30
|
+
test failures locally. It is much easier to debug things locally, than in the
|
31
|
+
CI/CD.
|
32
|
+
|
33
|
+
To make it easier to reproduce test failures locally we have published
|
34
|
+
`gitlab-qa` gem [on rubygems.org](https://rubygems.org/gems/gitlab-qa) and we
|
35
|
+
are using exactly the same approach to run tests in the CI/CD environment.
|
36
|
+
|
37
|
+
It means that using `gitlab-qa` CLI tool, that orchestrates test environment and
|
38
|
+
runs GitLab QA test suite, is a reproducible way of running tests locally and
|
39
|
+
in the CI/CD.
|
40
|
+
|
41
|
+
It also means that we can not have a custom code in `.gitlab-ci.yml` to, for
|
42
|
+
example, start new containers / services.
|
43
|
+
|
44
|
+
### Test installation / deployment process too
|
45
|
+
|
46
|
+
We distribute GitLab in a package (like Debian package or a Docker image) so
|
47
|
+
we want to test installation process to ensure that our package is not broken.
|
48
|
+
|
49
|
+
But we are also working on making GitLab be a cloud native product. This means
|
50
|
+
that using Helm becomes a yet another installation / deployment process that we
|
51
|
+
want to test with GitLab QA.
|
52
|
+
|
53
|
+
Keeping in mind that we want to test our Kubernetes deployments is especially
|
54
|
+
important with consideration of the need of testing changes in merge requests.
|
55
|
+
|
56
|
+
### Testing changes in merge requests before the merge
|
57
|
+
|
58
|
+
The ultimate goal of GitLab QA is to make it possible to test changes in
|
59
|
+
merge requests, even before merging a code into the stable / master branch.
|
60
|
+
|
61
|
+
### We can run tests against any instance of GitLab
|
62
|
+
|
63
|
+
GitLab QA is a click-driven, black-box testing tool. We also use it to run
|
64
|
+
tests against the staging, and we strive for making it useful for our users
|
65
|
+
as well.
|
66
|
+
|
17
67
|
## How do we use it
|
18
68
|
|
19
|
-
Currently we trigger test suite against GitLab Docker images created by Omnibus
|
69
|
+
Currently we trigger test suite against GitLab Docker images created by Omnibus
|
70
|
+
nightly.
|
71
|
+
|
72
|
+
We also trigger GitLab QA pipelines whenever someone clicks `package-qa` manual
|
73
|
+
action in a merge request.
|
20
74
|
|
21
75
|
## How can you use it
|
22
76
|
|
@@ -25,6 +79,10 @@ GitLab QA tool is published as a [Ruby Gem](https://rubygems.org/gems/gitlab-qa)
|
|
25
79
|
You can install it with `gem install gitlab-qa`. It will expose a `gitlab-qa`
|
26
80
|
command in your system.
|
27
81
|
|
82
|
+
If you want to run the scenarios or develop them on Mac OS, please read
|
83
|
+
[Mac OS specific documentation](/docs/macos.md) as there are caveats and things
|
84
|
+
that may work differently.
|
85
|
+
|
28
86
|
1. Run tests against a Docker image with GitLab:
|
29
87
|
|
30
88
|
`gitlab-qa Test::Instance::Image CE|EE|<full image address>`
|
@@ -33,6 +91,12 @@ command in your system.
|
|
33
91
|
|
34
92
|
`gitlab-qa Test::Integration::Mattermost CE|EE|<full image address>`
|
35
93
|
|
94
|
+
1. Run tests agains a Docker image with GitLab Geo:
|
95
|
+
|
96
|
+
`export EE_LICENSE=$(cat /path/to/Geo.gitlab_license)`
|
97
|
+
|
98
|
+
`gitlab-qa Test::Integration::Geo EE`
|
99
|
+
|
36
100
|
1. Test update process between two CE or EE subsequent versions:
|
37
101
|
|
38
102
|
`gitlab-qa Test::Omnibus::Update CE|EE|<full image address>`
|
@@ -49,6 +113,13 @@ command in your system.
|
|
49
113
|
|
50
114
|
`GITLAB_USERNAME=your_username GITLAB_PASSWORD=your_password gitlab-qa Test::Instance::Any EE latest https://staging.gitlab.com`
|
51
115
|
|
116
|
+
### How to add new scenarios
|
117
|
+
|
118
|
+
Scenarios (test cases) and scripts to run them are located in
|
119
|
+
[CE](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/qa) and
|
120
|
+
[EE](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/qa)
|
121
|
+
repositories under qa/ directory, so please also check the documents there.
|
122
|
+
|
52
123
|
## How does it work?
|
53
124
|
|
54
125
|
GitLab QA handles a few scenarios:
|
@@ -86,6 +157,17 @@ This scenario tests that GitLab instance works as expected when
|
|
86
157
|
enabling the embedded Mattermost server (see `Test::Instance::Image`
|
87
158
|
above).
|
88
159
|
|
160
|
+
### `Test::Integration::LDAP CE|EE|<full image address>`
|
161
|
+
|
162
|
+
This scenario tests that GitLab instance works as expected with an external
|
163
|
+
LDAP server. The scenario spins up an OpenLDAP server, seeds users, and
|
164
|
+
attempts to LDAP-related tests against a GitLab instance.
|
165
|
+
|
166
|
+
In EE, both the GitLab standard and LDAP credentials are needed:
|
167
|
+
|
168
|
+
1. The first is used to login as an Admin to enter in the EE license.
|
169
|
+
2. The second is used to conduct LDAP-related tasks
|
170
|
+
|
89
171
|
### `Test::Instance::Any CE|EE|<full image address>`
|
90
172
|
|
91
173
|
This scenario tests that the any GitLab instance works as expected by running
|
@@ -93,14 +175,19 @@ tests against it (see `Test::Instance::Image` above).
|
|
93
175
|
|
94
176
|
## Supported environment variables
|
95
177
|
|
96
|
-
* `GITLAB_USERNAME` - username to use when signing
|
97
|
-
* `GITLAB_PASSWORD` - password to use when signing
|
178
|
+
* `GITLAB_USERNAME` - username to use when signing into GitLab
|
179
|
+
* `GITLAB_PASSWORD` - password to use when signing into GitLab
|
180
|
+
* `GITLAB_USER_TYPE` - type of user to use when signing into GitLab: standard (default), ldap
|
181
|
+
* `GITLAB_LDAP_USERNAME` - LDAP username to use when signing into GitLab
|
182
|
+
* `GITLAB_LDAP_PASSWORD` - LDAP password to use when signing into GitLab
|
183
|
+
* `GITLAB_SANDBOX_NAME` - The sandbox group name test suite is going to use (default: `gitlab-qa-sandbox`)
|
98
184
|
* `EE_LICENSE` - Enterprise Edition license
|
99
185
|
* `QA_SCREENSHOTS_DIR` - Path to a directory where screenshots for failing tests
|
100
186
|
will be saved (default: `/tmp/gitlab-qa/screenshots`)
|
101
187
|
* `QA_LOGS_DIR` - Path to a directory where logs will be saved (default:
|
102
188
|
`/tmp/gitlab-qa/logs`)
|
103
189
|
* `DOCKER_HOST` - Docker host to run tests against (default: `http://localhost`)
|
190
|
+
* `CHROME_HEADLESS` - when running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run
|
104
191
|
|
105
192
|
## Contributing
|
106
193
|
|
data/docs/macos.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# Run Geo QA tests against your Geo GDK setup
|
2
|
+
|
3
|
+
Run from the `gdk-ee/gitlab/qa` directory with GDK primary and secondary running:
|
4
|
+
|
5
|
+
```
|
6
|
+
# Run in the background
|
7
|
+
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
|
8
|
+
|
9
|
+
# Run in visible Chrome browser
|
10
|
+
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
|
+
```
|
12
|
+
|
13
|
+
# QA Tool support on macOS
|
14
|
+
|
15
|
+
Most of our development for GitLab is done on macOS. This brings some challenges as Docker on
|
16
|
+
macOS doesn't have feature parity with it's Linux conterpart.
|
17
|
+
|
18
|
+
There are two ways of running Docker on a Mac. Use a docker-machine provisioned virtual-machine
|
19
|
+
or use "native" Docker GUI based support.
|
20
|
+
|
21
|
+
When using docker-machine you can run your machines in the cloud or locally using something like
|
22
|
+
VirtualBox. This brings some extra options on how to expose network between macOS and the Linux
|
23
|
+
host VM, but requires extra steps like mapping `$DOCKER_HOST`, booting up and down the VMs with
|
24
|
+
docker-machine and possibly customizing network settings in the virtualization platform of choice.
|
25
|
+
|
26
|
+
Native Docker bundles it's own lightweight virtualization technology that works just like VirtualBox,
|
27
|
+
but without requiring manual intervention. This provides less opportunity to customize network between
|
28
|
+
docker containers and the host machine, but works out of the box when mapping container ports to ports
|
29
|
+
on localhost.
|
30
|
+
|
31
|
+
The major difference is that it never exposes the network as `bridge` to macOS, and so `--hostname`
|
32
|
+
and `--network` only work inside docker, it has no effect when trying to access the containers from macOS.
|
33
|
+
|
34
|
+
There are people in Docker's forum that claim to be able to [expose the network][Docker Route]
|
35
|
+
when using a mix of docker-machine and `route` CLI command.
|
36
|
+
|
37
|
+
When using the `route` command to expose the internet network, you still need to glue the DNS part.
|
38
|
+
There is another tool called [dnsdock][dnsdock] that may do the trick. That means you need to change
|
39
|
+
your DNS and point to the IP/port of `dnsdock` application.
|
40
|
+
|
41
|
+
# Docker on macOS caveats
|
42
|
+
|
43
|
+
When using OS X Docker, you need to go to Preferences > Advanced and allocate at least **5.0 GB**,
|
44
|
+
otherwise some steps may fail to execute the `chrome-webdriver`.
|
45
|
+
|
46
|
+
When using docker-machine, see [this StackOverflow link for increasing memory]
|
47
|
+
(https://stackoverflow.com/questions/32834082/how-to-increase-docker-machine-memory-mac/36982696#36982696).
|
48
|
+
|
49
|
+
This is required because chrome-webdriver makes use of `/dev/shm` shared memory. The VM will normally use
|
50
|
+
~ 3Gb but unless you allocate 5.0 or more some magic numbers may not enable a bigger /dev/shm in the
|
51
|
+
'host' VM that "native" docker runs on.
|
52
|
+
|
53
|
+
Please note that while it's possible to run multi-node tests like Geo Primary and Secondary, you can't
|
54
|
+
access the machines from your host machine, as they are all exposed as `0.0.0.0:port`, and because
|
55
|
+
of that they don't match the configured VHOSTs in your GitLab installation, so the redirect login
|
56
|
+
fails.
|
57
|
+
|
58
|
+
It has to do with the lack of `bridge` support from Docker on macOS, also this is also something
|
59
|
+
Docker Inc [doesn't want to fix][Docker bridge issue].
|
60
|
+
|
61
|
+
To see if this limitation is still present, check the [documentation][Docker Networking].
|
62
|
+
|
63
|
+
## Workarounds
|
64
|
+
|
65
|
+
One possible workaround to connect to a multi-node environment like Geo, is to run a reverse proxy on your
|
66
|
+
development machine that maps the VHOST to `localhost:port`, changing to the ports listed in `docker ps`.
|
67
|
+
|
68
|
+
You first need to map the hostnames to the local ip:
|
69
|
+
|
70
|
+
Edit the `/etc/hosts` file
|
71
|
+
```
|
72
|
+
127.0.0.1 gitlab-primary.geo gitlab-secondary.geo
|
73
|
+
```
|
74
|
+
We are going to use [caddyserver](https://caddyserver.com/) in this example. You can install caddy with `brew install caddy`.
|
75
|
+
|
76
|
+
After booting-up your containers, list the assigned ports:
|
77
|
+
|
78
|
+
```bash
|
79
|
+
$ docker ps
|
80
|
+
|
81
|
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
82
|
+
d28cc97870b4 gitlab/gitlab-ee:nightly "/assets/wrapper" 1 second ago Up Less than a second (health: starting) 22/tcp, 443/tcp, 0.0.0.0:32775->80/tcp gitlab-secondary
|
83
|
+
41f86bb951c5 gitlab/gitlab-ee:nightly "/assets/wrapper" 2 minutes ago Up 2 minutes (healthy) 22/tcp, 443/tcp, 0.0.0.0:32774->80/tcp gitlab-primary
|
84
|
+
```
|
85
|
+
|
86
|
+
Create a Caddyfile, mapping the VHOSTs with the `localhost:port` combination:
|
87
|
+
|
88
|
+
```
|
89
|
+
http://gitlab-primary.geo {
|
90
|
+
proxy / localhost:32774 {
|
91
|
+
transparent
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
http://gitlab-secondary.geo {
|
96
|
+
proxy / localhost:32775 {
|
97
|
+
transparent
|
98
|
+
}
|
99
|
+
}
|
100
|
+
```
|
101
|
+
|
102
|
+
And run caddy:
|
103
|
+
|
104
|
+
```bash
|
105
|
+
caddy -conf Caddyfile
|
106
|
+
```
|
107
|
+
|
108
|
+
You should be able to use your navigator and point it to `http://gitlab-primary.geo` or `http://gitlab-secondary.geo`.
|
109
|
+
|
110
|
+
[Docker Route]: https://forums.docker.com/t/access-container-from-dev-machine-by-ip-dns-name/24631/5
|
111
|
+
[Docker Networking]: https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds
|
112
|
+
[Docker bridge issue]: https://github.com/moby/moby/issues/22753#issuecomment-253534261
|
113
|
+
[dnsdock]: https://github.com/aacebedo/dnsdock
|
114
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
dn: uid=tanuki,dc=example,dc=org
|
2
|
+
changetype: add
|
3
|
+
uid: tanuki
|
4
|
+
cn: tanuki
|
5
|
+
sn: 3
|
6
|
+
objectClass: top
|
7
|
+
objectClass: posixAccount
|
8
|
+
objectClass: inetOrgPerson
|
9
|
+
loginShell: /bin/bash
|
10
|
+
homeDirectory: /home/tanuki
|
11
|
+
uidNumber: 14583102
|
12
|
+
gidNumber: 14564100
|
13
|
+
# hashed value for 'password'
|
14
|
+
userPassword: {SSHA}ICMhr6Jxt5bk2awD7HL7GxRTM3BZ1pFI
|
15
|
+
mail: tanuki@example.org
|
16
|
+
gecos: Tanuki User
|
data/gitlab-qa.gemspec
CHANGED
@@ -18,9 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
|
21
|
+
# Some dependencies are pinned, to prevent new cops from breaking the CI pipelines
|
22
|
+
spec.add_development_dependency 'gitlab-styles', '2.2.0'
|
22
23
|
spec.add_development_dependency 'pry', '~> 0.11'
|
23
24
|
spec.add_development_dependency 'rake', '~> 12.2'
|
24
25
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
25
|
-
spec.add_development_dependency 'rubocop', '
|
26
|
+
spec.add_development_dependency 'rubocop', '0.52.0'
|
27
|
+
spec.add_development_dependency 'rubocop-rspec', '1.20.1'
|
26
28
|
end
|
data/lib/gitlab/qa.rb
CHANGED
@@ -14,8 +14,9 @@ module Gitlab
|
|
14
14
|
|
15
15
|
module Test
|
16
16
|
module Instance
|
17
|
-
autoload :Image, 'qa/scenario/test/instance/image'
|
18
17
|
autoload :Any, 'qa/scenario/test/instance/any'
|
18
|
+
autoload :Image, 'qa/scenario/test/instance/image'
|
19
|
+
autoload :Staging, 'qa/scenario/test/instance/staging'
|
19
20
|
end
|
20
21
|
|
21
22
|
module Omnibus
|
@@ -25,8 +26,9 @@ module Gitlab
|
|
25
26
|
end
|
26
27
|
|
27
28
|
module Integration
|
28
|
-
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
|
29
29
|
autoload :Geo, 'qa/scenario/test/integration/geo'
|
30
|
+
autoload :LDAP, 'qa/scenario/test/integration/ldap'
|
31
|
+
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
|
30
32
|
end
|
31
33
|
|
32
34
|
module Sanity
|
@@ -37,12 +39,14 @@ module Gitlab
|
|
37
39
|
|
38
40
|
module Component
|
39
41
|
autoload :Gitlab, 'qa/component/gitlab'
|
42
|
+
autoload :LDAP, 'qa/component/ldap'
|
40
43
|
autoload :Specs, 'qa/component/specs'
|
44
|
+
autoload :Staging, 'qa/component/staging'
|
41
45
|
end
|
42
46
|
|
43
47
|
module Docker
|
44
|
-
autoload :Engine, 'qa/docker/engine'
|
45
48
|
autoload :Command, 'qa/docker/command'
|
49
|
+
autoload :Engine, 'qa/docker/engine'
|
46
50
|
autoload :Shellout, 'qa/docker/shellout'
|
47
51
|
autoload :Volumes, 'qa/docker/volumes'
|
48
52
|
end
|
@@ -10,8 +10,6 @@ module Gitlab
|
|
10
10
|
extend Forwardable
|
11
11
|
include Scenario::Actable
|
12
12
|
|
13
|
-
# rubocop:disable Style/Semicolon
|
14
|
-
|
15
13
|
attr_reader :release, :docker
|
16
14
|
attr_accessor :volumes, :network, :environment
|
17
15
|
attr_writer :name
|
@@ -54,7 +52,10 @@ module Gitlab
|
|
54
52
|
def instance
|
55
53
|
raise 'Please provide a block!' unless block_given?
|
56
54
|
|
57
|
-
prepare
|
55
|
+
prepare
|
56
|
+
start
|
57
|
+
reconfigure
|
58
|
+
wait
|
58
59
|
|
59
60
|
yield self
|
60
61
|
|
@@ -65,11 +66,11 @@ module Gitlab
|
|
65
66
|
@docker.pull(image, tag)
|
66
67
|
|
67
68
|
return if @docker.network_exists?(network)
|
69
|
+
|
68
70
|
@docker.network_create(network)
|
69
71
|
end
|
70
72
|
|
71
|
-
# rubocop:disable Metrics/AbcSize
|
72
|
-
def start
|
73
|
+
def start # rubocop:disable Metrics/AbcSize
|
73
74
|
ensure_configured!
|
74
75
|
|
75
76
|
docker.run(image, tag) do |command|
|
@@ -79,11 +80,15 @@ module Gitlab
|
|
79
80
|
command << "--hostname #{hostname}"
|
80
81
|
|
81
82
|
@volumes.to_h.each do |to, from|
|
82
|
-
command
|
83
|
+
command.volume(to, from, 'Z')
|
84
|
+
end
|
85
|
+
|
86
|
+
File.join(Runtime::Env.logs_dir, name).tap do |logs_dir|
|
87
|
+
command.volume(logs_dir, '/var/log/gitlab', 'Z')
|
83
88
|
end
|
84
89
|
|
85
90
|
@environment.to_h.each do |key, value|
|
86
|
-
command
|
91
|
+
command.env(key, value)
|
87
92
|
end
|
88
93
|
|
89
94
|
@network_aliases.to_a.each do |network_alias|
|
@@ -137,11 +142,8 @@ module Gitlab
|
|
137
142
|
|
138
143
|
private
|
139
144
|
|
140
|
-
# rubocop:disable Style/GuardClause
|
141
145
|
def ensure_configured!
|
142
|
-
unless [name, release, network].all?
|
143
|
-
raise 'Please configure an instance first!'
|
144
|
-
end
|
146
|
+
raise 'Please configure an instance first!' unless [name, release, network].all?
|
145
147
|
end
|
146
148
|
|
147
149
|
class Availability
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
# This component sets up the docker-openldap (https://github.com/osixia/docker-openldap)
|
4
|
+
# image with the proper configuration for GitLab users to login.
|
5
|
+
#
|
6
|
+
# By default, the docker-openldap image configures the Docker image with a
|
7
|
+
# default admin user in the example.org domain. This user does not have a uid
|
8
|
+
# attribute that GitLab needs to authenticate, so we seed the LDAP server with
|
9
|
+
# a "tanuki" user via a LDIF file in the fixtures/ldap directory.
|
10
|
+
#
|
11
|
+
# The docker-openldap container has a startup script
|
12
|
+
# (https://github.com/osixia/docker-openldap/blob/v1.1.11/image/service/slapd/startup.sh#L74-L78)
|
13
|
+
# that looks for custom LDIF files in the BOOTSTRAP_LDIF directory. Note that the LDIF
|
14
|
+
# files must have a "changetype" option specified for the script to work.
|
15
|
+
module Gitlab
|
16
|
+
module QA
|
17
|
+
module Component
|
18
|
+
class LDAP
|
19
|
+
include Scenario::Actable
|
20
|
+
|
21
|
+
LDAP_IMAGE = 'osixia/openldap'.freeze
|
22
|
+
LDAP_IMAGE_TAG = 'latest'.freeze
|
23
|
+
LDAP_DOMAIN = 'example.org'.freeze
|
24
|
+
ADMIN_USER = 'admin'.freeze
|
25
|
+
ADMIN_PASSWORD = 'admin'.freeze
|
26
|
+
LDAP_USER = 'tanuki'.freeze
|
27
|
+
LDAP_PASSWORD = 'password'.freeze
|
28
|
+
LDAP_PORT = 389
|
29
|
+
BASE_DN = 'dc=example,dc=org'.freeze
|
30
|
+
BIND_DN = 'cn=admin,dc=example,dc=org'.freeze
|
31
|
+
BOOTSTRAP_LDIF = '/container/service/slapd/assets/config/bootstrap/ldif/custom'.freeze
|
32
|
+
GROUP_BASE = 'ou=groups,dc=example,dc=org'.freeze
|
33
|
+
ADMIN_GROUP = 'admin'.freeze
|
34
|
+
FIXTURE_PATH = File.expand_path('../../../../fixtures/ldap'.freeze, __dir__)
|
35
|
+
|
36
|
+
attr_reader :docker
|
37
|
+
attr_accessor :volumes, :network, :environment
|
38
|
+
attr_writer :name
|
39
|
+
|
40
|
+
def initialize
|
41
|
+
@docker = Docker::Engine.new
|
42
|
+
@environment = {}
|
43
|
+
@volumes = {}
|
44
|
+
@network_aliases = []
|
45
|
+
|
46
|
+
@volumes[FIXTURE_PATH] = BOOTSTRAP_LDIF
|
47
|
+
end
|
48
|
+
|
49
|
+
def enable_tls(status)
|
50
|
+
@environment['LDAP_TLS'] = 'false' unless status
|
51
|
+
end
|
52
|
+
|
53
|
+
def username
|
54
|
+
LDAP_USER
|
55
|
+
end
|
56
|
+
|
57
|
+
def password
|
58
|
+
LDAP_PASSWORD
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_network_alias(name)
|
62
|
+
@network_aliases.push(name)
|
63
|
+
end
|
64
|
+
|
65
|
+
def name
|
66
|
+
@name ||= "openldap-#{SecureRandom.hex(4)}"
|
67
|
+
end
|
68
|
+
|
69
|
+
def hostname
|
70
|
+
"#{name}.#{network}"
|
71
|
+
end
|
72
|
+
|
73
|
+
def instance
|
74
|
+
raise 'Please provide a block!' unless block_given?
|
75
|
+
|
76
|
+
prepare
|
77
|
+
start
|
78
|
+
|
79
|
+
yield self
|
80
|
+
|
81
|
+
teardown
|
82
|
+
end
|
83
|
+
|
84
|
+
def prepare
|
85
|
+
@docker.pull(LDAP_IMAGE, LDAP_IMAGE_TAG)
|
86
|
+
|
87
|
+
return if @docker.network_exists?(network)
|
88
|
+
|
89
|
+
@docker.network_create(network)
|
90
|
+
end
|
91
|
+
|
92
|
+
def start
|
93
|
+
# copy-service needed for bootstraping LDAP user:
|
94
|
+
# https://github.com/osixia/docker-openldap#seed-ldap-database-with-ldif
|
95
|
+
docker.run(LDAP_IMAGE, LDAP_IMAGE_TAG, '--copy-service') do |command|
|
96
|
+
command << '-d '
|
97
|
+
command << "--name #{name}"
|
98
|
+
command << "--net #{network}"
|
99
|
+
command << "--hostname #{hostname}"
|
100
|
+
|
101
|
+
@volumes.to_h.each do |to, from|
|
102
|
+
command.volume(to, from, 'Z')
|
103
|
+
end
|
104
|
+
|
105
|
+
@environment.to_h.each do |key, value|
|
106
|
+
command.env(key, value)
|
107
|
+
end
|
108
|
+
|
109
|
+
@network_aliases.to_a.each do |network_alias|
|
110
|
+
command << "--network-alias #{network_alias}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def restart
|
116
|
+
@docker.restart(name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def teardown
|
120
|
+
raise 'Invalid instance name!' unless name
|
121
|
+
|
122
|
+
@docker.stop(name)
|
123
|
+
@docker.remove(name)
|
124
|
+
end
|
125
|
+
|
126
|
+
def pull
|
127
|
+
@docker.pull(LDAP_IMAGE, LDAP_IMAGE_TAG)
|
128
|
+
end
|
129
|
+
|
130
|
+
def to_config
|
131
|
+
config = YAML.safe_load <<~CFG
|
132
|
+
main:
|
133
|
+
label: LDAP
|
134
|
+
host: #{hostname}
|
135
|
+
port: #{LDAP_PORT}
|
136
|
+
uid: 'uid'
|
137
|
+
bind_dn: #{BIND_DN}
|
138
|
+
password: #{ADMIN_PASSWORD}
|
139
|
+
method: 'plain'
|
140
|
+
base: #{BASE_DN}
|
141
|
+
user_filter: ''
|
142
|
+
group_base: #{GROUP_BASE}
|
143
|
+
admin_group: #{ADMIN_GROUP}
|
144
|
+
external_groups: ''
|
145
|
+
sync_ssh_keys: false
|
146
|
+
CFG
|
147
|
+
|
148
|
+
# Quotes get eaten up when the string is set in the environment
|
149
|
+
config.to_s.gsub("\"", "\\\"")
|
150
|
+
end
|
151
|
+
|
152
|
+
def set_gitlab_credentials
|
153
|
+
::Gitlab::QA::Runtime::Env.ldap_username = username
|
154
|
+
::Gitlab::QA::Runtime::Env.ldap_password = password
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -20,12 +20,12 @@ module Gitlab
|
|
20
20
|
@docker.run(release.qa_image, release.tag, suite, *args) do |command|
|
21
21
|
command << "-t --rm --net=#{network || 'bridge'}"
|
22
22
|
|
23
|
-
Runtime::Env.
|
24
|
-
|
23
|
+
variables = Runtime::Env.variables
|
24
|
+
variables.each do |key, value|
|
25
|
+
command.env(key, value)
|
25
26
|
end
|
26
27
|
|
27
28
|
command.volume('/var/run/docker.sock', '/var/run/docker.sock')
|
28
|
-
command.volume(Runtime::Env.logs_dir, '/var/log/gitlab')
|
29
29
|
command.volume(Runtime::Env.screenshots_dir, '/home/qa/tmp')
|
30
30
|
command.name("gitlab-specs-#{Time.now.to_i}")
|
31
31
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module Gitlab
|
6
|
+
module QA
|
7
|
+
module Component
|
8
|
+
class Staging
|
9
|
+
ADDRESS = 'https://staging.gitlab.com'.freeze
|
10
|
+
|
11
|
+
def self.release
|
12
|
+
version = Version.new(ADDRESS).fetch!
|
13
|
+
|
14
|
+
Release.new("EE:#{version}")
|
15
|
+
rescue InvalidResponseError => ex
|
16
|
+
warn ex.message
|
17
|
+
warn "#{ex.response.code} #{ex.response.message}: #{ex.response.body}"
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
|
21
|
+
class InvalidResponseError < StandardError
|
22
|
+
attr_reader :response
|
23
|
+
|
24
|
+
def initialize(address, response)
|
25
|
+
@response = response
|
26
|
+
|
27
|
+
super "Invalid response received from #{address}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Version
|
32
|
+
def initialize(address)
|
33
|
+
@uri = URI.join(address, '/api/v4/version')
|
34
|
+
end
|
35
|
+
|
36
|
+
def fetch!
|
37
|
+
response =
|
38
|
+
Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
|
39
|
+
http.request(request)
|
40
|
+
end
|
41
|
+
|
42
|
+
case response
|
43
|
+
when Net::HTTPSuccess
|
44
|
+
JSON.parse(response.body).fetch('version')
|
45
|
+
else
|
46
|
+
raise InvalidResponseError.new(@uri.to_s, response)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def request
|
53
|
+
Runtime::Env.require_qa_access_token!
|
54
|
+
|
55
|
+
@request ||= Net::HTTP::Get.new(@uri.path).tap do |req|
|
56
|
+
req['PRIVATE-TOKEN'] = Runtime::Env.qa_access_token
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -12,16 +12,16 @@ module Gitlab
|
|
12
12
|
tap { @args.concat(args) }
|
13
13
|
end
|
14
14
|
|
15
|
-
def volume(from, to)
|
16
|
-
tap { @args
|
15
|
+
def volume(from, to, opt = :z)
|
16
|
+
tap { @args.push("--volume #{from}:#{to}:#{opt}") }
|
17
17
|
end
|
18
18
|
|
19
19
|
def name(identity)
|
20
|
-
tap { @args
|
20
|
+
tap { @args.push("--name #{identity}") }
|
21
21
|
end
|
22
22
|
|
23
23
|
def env(name, value)
|
24
|
-
tap { @args
|
24
|
+
tap { @args.push(%(--env #{name}="#{value}")) }
|
25
25
|
end
|
26
26
|
|
27
27
|
def to_s
|
@@ -4,10 +4,25 @@ module Gitlab
|
|
4
4
|
module Env
|
5
5
|
extend self
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
ENV_VARIABLES = {
|
8
|
+
'GITLAB_USERNAME' => :user_username,
|
9
|
+
'GITLAB_PASSWORD' => :user_password,
|
10
|
+
'GITLAB_LDAP_USERNAME' => :ldap_username,
|
11
|
+
'GITLAB_LDAP_PASSWORD' => :ldap_password,
|
12
|
+
'GITLAB_USER_TYPE' => :user_type,
|
13
|
+
'GITLAB_SANDBOX_NAME' => :gitlab_sandbox_name,
|
14
|
+
'GITLAB_QA_ACCESS_TOKEN' => :qa_access_token,
|
15
|
+
'GITLAB_URL' => :gitlab_url,
|
16
|
+
'EE_LICENSE' => :ee_license
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
ENV_VARIABLES.each_value do |accessor|
|
20
|
+
send(:attr_accessor, accessor) # rubocop:disable GitlabSecurity/PublicSend
|
21
|
+
end
|
22
|
+
|
23
|
+
def qa_access_token
|
24
|
+
ENV['GITLAB_QA_ACCESS_TOKEN']
|
25
|
+
end
|
11
26
|
|
12
27
|
def screenshots_dir
|
13
28
|
ENV['QA_SCREENSHOTS_DIR'] || '/tmp/gitlab-qa/screenshots'
|
@@ -17,8 +32,42 @@ module Gitlab
|
|
17
32
|
ENV['QA_LOGS_DIR'] || '/tmp/gitlab-qa/logs'
|
18
33
|
end
|
19
34
|
|
20
|
-
def
|
21
|
-
|
35
|
+
def variables
|
36
|
+
vars = {}
|
37
|
+
|
38
|
+
ENV_VARIABLES.each do |name, attribute|
|
39
|
+
# Variables that are overriden in the environment take precedence
|
40
|
+
# over the defaults specified by the QA runtime.
|
41
|
+
value = env_value_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend
|
42
|
+
vars[name] = value if value
|
43
|
+
end
|
44
|
+
|
45
|
+
vars
|
46
|
+
end
|
47
|
+
|
48
|
+
def require_license!
|
49
|
+
return if ENV.include?('EE_LICENSE')
|
50
|
+
|
51
|
+
raise ArgumentError, 'GitLab License is not available. Please load a license into EE_LICENSE env variable.'
|
52
|
+
end
|
53
|
+
|
54
|
+
def require_no_license!
|
55
|
+
return unless ENV.include?('EE_LICENSE')
|
56
|
+
|
57
|
+
raise ArgumentError, "Unexpected EE_LICENSE provided. Please unset it to continue."
|
58
|
+
end
|
59
|
+
|
60
|
+
def require_qa_access_token!
|
61
|
+
return unless ENV['GITLAB_QA_ACCESS_TOKEN'].to_s.strip.empty?
|
62
|
+
|
63
|
+
raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def env_value_if_defined(variable)
|
69
|
+
# Pass through the variables if they are defined in the environment
|
70
|
+
return "$#{variable}" if ENV[variable]
|
22
71
|
end
|
23
72
|
end
|
24
73
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Gitlab
|
2
|
+
module QA
|
3
|
+
module Scenario
|
4
|
+
module Test
|
5
|
+
module Instance
|
6
|
+
##
|
7
|
+
# Run test suite against staging.gitlab.com
|
8
|
+
#
|
9
|
+
class Staging < Scenario::Template
|
10
|
+
def perform(*)
|
11
|
+
Runtime::Env.require_no_license!
|
12
|
+
|
13
|
+
release = Component::Staging.release
|
14
|
+
|
15
|
+
Component::Specs.perform do |specs|
|
16
|
+
specs.suite = 'Test::Instance'
|
17
|
+
specs.release = release
|
18
|
+
specs.args = [Component::Staging::ADDRESS]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -5,6 +5,7 @@ module Gitlab
|
|
5
5
|
module Integration
|
6
6
|
class Geo < Scenario::Template
|
7
7
|
##
|
8
|
+
# rubocop:disable Lint/MissingCopEnableDirective
|
8
9
|
# rubocop:disable Metrics/MethodLength
|
9
10
|
# rubocop:disable Metrics/AbcSize
|
10
11
|
#
|
@@ -13,6 +14,8 @@ module Gitlab
|
|
13
14
|
|
14
15
|
raise ArgumentError, 'Geo is EE only!' unless release.ee?
|
15
16
|
|
17
|
+
Runtime::Env.require_license!
|
18
|
+
|
16
19
|
Component::Gitlab.perform do |primary|
|
17
20
|
primary.release = release
|
18
21
|
primary.name = 'gitlab-primary'
|
@@ -24,6 +27,8 @@ module Gitlab
|
|
24
27
|
postgresql['md5_auth_cidr_addresses'] = ['0.0.0.0/0'];
|
25
28
|
postgresql['max_replication_slots'] = 1;
|
26
29
|
gitlab_rails['db_key_base'] = '4dd58204865eb41bca93bd38131d51cc';
|
30
|
+
sidekiq['concurrency'] = 2;
|
31
|
+
unicorn['worker_processes'] = 2;
|
27
32
|
OMNIBUS
|
28
33
|
|
29
34
|
primary.instance do
|
@@ -34,6 +39,8 @@ module Gitlab
|
|
34
39
|
secondary.omnibus_config = <<~OMNIBUS
|
35
40
|
geo_secondary_role['enable'] = true;
|
36
41
|
gitlab_rails['db_key_base'] = '4dd58204865eb41bca93bd38131d51cc';
|
42
|
+
sidekiq['concurrency'] = 2;
|
43
|
+
unicorn['worker_processes'] = 2;
|
37
44
|
OMNIBUS
|
38
45
|
|
39
46
|
secondary.act do
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class LDAP < 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-ldap'
|
14
|
+
gitlab.network = 'test'
|
15
|
+
|
16
|
+
Component::LDAP.perform do |ldap|
|
17
|
+
ldap.enable_tls(false)
|
18
|
+
ldap.network = 'test'
|
19
|
+
ldap.set_gitlab_credentials
|
20
|
+
|
21
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
22
|
+
gitlab_rails['ldap_enabled'] = true;
|
23
|
+
gitlab_rails['ldap_servers'] = #{ldap.to_config};
|
24
|
+
OMNIBUS
|
25
|
+
|
26
|
+
ldap.instance do
|
27
|
+
gitlab.instance do
|
28
|
+
puts 'Running LDAP specs!'
|
29
|
+
|
30
|
+
Component::Specs.perform do |specs|
|
31
|
+
specs.suite = 'Test::Integration::LDAP'
|
32
|
+
specs.release = gitlab.release
|
33
|
+
specs.network = gitlab.network
|
34
|
+
specs.args = [gitlab.address]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# rubocop:enable Metrics/AbcSize
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -4,15 +4,19 @@ module Gitlab
|
|
4
4
|
module Test
|
5
5
|
module Omnibus
|
6
6
|
class Image < Scenario::Template
|
7
|
-
# rubocop:disable Style/Semicolon
|
8
7
|
def perform(release)
|
9
8
|
Component::Gitlab.perform do |gitlab|
|
10
9
|
gitlab.release = release
|
11
10
|
gitlab.network = 'bridge'
|
12
11
|
|
13
12
|
gitlab.act do
|
14
|
-
prepare
|
15
|
-
|
13
|
+
prepare
|
14
|
+
start
|
15
|
+
reconfigure
|
16
|
+
|
17
|
+
restart
|
18
|
+
wait
|
19
|
+
teardown
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -15,11 +15,13 @@ module Gitlab
|
|
15
15
|
HOURS_AGO = 24
|
16
16
|
COMMITS = 10_000
|
17
17
|
|
18
|
-
# rubocop:disable Style/Semicolon
|
19
18
|
def perform(release)
|
20
19
|
version = Component::Gitlab.perform do |gitlab|
|
21
20
|
gitlab.release = release
|
22
|
-
gitlab.act
|
21
|
+
gitlab.act do
|
22
|
+
pull
|
23
|
+
sha_version
|
24
|
+
end
|
23
25
|
end
|
24
26
|
|
25
27
|
project = "gitlab-org/#{Release.new(release).project_name}"
|
data/lib/gitlab/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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:
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: gitlab-styles
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,30 @@ dependencies:
|
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.52.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.52.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.20.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 1.20.1
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- grzesiek.bizon@gmail.com
|
@@ -104,12 +118,16 @@ files:
|
|
104
118
|
- bin/setup
|
105
119
|
- docs/README.md
|
106
120
|
- docs/architecture.md
|
121
|
+
- docs/macos.md
|
107
122
|
- docs/trainings.md
|
108
123
|
- exe/gitlab-qa
|
124
|
+
- fixtures/ldap/tanuki.ldif
|
109
125
|
- gitlab-qa.gemspec
|
110
126
|
- lib/gitlab/qa.rb
|
111
127
|
- lib/gitlab/qa/component/gitlab.rb
|
128
|
+
- lib/gitlab/qa/component/ldap.rb
|
112
129
|
- lib/gitlab/qa/component/specs.rb
|
130
|
+
- lib/gitlab/qa/component/staging.rb
|
113
131
|
- lib/gitlab/qa/docker/command.rb
|
114
132
|
- lib/gitlab/qa/docker/engine.rb
|
115
133
|
- lib/gitlab/qa/docker/shellout.rb
|
@@ -120,7 +138,9 @@ files:
|
|
120
138
|
- lib/gitlab/qa/scenario/template.rb
|
121
139
|
- lib/gitlab/qa/scenario/test/instance/any.rb
|
122
140
|
- lib/gitlab/qa/scenario/test/instance/image.rb
|
141
|
+
- lib/gitlab/qa/scenario/test/instance/staging.rb
|
123
142
|
- lib/gitlab/qa/scenario/test/integration/geo.rb
|
143
|
+
- lib/gitlab/qa/scenario/test/integration/ldap.rb
|
124
144
|
- lib/gitlab/qa/scenario/test/integration/mattermost.rb
|
125
145
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|
126
146
|
- lib/gitlab/qa/scenario/test/omnibus/update.rb
|
@@ -147,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
167
|
version: '0'
|
148
168
|
requirements: []
|
149
169
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.7.7
|
151
171
|
signing_key:
|
152
172
|
specification_version: 4
|
153
173
|
summary: Integration tests for GitLab
|