gitlab-qa 5.14.1 → 6.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 +41 -2
- data/README.md +52 -5
- data/docs/what_tests_can_be_run.md +101 -5
- data/lib/gitlab/qa.rb +4 -1
- data/lib/gitlab/qa/component/base.rb +32 -11
- data/lib/gitlab/qa/component/specs.rb +43 -11
- data/lib/gitlab/qa/docker/command.rb +15 -3
- data/lib/gitlab/qa/docker/engine.rb +5 -1
- data/lib/gitlab/qa/docker/shellout.rb +2 -2
- data/lib/gitlab/qa/release.rb +9 -2
- data/lib/gitlab/qa/report/json_test_results.rb +21 -0
- data/lib/gitlab/qa/report/junit_test_results.rb +21 -0
- data/lib/gitlab/qa/report/results_in_issues.rb +22 -18
- data/lib/gitlab/qa/report/test_result.rb +54 -0
- data/lib/gitlab/qa/runner.rb +23 -15
- data/lib/gitlab/qa/runtime/env.rb +11 -0
- data/lib/gitlab/qa/scenario/test/instance/geo.rb +0 -3
- data/lib/gitlab/qa/scenario/test/integration/geo.rb +4 -2
- data/lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb +204 -0
- data/lib/gitlab/qa/scenario/test/integration/praefect.rb +20 -8
- data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +6 -3
- data/lib/gitlab/qa/scenario/test/integration/gitaly_ha.rb +0 -166
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87249baf75070cf8c5362c34b9995f6163370e9b6e353a393104beefe62d4bd8
|
4
|
+
data.tar.gz: 6e00eee6993c9f5c6aeb4cb187c708941bfd27cb9b59340165b23b02c30f583a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d621d51ca18fa402e397b13c86dda6d52039a11ca259c6a46f3e9caffeab0faa68b6b9ff58ec4f727b2dae82c386442655122571936a47c366647b3ad895a50
|
7
|
+
data.tar.gz: 73bbcc44b560368e64d8bd335b3fac6d52128e8c05f6ddf582ea6139032f570d80563b6fbc9c96f41598fee2c2c345ec9155f5990f3ea4df1bde2167bede9a27
|
data/.gitlab-ci.yml
CHANGED
@@ -94,7 +94,7 @@ release:
|
|
94
94
|
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
95
95
|
- exe/gitlab-qa-report --update-screenshot-path "gitlab-qa-run-*/**/rspec-*.xml"
|
96
96
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
97
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT"; fi
|
97
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
98
98
|
- exit $test_run_exit_code
|
99
99
|
|
100
100
|
.ce-qa:
|
@@ -832,6 +832,44 @@ ee:praefect-quarantine:
|
|
832
832
|
QA_CAN_TEST_PRAEFECT: "true"
|
833
833
|
QA_RSPEC_TAGS: "--tag quarantine --tag ~orchestrated"
|
834
834
|
|
835
|
+
ce:gitaly-cluster:
|
836
|
+
extends:
|
837
|
+
- .test
|
838
|
+
- .high-capacity
|
839
|
+
- .ce-qa
|
840
|
+
- .rspec-report-opts
|
841
|
+
variables:
|
842
|
+
QA_SCENARIO: "Test::Integration::GitalyCluster"
|
843
|
+
|
844
|
+
ce:gitaly-cluster-quarantine:
|
845
|
+
extends:
|
846
|
+
- .test
|
847
|
+
- .high-capacity
|
848
|
+
- .ce-qa
|
849
|
+
- .quarantine
|
850
|
+
- .rspec-report-opts
|
851
|
+
variables:
|
852
|
+
QA_SCENARIO: "Test::Integration::GitalyCluster"
|
853
|
+
|
854
|
+
ee:gitaly-cluster:
|
855
|
+
extends:
|
856
|
+
- .test
|
857
|
+
- .high-capacity
|
858
|
+
- .ee-qa
|
859
|
+
- .rspec-report-opts
|
860
|
+
variables:
|
861
|
+
QA_SCENARIO: "Test::Integration::GitalyCluster"
|
862
|
+
|
863
|
+
ee:gitaly-cluster-quarantine:
|
864
|
+
extends:
|
865
|
+
- .test
|
866
|
+
- .high-capacity
|
867
|
+
- .ee-qa
|
868
|
+
- .quarantine
|
869
|
+
- .rspec-report-opts
|
870
|
+
variables:
|
871
|
+
QA_SCENARIO: "Test::Integration::GitalyCluster"
|
872
|
+
|
835
873
|
ce:smtp:
|
836
874
|
extends:
|
837
875
|
- .test
|
@@ -893,7 +931,8 @@ ee:jira-quarantine:
|
|
893
931
|
staging:
|
894
932
|
script:
|
895
933
|
- unset EE_LICENSE
|
896
|
-
- exe/gitlab-qa Test::Instance::Staging
|
934
|
+
- 'echo "Running: exe/gitlab-qa Test::Instance::Staging ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS"'
|
935
|
+
- exe/gitlab-qa Test::Instance::Staging ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS
|
897
936
|
extends:
|
898
937
|
- .test
|
899
938
|
- .high-capacity
|
data/README.md
CHANGED
@@ -121,11 +121,58 @@ All the scenarios you can run are described in the
|
|
121
121
|
|
122
122
|
Note: The GitLab QA tool requires that [Docker](https://docs.docker.com/install/) is installed.
|
123
123
|
|
124
|
-
###
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
### Command-line options
|
125
|
+
|
126
|
+
In addition to the [arguments you can use to specify the scenario and
|
127
|
+
tests to run](/docs/what_tests_can_be_run.md), you can use the
|
128
|
+
following options to control the tool's behavior.
|
129
|
+
|
130
|
+
**Note:** These are `gitlab-qa` options so if you specify RSpec
|
131
|
+
options as well, including test file paths, be sure to add these
|
132
|
+
options before the `--` that indicates that subsequent arguments are
|
133
|
+
intended for RSpec.
|
134
|
+
|
135
|
+
| Option | Description |
|
136
|
+
| ------ | ----------- |
|
137
|
+
| `--no-teardown` | Skip teardown of containers after the scenario completes |
|
138
|
+
| `--no-tests` | Orchestrates the docker containers but does not run the tests. Implies `--no-teardown` |
|
139
|
+
|
140
|
+
For example, the following command would start an EE GitLab Docker
|
141
|
+
container and would leave the instance running, but would not run the
|
142
|
+
tests:
|
143
|
+
|
144
|
+
```plaintext
|
145
|
+
$ gitlab-qa Test::Instance::Image EE --no-tests
|
146
|
+
```
|
147
|
+
|
148
|
+
GitLab QA will have automatically run the `docker ps` command to show
|
149
|
+
the port that container is running on, for example:
|
150
|
+
|
151
|
+
```plaintext
|
152
|
+
...
|
153
|
+
Skipping tests.
|
154
|
+
The orchestrated docker containers have not been removed.
|
155
|
+
Docker shell command: `docker ps`
|
156
|
+
CONTAINER ID IMAGE ... PORTS
|
157
|
+
fdeffd791b69 gitlab/gitlab-ee:nightly 22/tcp, 443/tcp, 0.0.0.0:32768->80/tcp
|
158
|
+
```
|
159
|
+
|
160
|
+
You could then run tests against that instance in a similar way to
|
161
|
+
[running tests against GDK](/docs/run_qa_against_gdk.md). This can be
|
162
|
+
useful if you want to run and debug a specific test, for example:
|
163
|
+
|
164
|
+
```plaintext
|
165
|
+
# From /path/to/gdk/gitlab/qa
|
166
|
+
$ bundle exec bin/qa Test::Instance::All http://localhost:32768 -- qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
|
167
|
+
```
|
168
|
+
|
169
|
+
### How to add new tests
|
170
|
+
|
171
|
+
Please see the [Beginner's guide to writing end-to-end tests](https://docs.gitlab.com/ee/development/testing_guide/end_to_end/beginners_guide.html).
|
172
|
+
|
173
|
+
Test cases and scripts to run them are located in the
|
174
|
+
[GitLab FOSS](https://gitlab.com/gitlab-org/gitlab-foss/tree/master/qa) and
|
175
|
+
[GitLab](https://gitlab.com/gitlab-org/gitlab/tree/master/qa)
|
129
176
|
repositories under the `qa/` directory, so please also check the documentation
|
130
177
|
there.
|
131
178
|
|
@@ -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
|
|
@@ -217,6 +240,25 @@ $ gitlab-qa Test::Integration::Geo EE
|
|
217
240
|
|
218
241
|
[test-geo]: https://gitlab.com/gitlab-org/gitlab-ee/blob/master/qa/qa/ee/scenario/test/geo.rb
|
219
242
|
|
243
|
+
### `Test::Integration::GitalyCluster CE|EE|<full image address>`
|
244
|
+
|
245
|
+
This tests [Gitaly Cluster](https://docs.gitlab.com/ee/administration/gitaly/praefect.html),
|
246
|
+
a clustered configuration of the Gitaly repository storage service.
|
247
|
+
|
248
|
+
The scenario configures and starts several docker containers to
|
249
|
+
represent the [recommended minimum configuration](https://docs.gitlab.com/ee/administration/gitaly/praefect.html#requirements-for-configuring-a-gitaly-cluster)
|
250
|
+
of a Gitaly Cluster.
|
251
|
+
|
252
|
+
To run tests against the GitLab container, a GitLab QA (`gitlab/gitlab-qa`)
|
253
|
+
container is spun up and tests are run from it by running the
|
254
|
+
`Test::Instance::All` scenario with the `:gitaly_cluster` tag.
|
255
|
+
|
256
|
+
Example:
|
257
|
+
|
258
|
+
```
|
259
|
+
$ gitlab-qa Test::Integration::GitalyCluster EE
|
260
|
+
```
|
261
|
+
|
220
262
|
### `Test::Integration::LDAPNoTLS CE|EE|<full image address>`
|
221
263
|
|
222
264
|
This tests that a GitLab instance works as expected with an external
|
@@ -545,7 +587,7 @@ in the GitLab CE project).
|
|
545
587
|
|
546
588
|
- `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
|
547
589
|
`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.
|
590
|
+
This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
|
549
591
|
If the variable isn't present, the QA image from Docker Hub will be used.
|
550
592
|
This can be found in the shared 1Password vault.
|
551
593
|
|
@@ -560,6 +602,41 @@ $ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
|
560
602
|
$ gitlab-qa Test::Instance::Staging
|
561
603
|
```
|
562
604
|
|
605
|
+
### `Test::Instance::StagingGeo`
|
606
|
+
|
607
|
+
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.
|
608
|
+
|
609
|
+
**Required user properties:**
|
610
|
+
|
611
|
+
- 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.
|
612
|
+
|
613
|
+
- Some Geo tests require the user to have Admin access level (for example, the Geo Nodes API tests)
|
614
|
+
|
615
|
+
**Required environment variables:**
|
616
|
+
|
617
|
+
- `GITLAB_QA_ACCESS_TOKEN`: A valid personal access token with the `api` scope.
|
618
|
+
This is used to retrieve the version that staging is currently running.
|
619
|
+
This can be found in the shared 1Password vault.
|
620
|
+
|
621
|
+
**Optional environment variables:**
|
622
|
+
|
623
|
+
- `GITLAB_QA_DEV_ACCESS_TOKEN`: A valid personal access token for the
|
624
|
+
`gitlab-qa-bot` on `dev.gitlab.org` with the `registry` scope.
|
625
|
+
This is used to pull the QA Docker image from the Omnibus GitLab `dev` Container Registry.
|
626
|
+
If the variable isn't present, the QA image from Docker Hub will be used.
|
627
|
+
This can be found in the shared 1Password vault.
|
628
|
+
|
629
|
+
Example:
|
630
|
+
|
631
|
+
```
|
632
|
+
$ export GITLAB_QA_ACCESS_TOKEN=your_api_access_token
|
633
|
+
$ export GITLAB_QA_DEV_ACCESS_TOKEN=your_dev_registry_access_token
|
634
|
+
$ export GITLAB_USERNAME="gitlab-qa"
|
635
|
+
$ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
636
|
+
|
637
|
+
$ gitlab-qa Test::Instance::StagingGeo
|
638
|
+
```
|
639
|
+
|
563
640
|
### `Test::Instance::Production`
|
564
641
|
|
565
642
|
This scenario functions the same as `Test::Instance::Staging`
|
@@ -633,6 +710,25 @@ $ export EE_LICENSE=$(cat /path/to/gitlab_license)
|
|
633
710
|
$ gitlab-qa Test::Instance::Airgapped EE -- --tag smoke
|
634
711
|
```
|
635
712
|
|
713
|
+
### `Test::Instance::Geo EE|<full image address>:nightly|latest|any_tag http://geo-primary.gitlab http://geo-secondary.gitlab`
|
714
|
+
|
715
|
+
This scenario will run tests tagged `:geo` against a live Geo deployment, by spinning up a GitLab QA (`gitlab/gitlab-qa`)
|
716
|
+
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.
|
717
|
+
|
718
|
+
**Required user properties:**
|
719
|
+
|
720
|
+
- 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.
|
721
|
+
|
722
|
+
- Some Geo tests require the user to have Admin access level (for example, the Geo Nodes API tests)
|
723
|
+
|
724
|
+
Example:
|
725
|
+
|
726
|
+
```
|
727
|
+
$ export GITLAB_USERNAME="gitlab-qa"
|
728
|
+
$ export GITLAB_PASSWORD="$GITLAB_QA_PASSWORD"
|
729
|
+
|
730
|
+
$ gitlab-qa Test::Instance::Geo EE https://primary.gitlab.com https://secondary.gitlab.com
|
731
|
+
```
|
636
732
|
----
|
637
733
|
|
638
734
|
[Back to README.md](../README.md)
|
data/lib/gitlab/qa.rb
CHANGED
@@ -54,7 +54,7 @@ module Gitlab
|
|
54
54
|
autoload :Praefect, 'gitlab/qa/scenario/test/integration/praefect'
|
55
55
|
autoload :Elasticsearch, 'gitlab/qa/scenario/test/integration/elasticsearch'
|
56
56
|
autoload :SMTP, 'gitlab/qa/scenario/test/integration/smtp'
|
57
|
-
autoload :
|
57
|
+
autoload :GitalyCluster, 'gitlab/qa/scenario/test/integration/gitaly_cluster'
|
58
58
|
autoload :Jira, 'gitlab/qa/scenario/test/integration/jira'
|
59
59
|
end
|
60
60
|
|
@@ -97,9 +97,12 @@ module Gitlab
|
|
97
97
|
end
|
98
98
|
|
99
99
|
module Report
|
100
|
+
autoload :JsonTestResults, 'gitlab/qa/report/json_test_results'
|
101
|
+
autoload :JUnitTestResults, 'gitlab/qa/report/junit_test_results'
|
100
102
|
autoload :PrepareStageReports, 'gitlab/qa/report/prepare_stage_reports'
|
101
103
|
autoload :ResultsInIssues, 'gitlab/qa/report/results_in_issues'
|
102
104
|
autoload :SummaryTable, 'gitlab/qa/report/summary_table'
|
105
|
+
autoload :TestResult, 'gitlab/qa/report/test_result'
|
103
106
|
autoload :UpdateScreenshotPath, 'gitlab/qa/report/update_screenshot_path'
|
104
107
|
end
|
105
108
|
|
@@ -41,16 +41,12 @@ module Gitlab
|
|
41
41
|
raise NotImplementedError, "#{self.class.name} must specify a docker image tag as DOCKER_IMAGE_TAG"
|
42
42
|
end
|
43
43
|
|
44
|
-
def instance
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
wait_until_ready
|
49
|
-
process_exec_commands
|
50
|
-
|
51
|
-
yield self if block_given?
|
44
|
+
def instance(skip_teardown: false)
|
45
|
+
instance_no_teardown do
|
46
|
+
yield self if block_given?
|
47
|
+
end
|
52
48
|
ensure
|
53
|
-
teardown
|
49
|
+
teardown unless skip_teardown
|
54
50
|
end
|
55
51
|
|
56
52
|
alias_method :launch_and_teardown_instance, :instance
|
@@ -61,8 +57,6 @@ module Gitlab
|
|
61
57
|
end
|
62
58
|
|
63
59
|
def prepare_docker_image
|
64
|
-
return if Runtime::Env.skip_pull?
|
65
|
-
|
66
60
|
pull
|
67
61
|
end
|
68
62
|
|
@@ -106,6 +100,17 @@ module Gitlab
|
|
106
100
|
end
|
107
101
|
|
108
102
|
def teardown
|
103
|
+
unless teardown?
|
104
|
+
puts "The orchestrated docker containers have not been removed."
|
105
|
+
docker.ps
|
106
|
+
|
107
|
+
return
|
108
|
+
end
|
109
|
+
|
110
|
+
teardown!
|
111
|
+
end
|
112
|
+
|
113
|
+
def teardown!
|
109
114
|
assert_name!
|
110
115
|
|
111
116
|
return unless docker.running?(name)
|
@@ -115,6 +120,8 @@ module Gitlab
|
|
115
120
|
end
|
116
121
|
|
117
122
|
def pull
|
123
|
+
return if Runtime::Env.skip_pull?
|
124
|
+
|
118
125
|
docker.pull(image, tag)
|
119
126
|
end
|
120
127
|
|
@@ -129,6 +136,20 @@ module Gitlab
|
|
129
136
|
def assert_name!
|
130
137
|
raise 'Invalid instance name!' unless name
|
131
138
|
end
|
139
|
+
|
140
|
+
def instance_no_teardown
|
141
|
+
prepare
|
142
|
+
start
|
143
|
+
reconfigure
|
144
|
+
wait_until_ready
|
145
|
+
process_exec_commands
|
146
|
+
|
147
|
+
yield self if block_given?
|
148
|
+
end
|
149
|
+
|
150
|
+
def teardown?
|
151
|
+
!Runtime::Scenario.attributes.include?(:teardown) || Runtime::Scenario.teardown
|
152
|
+
end
|
132
153
|
end
|
133
154
|
end
|
134
155
|
end
|
@@ -17,6 +17,8 @@ module Gitlab
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def perform # rubocop:disable Metrics/AbcSize
|
20
|
+
return puts "Skipping tests." if skip_tests?
|
21
|
+
|
20
22
|
raise ArgumentError unless [suite, release].all?
|
21
23
|
|
22
24
|
@docker.login(**release.login_params) if release.login_params
|
@@ -25,23 +27,53 @@ module Gitlab
|
|
25
27
|
|
26
28
|
name = "#{release.project_name}-qa-#{SecureRandom.hex(4)}"
|
27
29
|
|
28
|
-
|
29
|
-
command << "-t --rm --net=#{network || 'bridge'}"
|
30
|
+
feature_flag_sets = []
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
34
38
|
|
35
|
-
|
36
|
-
|
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?
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
|
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'}"
|
41
46
|
|
42
|
-
|
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
|
57
|
+
|
58
|
+
command.name(name)
|
59
|
+
end
|
43
60
|
end
|
44
61
|
end
|
62
|
+
|
63
|
+
private
|
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
|
+
|
74
|
+
def skip_tests?
|
75
|
+
Runtime::Scenario.attributes.include?(:run_tests) && !Runtime::Scenario.run_tests
|
76
|
+
end
|
45
77
|
end
|
46
78
|
end
|
47
79
|
end
|