gitlab-qa 5.13.0 → 5.13.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/docs/what_tests_can_be_run.md +50 -54
  3. data/lib/gitlab/qa.rb +2 -0
  4. data/lib/gitlab/qa/component/base.rb +131 -0
  5. data/lib/gitlab/qa/component/elasticsearch.rb +5 -32
  6. data/lib/gitlab/qa/component/gitlab.rb +15 -77
  7. data/lib/gitlab/qa/component/internet_tunnel.rb +6 -29
  8. data/lib/gitlab/qa/component/jira.rb +5 -44
  9. data/lib/gitlab/qa/component/ldap.rb +8 -51
  10. data/lib/gitlab/qa/component/mail_hog.rb +5 -44
  11. data/lib/gitlab/qa/component/minio.rb +9 -34
  12. data/lib/gitlab/qa/component/postgresql.rb +4 -36
  13. data/lib/gitlab/qa/component/saml.rb +5 -54
  14. data/lib/gitlab/qa/component/specs.rb +1 -10
  15. data/lib/gitlab/qa/docker/engine.rb +8 -0
  16. data/lib/gitlab/qa/release.rb +25 -0
  17. data/lib/gitlab/qa/runtime/env.rb +25 -1
  18. data/lib/gitlab/qa/runtime/scenario.rb +36 -0
  19. data/lib/gitlab/qa/scenario/test/instance/any.rb +1 -1
  20. data/lib/gitlab/qa/scenario/test/instance/geo.rb +1 -1
  21. data/lib/gitlab/qa/scenario/test/instance/repository_storage.rb +1 -1
  22. data/lib/gitlab/qa/scenario/test/instance/smoke.rb +1 -1
  23. data/lib/gitlab/qa/scenario/test/integration/elasticsearch.rb +1 -1
  24. data/lib/gitlab/qa/scenario/test/integration/geo.rb +1 -1
  25. data/lib/gitlab/qa/scenario/test/integration/gitaly_ha.rb +5 -5
  26. data/lib/gitlab/qa/scenario/test/integration/jira.rb +1 -1
  27. data/lib/gitlab/qa/scenario/test/integration/packages.rb +1 -1
  28. data/lib/gitlab/qa/scenario/test/integration/praefect.rb +2 -2
  29. data/lib/gitlab/qa/scenario/test/integration/saml.rb +1 -1
  30. data/lib/gitlab/qa/scenario/test/integration/smtp.rb +1 -1
  31. data/lib/gitlab/qa/scenario/test/omnibus/update.rb +2 -2
  32. data/lib/gitlab/qa/scenario/test/omnibus/upgrade.rb +1 -1
  33. data/lib/gitlab/qa/scenario/test/sanity/version.rb +1 -1
  34. data/lib/gitlab/qa/version.rb +1 -1
  35. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94ac8993fb7c19d11ab0345971f2ca8ff00c65ab0e6f89bc59b368b8df04a676
4
- data.tar.gz: 484c627fd9f85f8ece3a4a2c2370053841caefbe629e72f25f3b2d39c4b9ba33
3
+ metadata.gz: 176ad29bc36b0c276fd9f0addab99fbc57b3cfc7cc4edec364921e7b2ed9d80a
4
+ data.tar.gz: 3cd4551211e72968b2403f58e3f0583f588cc3f4496e7da8fc31cd484e6ba013
5
5
  SHA512:
6
- metadata.gz: b4b35673cd80bdbfae8ba22a48d4949e367fdbecbf86355be5139b381e2b3ab85b3c5da6996acaac4b25a2044298a51766d20fb6337769bf4449dc3f9ddb6e77
7
- data.tar.gz: 89e28812ae5e2c4981af8b91bf736051affda188e6b785db94ea532ecbd7d26c977313e8fd861c34fbc3f4fdd3bfd5cb6bc6d84a77cc462ed623793e278cac5d
6
+ metadata.gz: 64f2a6f26ade53e538405d3f4f4a7d516205079add946969f2855a27a36e217b93dc6793b5bb2e1365edf0820518ed2e2510a46295903c44099b5fc8d829e652
7
+ data.tar.gz: f034880d5eee0b1f00b1ab9a60394203cfbd05d0d895f0a26b782f22baec0634880007be944a53a6aa565db908a064a04442041f02f7735fd4f7f83859f9c02d
@@ -28,60 +28,56 @@ For more details on the internals, please read the
28
28
 
