gitlab-qa 5.16.0 → 5.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/what_tests_can_be_run.md +82 -5
- data/lib/gitlab/qa/component/specs.rb +35 -11
- data/lib/gitlab/qa/runtime/env.rb +2 -0
- data/lib/gitlab/qa/scenario/test/instance/geo.rb +0 -3
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9c4251f7eaa756abc42d5cb76b0b318ec3b14004331d32a92e125135055ecef
|
4
|
+
data.tar.gz: 04bb9549728a2533cfb34b2e5ade00260511fda1d6e4d052769d9682b73b497b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb8a2afb17ac4d47e0c770c8da39a3290d6ac58d6306f3a930d50b08180660c85995ff248b1f50bdd6f8d9fe26b29f8680016b03ff07f85d5600e1bd5c7be90
|
7
|
+
data.tar.gz: a84cd2cef18c8f229826b47236edd8749345de2bfb51be1705109d623b0fefec7b09088f46244df206f85665420fb22dbdc3d8a250e617a8ab45876e95fc99d0
|
@@ -1,5 +1,6 @@
|
|
1
|
-
# What tests can be run?
|
2
1
|
|
2
|
+
# What tests can be run?
|
3
|
+
[[_TOC_]]
|
3
4
|
## The two types of QA tests
|
4
5
|
|
5
6
|
First of all, the first thing to choose is whether you want to run orchestrated
|
@@ -28,6 +29,8 @@ For more details on the internals, please read the
|
|
28
29
|
|
29
30
|
## Supported GitLab environment variables
|
30
31
|
|
32
|
+
All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa/runtime/env.rb`](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/master/lib/gitlab/qa/runtime/env.rb).
|
33
|
+
|
31
34
|
| Variable | Default | Description | Required |
|
32
35
|
|-----------------------|-----------|-----------------------|----------|
|
33
36
|
| `GITLAB_USERNAME` | `root` | Username to use when signing into GitLab. | Yes|
|
@@ -53,7 +56,8 @@ For more details on the internals, please read the
|
|
53
56
|
| `GITLAB_SANDBOX_NAME` | `gitlab-qa-sandbox` | The sandbox group name the test suite is going to use. | No|
|
54
57
|
| `GITLAB_QA_ACCESS_TOKEN`|- | A valid personal access token with the `api` scope. This is used for API access during tests, and is used in the version that staging is currently running. An existing token that is valid on [`Test::Instance::Staging`](#testinstancestaging) scenario to retrieve the staging can be found in the shared 1Password vault. |No|
|
55
58
|
| `GITLAB_QA_ADMIN_ACCESS_TOKEN` |- | A valid personal access token with the `api` scope from a user with admin access. Used for API access as an admin during tests. | No|
|
56
|
-
| `
|
59
|
+
| `GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN` | - | A valid personal access token with the `read_registry` scope. Used to [access the container registry on `registry.gitlab.com` when tests run in a CI job that _is not_ triggered via another pipeline](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/364addb83e7b136ff0f9d8719ca9553d290aa9ab/lib/gitlab/qa/release.rb#L152). For example, if you manually run a [new Staging pipeline](https://ops.gitlab.net/gitlab-org/quality/staging/-/pipelines/new), this token will be used. | No |
|
60
|
+
| `EE_LICENSE` |- | Enterprise Edition license. | No|
|
57
61
|
| `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
|
58
62
|
| `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
|
59
63
|
| `CHROME_HEADLESS` |- | When running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run. | No|
|
@@ -83,8 +87,27 @@ For more details on the internals, please read the
|
|
83
87
|
|
84
88
|
## Running tests with a feature flag enabled
|
85
89
|
|
86
|
-
It is possible to enable a feature flag before running tests.
|
87
|
-
|
90
|
+
It is possible to enable or disable a feature flag before running tests.
|
91
|
+
To test a Gitlab image with a feature flag enabled, run this command:
|
92
|
+
```
|
93
|
+
$ gitlab-qa Test::Instance::Image gitlab/gitlab-ee:12.4.0-ee.0 --enable-feature feature_flag_name
|
94
|
+
```
|
95
|
+
|
96
|
+
To run a test with feature flag disabled, run this command:
|
97
|
+
```
|
98
|
+
$ gitlab-qa Test::Instance::Image gitlab/gitlab-ee:12.4.0-ee.0 --disable-feature feature_flag_name
|
99
|
+
```
|
100
|
+
|
101
|
+
You an also test a GitLab image multiple times with different feature flag settings:
|
102
|
+
```
|
103
|
+
$ gitlab-qa Test::Instance::Image gitlab/gitlab-ee:12.4.0-ee.0 --disable-feature feature_flag_name --enable-feature feature_flag_name
|
104
|
+
```
|
105
|
+
This will first disable `feature_flag_name` flag and run the tests and then enable it and run the tests again.
|
106
|
+
|
107
|
+
You can pass any number of feature flag settings. The tests will run once for each setting.
|
108
|
+
|
109
|
+
See the [QA framework documentation](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/README.md#running-tests-with-a-feature-flag-enabled)
|
110
|
+
for information on running the tests with different feature flag settings from the QA framework.
|
88
111
|
|
89
112
|
## Specifying the GitLab version
|
90
113
|
|
@@ -545,7 +568,7 @@ in the GitLab CE project).
|
|
545
568
|
|
546
569
|
- `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
|
547
570
|
`gitlab-qa-bot` on `dev.gitlab.org` with the `registry` scope.
|
548
|
-
This is used to pull the QA Docker from the Omnibus GitLab `dev` Container Registry.
|
571
|
+
This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
|
549
572
|
If the variable isn't present, the QA image from Docker Hub will be used.
|
550
573
|
This can be found in the shared 1Password vault.
|
551
574
|
|
@@ -560,6 +583,41 @@ $ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
|
560
583
|
$ gitlab-qa Test::Instance::Staging
|
561
584
|
```
|
562
585
|
|
586
|
+
### `Test::Instance::StagingGeo`
|
587
|
+
|
588
|
+
This scenario tests that the Geo staging deployment (with [`staging.gitlab.com`](https://staging.gitlab.com) as the primary site and [`geo.staging.gitlab.com`](https://geo.staging.gitlab.com) as the secondary site) works as expected by running tests tagged `:geo` against it. This is done by spinning up a GitLab QA (`gitlab/gitlab-qa`) container and running the `QA::EE::Scenario::Test::Geo` scenario. Note that the Geo setup steps in the `QA::EE::Scenario::Test::Geo` scenario are skipped when testing a live Geo deployment.
|
589
|
+
|
590
|
+
**Required user properties:**
|
591
|
+
|
592
|
+
- The user must provide OAuth authorization on the secondary site before running Geo tests. This can be done via the authorization modal that appears after logging into the secondary node for the first time.
|
593
|
+
|
594
|
+
- Some Geo tests require the user to have Admin access level (for example, the Geo Nodes API tests)
|
595
|
+
|
596
|
+
**Required environment variables:**
|
597
|
+
|
598
|
+
- `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
|
599
|
+
This is used to retrieve the version that staging is currently running.
|
600
|
+
This can be found in the shared 1Password vault.
|
601
|
+
|
602
|
+
**Optional environment variables:**
|
603
|
+
|
604
|
+
- `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
|
605
|
+
`gitlab-qa-bot` on `dev.gitlab.org` with the `registry` scope.
|
606
|
+
This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
|
607
|
+
If the variable isn't present, the QA image from Docker Hub will be used.
|
608
|
+
This can be found in the shared 1Password vault.
|
609
|
+
|
610
|
+
Example:
|
611
|
+
|
612
|
+
```
|
613
|
+
$ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
|
614
|
+
$ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
|
615
|
+
$ export GITLAB_USERNAME="gitlab-qa"
|
616
|
+
$ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
617
|
+
|
618
|
+
$ gitlab-qa Test::Instance::StagingGeo
|
619
|
+
```
|
620
|
+
|
563
621
|
### `Test::Instance::Production`
|
564
622
|
|
565
623
|
This scenario functions the same as `Test::Instance::Staging`
|
@@ -633,6 +691,25 @@ $ export EE_LICENSE=$(cat /path/to/gitlab_license)
|
|
633
691
|
$ gitlab-qa Test::Instance::Airgapped EE -- --tag smoke
|
634
692
|
```
|
635
693
|
|
694
|
+
### `Test::Instance::Geo EE|<full image address>:nightly|latest|any_tag http://geo-primary.gitlab http://geo-secondary.gitlab`
|
695
|
+
|
696
|
+
This scenario will run tests tagged `:geo` against a live Geo deployment, by spinning up a GitLab QA (`gitlab/gitlab-qa`)
|
697
|
+
container and running the `QA::EE::Scenario::Test::Geo` scenario. Note that the Geo setup steps in the `QA::EE::Scenario::Test::Geo` scenario are skipped when testing a live Geo deployment. The URLs for the primary site and secondary site of the live Geo deployment must be provided as command line arguments.
|
698
|
+
|
699
|
+
**Required user properties:**
|
700
|
+
|
701
|
+
- The user must provide OAuth authorization on the secondary site before running Geo tests. This can be done via the authorization modal that appears after signing into the secondary node for the first time.
|
702
|
+
|
703
|
+
- Some Geo tests require the user to have Admin access level (for example, the Geo Nodes API tests)
|
704
|
+
|
705
|
+
Example:
|
706
|
+
|
707
|
+
```
|
708
|
+
$ export GITLAB_USERNAME="gitlab-qa"
|
709
|
+
$ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
710
|
+
|
711
|
+
$ gitlab-qa Test::Instance::Geo EE https://primary.gitlab.com https://secondary.gitlab.com
|
712
|
+
```
|
636
713
|
----
|
637
714
|
|
638
715
|
[Back to README.md](../README.md)
|
@@ -27,26 +27,50 @@ module Gitlab
|
|
27
27
|
|
28
28
|
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
|
29
29
|
|
30
|
-
|
31
|
-
command << "-t --rm --net=#{network || 'bridge'}"
|
30
|
+
feature_flag_sets = []
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
# When `args` includes `[..., "--disable-feature", "a", "--enable-feature", "b", ...]`
|
33
|
+
# `feature_flag_sets` will be set to `[["--disable-feature", "a"], ["--enable-feature", "b"]]`
|
34
|
+
# This will result in tests running twice, once with each feature.
|
35
|
+
while (index = args&.index { |x| x =~ /--.*-feature/ })
|
36
|
+
feature_flag_sets << args.slice!(index, 2)
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
+
# When `args` do not have either "--disable-feature" or "--enable-feature", we
|
40
|
+
# add [] so that test is run exactly once.
|
41
|
+
feature_flag_sets << [] unless feature_flag_sets.any?
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
+
feature_flag_sets.each do |feature_flag_set|
|
44
|
+
@docker.run(release.qa_image, release.qa_tag, suite, *args_with_flags(args, feature_flag_set)) do |command|
|
45
|
+
command << "-t --rm --net=#{network || 'bridge'}"
|
46
|
+
|
47
|
+
env.merge(Runtime::Env.variables).each do |key, value|
|
48
|
+
command.env(key, value)
|
49
|
+
end
|
50
|
+
|
51
|
+
command.volume('/var/run/docker.sock', '/var/run/docker.sock')
|
52
|
+
command.volume(File.join(Runtime::Env.host_artifacts_dir, name), File.join(Docker::Volumes::QA_CONTAINER_WORKDIR, 'tmp'))
|
53
|
+
|
54
|
+
@volumes.to_h.each do |to, from|
|
55
|
+
command.volume(to, from)
|
56
|
+
end
|
43
57
|
|
44
|
-
|
58
|
+
command.name(name)
|
59
|
+
end
|
45
60
|
end
|
46
61
|
end
|
47
62
|
|
48
63
|
private
|
49
64
|
|
65
|
+
def args_with_flags(args, feature_flag_set)
|
66
|
+
return args if feature_flag_set.empty?
|
67
|
+
|
68
|
+
puts "Running with feature flag: #{feature_flag_set.join(' ')}"
|
69
|
+
|
70
|
+
args_with_f = args.dup
|
71
|
+
args_with_f.insert(1, *feature_flag_set)
|
72
|
+
end
|
73
|
+
|
50
74
|
def skip_tests?
|
51
75
|
Runtime::Scenario.attributes.include?(:run_tests) && !Runtime::Scenario.run_tests
|
52
76
|
end
|
@@ -6,6 +6,8 @@ module Gitlab
|
|
6
6
|
module Env
|
7
7
|
extend self
|
8
8
|
|
9
|
+
# Variables that are used in tests and are passed through to the docker container that executes the tests.
|
10
|
+
# These variables should be listed in /docs/what_tests_can_be_run.md#supported-gitlab-environment-variables
|
9
11
|
ENV_VARIABLES = {
|
10
12
|
'QA_REMOTE_GRID' => :remote_grid,
|
11
13
|
'QA_REMOTE_GRID_USERNAME' => :remote_grid_username,
|
@@ -8,9 +8,6 @@ module Gitlab
|
|
8
8
|
|
9
9
|
class Geo < Scenario::Template
|
10
10
|
def perform(release, primary_address, secondary_address, *rspec_args)
|
11
|
-
# Geo requires an EE license
|
12
|
-
Runtime::Env.require_license!
|
13
|
-
|
14
11
|
Component::Specs.perform do |specs|
|
15
12
|
specs.suite = 'QA::EE::Scenario::Test::Geo'
|
16
13
|
specs.release = QA::Release.new(release)
|
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.17.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-07-
|
11
|
+
date: 2020-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|