29
29
  ## Supported GitLab environment variables
30
30
 
31
- * `GITLAB_USERNAME` - username to use when signing into GitLab
32
- * `GITLAB_PASSWORD` - password to use when signing into GitLab
33
- * `GITLAB_FORKER_USERNAME` - username to use for forking a project
34
- * `GITLAB_FORKER_PASSWORD` - password to use for forking a project
35
- * `GITLAB_QA_USERNAME_1` - username available in environments where signup is disabled
36
- * `GITLAB_QA_PASSWORD_1` - password for `GITLAB_QA_USERNAME_1` available in environments where signup is disabled (e.g. staging.gitlab.com)
37
- * `GITLAB_QA_USERNAME_2` - another username available in environments where signup is disabled
38
- * `GITLAB_QA_PASSWORD_2` - password for `GITLAB_QA_USERNAME_2` available in environments where signup is disabled (e.g. staging.gitlab.com)
39
- * `GITLAB_QA_USERNAME_3` - another username available in environments where signup is disabled
40
- * `GITLAB_QA_PASSWORD_3` - password for `GITLAB_QA_USERNAME_3` available in environments where signup is disabled (e.g. staging.gitlab.com)
41
- * `GITLAB_QA_USERNAME_4` - another username available in environments where signup is disabled
42
- * `GITLAB_QA_PASSWORD_4` - password for `GITLAB_QA_USERNAME_4` available in environments where signup is disabled (e.g. staging.gitlab.com)
43
- * `GITLAB_QA_USERNAME_5` - another username available in environments where signup is disabled
44
- * `GITLAB_QA_PASSWORD_5` - password for `GITLAB_QA_USERNAME_5` available in environments where signup is disabled (e.g. staging.gitlab.com)
45
- * `GITLAB_QA_USERNAME_6` - another username available in environments where signup is disabled
46
- * `GITLAB_QA_PASSWORD_6` - password for `GITLAB_QA_USERNAME_6` available in environments where signup is disabled (e.g. staging.gitlab.com)
47
- * `GITLAB_LDAP_USERNAME` - LDAP username to use when signing into GitLab
48
- * `GITLAB_LDAP_PASSWORD` - LDAP password to use when signing into GitLab
49
- * `GITLAB_ADMIN_USERNAME` - Admin username to use when adding a license
50
- * `GITLAB_ADMIN_PASSWORD` - Admin password to use when adding a license
51
- * `GITLAB_SANDBOX_NAME` - The sandbox group name the test suite is going to use (default: `gitlab-qa-sandbox`)
52
- * `GITLAB_QA_ACCESS_TOKEN` - A valid personal access token with the `api` scope.
53
- This is used for API access during tests, and is used in the
54
- [`Test::Instance::Staging`](#testinstancestaging) scenario to retrieve the
55
- version that staging is currently running. An existing token that is valid on
56
- staging can be found in the shared 1Password vault.
57
- * `GITLAB_QA_ADMIN_ACCESS_TOKEN` - A valid personal access token with the `api` scope
58
- from a user with admin access. Used for API access as an admin during tests.
59
- * `EE_LICENSE` - Enterprise Edition license
60
- * `QA_ARTIFACTS_DIR` - Path to a directory where artifacts (logs and screenshots)
61
- for failing tests will be saved (default: `/tmp/gitlab-qa`)
62
- * `DOCKER_HOST` - Docker host to run tests against (default: `http://localhost`)
63
- * `CHROME_HEADLESS` - when running locally, set to `false` to allow Chrome tests to be visible - watch your tests being run
64
- * `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
65
- * `QA_PRAEFECT_REPOSITORY_STORAGE` - the name of repository storage using Praefect.
66
- * `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"
67
- * `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.
68
- * `QA_LOG_PATH` - path to output debug logging to. If not set logging will be output to STDOUT
69
- * `QA_CAN_TEST_GIT_PROTOCOL_V2` - set to `false` to skip tests that require Git protocol v2 if your environment doesn't support it.
70
- * `QA_CAN_TEST_ADMIN_FEATURES` - set to `false` to skip tests that require admin access.
71
- * `QA_CAN_TEST_PRAEFECT` - set to `false` to skip tests that require Praefect to be running.
72
- * `QA_DISABLE_RSPEC_RETRY` - set to `true` to turn off retrying tests on failure.
73
- * `QA_SIMULATE_SLOW_CONNECTION` - set to `true` to configure Chrome's network settings to simulate a slow connection.
74
- * `QA_SLOW_CONNECTION_LATENCY_MS` - the additional latency (in ms) of the simulated slow connection (default 2000 ms).
75
- * `QA_SLOW_CONNECTION_THROUGHPUT_KBPS` - the maximum throughput (in kbps) of the simulated slow connection (default 32 kbps).
76
- * `QA_SKIP_PULL` - set to `true` to skip pulling docker images (e.g., to use one you built locally).
77
- * `GITHUB_USERNAME` - Username for authenticating with GitHub.
78
- * `GITHUB_PASSWORD` - Password for authenticating with GitHub.
79
- * `GITLAB_QA_LOOP_RUNNER_MINUTES` - Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute.
80
- * `CI_SERVER_PERSONAL_ACCESS_TOKEN` - Personal access token of the server that is running the CI pipeline. This is used for pulling CI_RUNNER information in certain tests.
81
- * `GEO_MAX_FILE_REPLICATION_TIME` - maximum time that a test will wait for a replicated file to appear on a Geo secondary node (default 120 seconds)
82
- * `GEO_MAX_DB_REPLICATION_TIME` - maximum time that a test will wait for database data to appear on a Geo secondary node (default 120 seconds)
83
- * `JIRA_ADMIN_USERNAME` - Username for authenticating with Jira server as admin.
84
- * `JIRA_ADMIN_PASSWORD` - Password for authenticating with Jira server as admin.
31
+ | Variable | Default | Description | Required |
32
+ |-----------------------|-----------|-----------------------|----------|
33
+ | `GITLAB_USERNAME` | `root` | Username to use when signing into GitLab. | Yes|
34
+ | `GITLAB_PASSWORD` | `5iveL!fe` | Password to use when signing into GitLab. | Yes|
35
+ | `GITLAB_FORKER_USERNAME`|- | Username to use for forking a project. | Yes|
36
+ | `GITLAB_FORKER_PASSWORD`|- | Password to use for forking a project. | Yes|
37
+ | `GITLAB_QA_USERNAME_1` |- | Username available in environments where signup is disabled. | No|
38
+ | `GITLAB_QA_PASSWORD_1` |- | Password for `GITLAB_QA_USERNAME_1` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
39
+ | `GITLAB_QA_USERNAME_2` |- | Another username available in environments where signup is disabled. | No|
40
+ | `GITLAB_QA_PASSWORD_2` |- | Password for `GITLAB_QA_USERNAME_2` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
41
+ | `GITLAB_QA_USERNAME_3` |- | Another username available in environments where signup is disabled. | No|
42
+ | `GITLAB_QA_PASSWORD_3` |- | Password for `GITLAB_QA_USERNAME_3` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
43
+ | `GITLAB_QA_USERNAME_4` |- | Another username available in environments where signup is disabled. | No|
44
+ | `GITLAB_QA_PASSWORD_4` |- | Password for `GITLAB_QA_USERNAME_4` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
45
+ | `GITLAB_QA_USERNAME_5` |- | Another username available in environments where signup is disabled. | No|
46
+ | `GITLAB_QA_PASSWORD_5` |- | Password for `GITLAB_QA_USERNAME_5` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
47
+ | `GITLAB_QA_USERNAME_6` |- | Another username available in environments where signup is disabled. | No|
48
+ | `GITLAB_QA_PASSWORD_6` |- | Password for `GITLAB_QA_USERNAME_6` available in environments where signup is disabled (e.g. staging.gitlab.com). | No|
49
+ | `GITLAB_LDAP_USERNAME` |- | LDAP username to use when signing into GitLab. | No|
50
+ | `GITLAB_LDAP_PASSWORD` |- | LDAP password to use when signing into GitLab. | No|
51
+ | `GITLAB_ADMIN_USERNAME` |- | Admin username to use when adding a license. | No|
52
+ | `GITLAB_ADMIN_PASSWORD` |- | Admin password to use when adding a license. | No|
53
+ | `GITLAB_SANDBOX_NAME` | `gitlab-qa-sandbox` | The sandbox group name the test suite is going to use. | No|
54
+ | `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
+ | `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
+ | `EE_LICESEN` |- | Enterprise Edition license. | No|
57
+ | `QA_ARTIFACTS_DIR` |`/tmp/gitlab-qa`| Path to a directory where artifacts (logs and screenshots) for failing tests will be saved. | No|
58
+ | `DOCKER_HOST` |`http://localhost`| Docker host to run tests against. | No|
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|
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
+ | `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
+ | `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` |- | 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` |- | Set to `false` to skip tests that require admin access. | No|
67
+ | `QA_CAN_TEST_PRAEFECT` |- | Set to `false` to skip tests that require Praefect to be running. | No|
68
+ | `QA_DISABLE_RSPEC_RETRY` |- | Set to `true` to turn off retrying tests on failure. | No|
69
+ | `QA_SIMULATE_SLOW_CONNECTION` |- | Set to `true` to configure Chrome's network settings to simulate a slow connection. | No|
70
+ | `QA_SLOW_CONNECTION_LATENCY_MS` | `2000` | The additional latency (in ms) of the simulated slow connection. | No|
71
+ | `QA_SLOW_CONNECTION_THROUGHPUT_KBPS` | `32` | The maximum throughput (in kbps) of the simulated slow connection. | No|
72
+ | `QA_SKIP_PULL` | `false` | Set to `true` to skip pulling docker images (e.g., to use one you built locally). | No|
73
+ | `GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
74
+ | `GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
75
+ | `GITLAB_QA_LOOP_RUNNER_MINUTES` | `1` | Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute. | No|
76
+ | `CI_SERVER_PERSONAL_ACCESS_TOKEN` |- | Personal access token of the server that is running the CI pipeline. This is used for pulling CI_RUNNER information in certain tests. | No|
77
+ | `GEO_MAX_FILE_REPLICATION_TIME` | `120` | Maximum time that a test will wait for a replicated file to appear on a Geo secondary node. | No|
78
+ | `GEO_MAX_DB_REPLICATION_TIME` | `120` | Maximum time that a test will wait for database data to appear on a Geo secondary node. | No|
79
+ | `JIRA_ADMIN_USERNAME` |- | Username for authenticating with Jira server as admin. | No|
80
+ | `JIRA_ADMIN_PASSWORD` |- | Password for authenticating with Jira server as admin. | No|
85
81
 
86
82
  ## [Supported Remote Grid environment variables](./running_against_remote_grid.md)
87
83
 
@@ -6,6 +6,7 @@ module Gitlab
6
6
 
7
7
  module Runtime
8
8
  autoload :Env, 'gitlab/qa/runtime/env'
9
+ autoload :Scenario, 'gitlab/qa/runtime/scenario'
9
10
  autoload :TokenFinder, 'gitlab/qa/runtime/token_finder'
10
11
  end
11
12
 
@@ -63,6 +64,7 @@ module Gitlab
63
64
  end
64
65
 
65
66
  module Component
67
+ autoload :Base, 'gitlab/qa/component/base'
66
68
  autoload :Gitlab, 'gitlab/qa/component/gitlab'
67
69
  autoload :InternetTunnel, 'gitlab/qa/component/internet_tunnel'
68
70
  autoload :LDAP, 'gitlab/qa/component/ldap'
@@ -0,0 +1,131 @@
1
+ module Gitlab
2
+ module QA
3
+ module Component
4
+ class Base
5
+ include Scenario::Actable
6
+
7
+ attr_reader :docker
8
+ attr_accessor :volumes, :network, :environment
9
+ attr_writer :name, :exec_commands
10
+
11
+ def initialize
12
+ @docker = Docker::Engine.new
13
+ @environment = {}
14
+ @volumes = {}
15
+ @network_aliases = []
16
+
17
+ self.exec_commands = []
18
+ end
19
+
20
+ def add_network_alias(name)
21
+ @network_aliases.push(name)
22
+ end
23
+
24
+ def name
25
+ raise NotImplementedError, "#{self.class.name} must specify a default name"
26
+ end
27
+
28
+ def hostname
29
+ "#{name}.#{network}"
30
+ end
31
+
32
+ def image
33
+ return self.class.const_get('DOCKER_IMAGE') if self.class.const_defined?('DOCKER_IMAGE')
34
+
35
+ raise NotImplementedError, "#{self.class.name} must specify a docker image as DOCKER_IMAGE"
36
+ end
37
+
38
+ def tag
39
+ return self.class.const_get('DOCKER_IMAGE_TAG') if self.class.const_defined?('DOCKER_IMAGE_TAG')
40
+
41
+ raise NotImplementedError, "#{self.class.name} must specify a docker image tag as DOCKER_IMAGE_TAG"
42
+ end
43
+
44
+ def instance
45
+ prepare
46
+ start
47
+ reconfigure
48
+ wait_until_ready
49
+ process_exec_commands
50
+
51
+ yield self if block_given?
52
+ ensure
53
+ teardown
54
+ end
55
+
56
+ alias_method :launch_and_teardown_instance, :instance
57
+
58
+ def prepare
59
+ prepare_docker_image
60
+ prepare_network
61
+ end
62
+
63
+ def prepare_docker_image
64
+ return if Runtime::Env.skip_pull?
65
+
66
+ pull
67
+ end
68
+
69
+ def prepare_network
70
+ return if docker.network_exists?(network)
71
+
72
+ docker.network_create(network)
73
+ end
74
+
75
+ def start # rubocop:disable Metrics/AbcSize
76
+ docker.run(image, tag) do |command|
77
+ command << "-d"
78
+ command << "--name #{name}"
79
+ command << "--net #{network}"
80
+ command << "--hostname #{hostname}"
81
+
82
+ @volumes.to_h.each do |to, from|
83
+ command.volume(to, from, 'Z')
84
+ end
85
+
86
+ command.volume(File.join(Runtime::Env.host_artifacts_dir, name, 'logs'), '/var/log/gitlab', 'Z')
87
+
88
+ @environment.to_h.each do |key, value|
89
+ command.env(key, value)
90
+ end
91
+
92
+ @network_aliases.to_a.each do |network_alias|
93
+ command << "--network-alias #{network_alias}"
94
+ end
95
+ end
96
+ end
97
+
98
+ def restart
99
+ assert_name!
100
+
101
+ docker.restart(name)
102
+ end
103
+
104
+ def teardown
105
+ assert_name!
106
+
107
+ return unless docker.running?(name)
108
+
109
+ docker.stop(name)
110
+ docker.remove(name)
111
+ end
112
+
113
+ def pull
114
+ docker.pull(image, tag)
115
+ end
116
+
117
+ def process_exec_commands
118
+ exec_commands.each { |command| docker.exec(name, command) }
119
+ end
120
+
121
+ private
122
+
123
+ attr_reader :exec_commands, :wait_until_ready, :reconfigure
124
+
125
+ def assert_name!
126
+ raise 'Invalid instance name!' unless name
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
@@ -1,41 +1,19 @@
1
1
  module Gitlab
2
2
  module QA
3
3
  module Component
4
- class Elasticsearch
5
- include Scenario::Actable
6
-
7
- ELASTIC_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'.freeze
8
-
9
- attr_reader :docker
10
- attr_accessor :environment, :network
11
- attr_writer :name
12
-
13
- def initialize
14
- @docker = Docker::Engine.new
15
- @environment = {}
16
- end
4
+ class Elasticsearch < Base
5
+ DOCKER_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'.freeze
17
6
 
18
7
  def name
19
8
  @name ||= "elastic68"
20
9
  end
21
10
 
22
- def instance
23
- prepare
24
- start
25
- yield self
26
- ensure
27
- teardown
28
- end
29
-
30
- def prepare
31
- @docker.pull(ELASTIC_IMAGE, Runtime::Env.elastic_version)
32
- return if @docker.network_exists?(network)
33
-
34
- @docker.network_create(network)
11
+ def tag
12
+ Runtime::Env.elastic_version
35
13
  end
36
14
 
37
15
  def start
38
- @docker.run(ELASTIC_IMAGE, Runtime::Env.elastic_version) do |command|
16
+ @docker.run(image, tag) do |command|
39
17
  command << "-d"
40
18
  command << "--name #{name}"
41
19
  command << "--net #{network}"
@@ -45,11 +23,6 @@ module Gitlab
45
23
  command.env("discovery.type", "single-node")
46
24
  end
47
25
  end
48
-
49
- def teardown
50
- @docker.stop(name)
51
- @docker.remove(name)
52
- end
53
26
  end
54
27
  end
55
28
  end
@@ -7,13 +7,12 @@ require 'openssl'
7
7
  module Gitlab
8
8
  module QA
9
9
  module Component
10
- class Gitlab
10
+ class Gitlab < Base
11
11
  extend Forwardable
12
- include Scenario::Actable
13
12
 
14
- attr_reader :release, :docker
15
- attr_accessor :volumes, :network, :environment, :tls, :disable_animations
16
- attr_writer :name, :relative_path, :exec_commands, :skip_check
13
+ attr_reader :release
14
+ attr_accessor :tls, :disable_animations, :skip_availability_check
15
+ attr_writer :name, :relative_path
17
16
 
18
17
  def_delegators :release, :tag, :image, :edition
19
18
 
@@ -21,17 +20,14 @@ module Gitlab
21
20
  SSL_PATH = '/etc/gitlab/ssl'.freeze
22
21
 
23
22
  def initialize
24
- @docker = Docker::Engine.new
25
- @environment = {}
26
- @volumes = {}
27
- @network_aliases = []
23
+ super
24
+
28
25
  @disable_animations = true
29
- @skip_check = false
26
+ @skip_availability_check = false
30
27
 
31
28
  @volumes[CERTIFICATES_PATH] = SSL_PATH
32
29
 
33
30
  self.release = 'CE'
34
- self.exec_commands = []
35
31
  end
36
32
 
37
33
  def omnibus_config=(config)
@@ -48,10 +44,6 @@ module Gitlab
48
44
  @environment['ELASTIC_URL'] = url
49
45
  end
50
46
 
51
- def add_network_alias(name)
52
- @network_aliases.push(name)
53
- end
54
-
55
47
  def release=(release)
56
48
  @release = QA::Release.new(release)
57
49
  end
@@ -72,10 +64,6 @@ module Gitlab
72
64
  tls ? '443' : '80'
73
65
  end
74
66
 
75
- def hostname
76
- "#{name}.#{network}"
77
- end
78
-
79
67
  def relative_path
80
68
  @relative_path ||= ''
81
69
  end
@@ -84,24 +72,16 @@ module Gitlab
84
72
  Runtime::Env.accept_insecure_certs = 'true'
85
73
  end
86
74
 
87
- def instance
88
- prepare
89
- start
90
- reconfigure
91
- wait unless @skip_check
92
- process_exec_commands
75
+ def prepare
76
+ prepare_gitlab_omnibus_config
93
77
 
94
- yield self if block_given?
95
- ensure
96
- teardown
78
+ super
97
79
  end
98
80
 
99
- alias_method :launch_and_teardown_instance, :instance
81
+ def pull
82
+ docker.login(**release.login_params) if release.login_params
100
83
 
101
- def prepare
102
- prepare_gitlab_omnibus_config
103
- prepare_docker_image
104
- prepare_network
84
+ super
105
85
  end
106
86
 
107
87
  def prepare_gitlab_omnibus_config
@@ -109,18 +89,6 @@ module Gitlab
109
89
  set_formless_login_token
110
90
  end
111
91
 
112
- def prepare_docker_image
113
- return if Runtime::Env.skip_pull?
114
-
115
- @docker.pull(image, tag)
116
- end
117
-
118
- def prepare_network
119
- return if @docker.network_exists?(network)
120
-
121
- @docker.network_create(network)
122
- end
123
-
124
92
  def setup_disable_animations
125
93
  @environment['GITLAB_OMNIBUS_CONFIG'] = "gitlab_rails['gitlab_disable_animations'] = true; #{@environment['GITLAB_OMNIBUS_CONFIG'] || ''}"
126
94
  end
@@ -128,17 +96,6 @@ module Gitlab
128
96
  def start # rubocop:disable Metrics/AbcSize
129
97
  ensure_configured!
130
98
 
131
- if release.dev_gitlab_org?
132
- Docker::Command.execute(
133
- [
134
- 'login',
135
- '--username gitlab-qa-bot',
136
- %(--password "#{Runtime::Env.dev_access_token_variable}"),
137
- Release::DEV_REGISTRY
138
- ]
139
- )
140
- end
141
-
142
99
  docker.run(image, tag) do |command|
143
100
  command << "-d -p #{port}"
144
101
  command << "--name #{name}"
@@ -170,18 +127,9 @@ module Gitlab
170
127
  end
171
128
  end
172
129
 
173
- def restart
174
- @docker.restart(name)
175
- end
176
-
177
- def teardown
178
- raise 'Invalid instance name!' unless name
179
-
180
- @docker.stop(name)
181
- @docker.remove(name)
182
- end
183
-
184
130
  def wait
131
+ return if skip_availability_check
132
+
185
133
  if Availability.new(name, relative_path: relative_path, scheme: scheme, protocol_port: port.to_i).check(180)
186
134
  sleep 12 # TODO, handle that better
187
135
  puts ' -> GitLab is available.'
@@ -190,10 +138,6 @@ module Gitlab
190
138
  end
191
139
  end
192
140
 
193
- def pull
194
- @docker.pull(@release.image, @release.tag)
195
- end
196
-
197
141
  def sha_version
198
142
  json = @docker.read_file(
199
143
  @release.image, @release.tag,
@@ -204,14 +148,8 @@ module Gitlab
204
148
  manifest['software']['gitlab-rails']['locked_version']
205
149
  end
206
150
 
207
- def process_exec_commands
208
- exec_commands.each { |command| @docker.exec(name, command) }
209
- end
210
-
211
151
  private
212
152
 
213
- attr_reader :exec_commands
214
-
215
153
  def ensure_configured!
216
154
  raise 'Please configure an instance first!' unless [name, release, network].all?
217
155
  end