gitlab-qa 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c1bc1540f6d6a9cb4fcd192bc71ac4e210801669e542f2961ee43fcd9b8f3a7
4
- data.tar.gz: 1251851bf8c854295292845d08bb099c0a9e5bc6122af0b024b43a6d2211ac5d
3
+ metadata.gz: 10ff9ce3afe8746024b84ea1bd1fe0f30ccc73f1368a27951e5d2034070cd128
4
+ data.tar.gz: f96e2c77228886b267c9166068f4df25536c6848a81fd9934e87ae83dbd88d47
5
5
  SHA512:
6
- metadata.gz: 65d6f5f1d170769d90454c3428ae4212acc98303e9d5c0c8aedf12f434d2abf9beb7d95db2cad9028c62607978d4643e25a7934ae9545d71c67013e3930f72c6
7
- data.tar.gz: bcc1d3661032661c3b0088478848825327526aea38ecf0dd451992ec52c2c528140bf7753d6d4303657c4bbc4334107d22bd7900065c0d14867c5186afc208cc
6
+ metadata.gz: 53ee15a5af7bd0f0f2f9940d9346cc1efab4175cde77c8c57cc70296294a2b687946dbb8c734841c5db5a44451c57e4ac78a380bf4265323f7cba04bcb9b3b64
7
+ data.tar.gz: 761875c4b3cbc395d60a7a576ed4d3bd92db37ad0791a4ebacb280793ed7790041494933d961b299e15cc74c9dad37764b7358c623b7ea07174118ff32658634
@@ -1,72 +1,73 @@
1
- $LOAD_PATH << File.expand_path(__dir__)
2
-
3
1
  module Gitlab
4
2
  module QA
5
- autoload :Release, 'qa/release'
6
- autoload :Runner, 'qa/runner'
3
+ autoload :Release, 'gitlab/qa/release'
4
+ autoload :Runner, 'gitlab/qa/runner'
7
5
 
8
6
  module Runtime
9
- autoload :Env, 'qa/runtime/env'
7
+ autoload :Env, 'gitlab/qa/runtime/env'
10
8
  end
11
9
 
12
10
  module Scenario
13
- autoload :Actable, 'qa/scenario/actable'
14
- autoload :Template, 'qa/scenario/template'
11
+ autoload :Actable, 'gitlab/qa/scenario/actable'
12
+ autoload :Template, 'gitlab/qa/scenario/template'
15
13
 
16
14
  module Test
17
15
  module Instance
18
- autoload :Any, 'qa/scenario/test/instance/any'
19
- autoload :Image, 'qa/scenario/test/instance/image'
20
- autoload :RelativeUrl, 'qa/scenario/test/instance/relative_url'
21
- autoload :Staging, 'qa/scenario/test/instance/staging'
22
- autoload :Production, 'qa/scenario/test/instance/production'
23
- autoload :Smoke, 'qa/scenario/test/instance/smoke'
24
- autoload :Preprod, 'qa/scenario/test/instance/preprod'
16
+ autoload :Any, 'gitlab/qa/scenario/test/instance/any'
17
+ autoload :DeploymentBase, 'gitlab/qa/scenario/test/instance/deployment_base'
18
+ autoload :Image, 'gitlab/qa/scenario/test/instance/image'
19
+ autoload :RelativeUrl, 'gitlab/qa/scenario/test/instance/relative_url'
20
+ autoload :Staging, 'gitlab/qa/scenario/test/instance/staging'
21
+ autoload :Production, 'gitlab/qa/scenario/test/instance/production'
22
+ autoload :Smoke, 'gitlab/qa/scenario/test/instance/smoke'
23
+ autoload :Preprod, 'gitlab/qa/scenario/test/instance/preprod'
25
24
  end
26
25
 
27
26
  module Omnibus
28
- autoload :Image, 'qa/scenario/test/omnibus/image'
29
- autoload :Update, 'qa/scenario/test/omnibus/update'
30
- autoload :Upgrade, 'qa/scenario/test/omnibus/upgrade'
27
+ autoload :Image, 'gitlab/qa/scenario/test/omnibus/image'
28
+ autoload :Update, 'gitlab/qa/scenario/test/omnibus/update'
29
+ autoload :Upgrade, 'gitlab/qa/scenario/test/omnibus/upgrade'
31
30
  end
32
31
 
33
32
  module Integration
34
- autoload :Geo, 'qa/scenario/test/integration/geo'
35
- autoload :LDAP, 'qa/scenario/test/integration/ldap'
36
- autoload :LDAPNoTLS, 'qa/scenario/test/integration/ldap_no_tls'
37
- autoload :LDAPTLS, 'qa/scenario/test/integration/ldap_tls'
38
- autoload :SAML, 'qa/scenario/test/integration/saml'
39
- autoload :GroupSAML, 'qa/scenario/test/integration/group_saml'
40
- autoload :InstanceSAML, 'qa/scenario/test/integration/instance_saml'
41
- autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
42
- autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes'
43
- autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage'
44
- autoload :OAuth, 'qa/scenario/test/integration/oauth'
33
+ autoload :Geo, 'gitlab/qa/scenario/test/integration/geo'
34
+ autoload :LDAP, 'gitlab/qa/scenario/test/integration/ldap'
35
+ autoload :LDAPNoTLS, 'gitlab/qa/scenario/test/integration/ldap_no_tls'
36
+ autoload :LDAPTLS, 'gitlab/qa/scenario/test/integration/ldap_tls'
37
+ autoload :SAML, 'gitlab/qa/scenario/test/integration/saml'
38
+ autoload :GroupSAML, 'gitlab/qa/scenario/test/integration/group_saml'
39
+ autoload :InstanceSAML, 'gitlab/qa/scenario/test/integration/instance_saml'
40
+ autoload :Mattermost, 'gitlab/qa/scenario/test/integration/mattermost'
41
+ autoload :Kubernetes, 'gitlab/qa/scenario/test/integration/kubernetes'
42
+ autoload :ObjectStorage, 'gitlab/qa/scenario/test/integration/object_storage'
43
+ autoload :OAuth, 'gitlab/qa/scenario/test/integration/oauth'
44
+ autoload :Elasticsearch, 'gitlab/qa/scenario/test/integration/elasticsearch'
45
45
  end
46
46
 
47
47
  module Sanity
48
- autoload :Version, 'qa/scenario/test/sanity/version'
48
+ autoload :Version, 'gitlab/qa/scenario/test/sanity/version'
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
53
  module Component
54
- autoload :Gitlab, 'qa/component/gitlab'
55
- autoload :InternetTunnel, 'qa/component/internet_tunnel'
56
- autoload :LDAP, 'qa/component/ldap'
57
- autoload :SAML, 'qa/component/saml'
58
- autoload :Specs, 'qa/component/specs'
59
- autoload :Staging, 'qa/component/staging'
60
- autoload :Production, 'qa/component/production'
61
- autoload :Minio, 'qa/component/minio'
62
- autoload :Preprod, 'qa/component/preprod'
54
+ autoload :Gitlab, 'gitlab/qa/component/gitlab'
55
+ autoload :InternetTunnel, 'gitlab/qa/component/internet_tunnel'
56
+ autoload :LDAP, 'gitlab/qa/component/ldap'
57
+ autoload :SAML, 'gitlab/qa/component/saml'
58
+ autoload :Specs, 'gitlab/qa/component/specs'
59
+ autoload :Staging, 'gitlab/qa/component/staging'
60
+ autoload :Production, 'gitlab/qa/component/production'
61
+ autoload :Minio, 'gitlab/qa/component/minio'
62
+ autoload :Preprod, 'gitlab/qa/component/preprod'
63
+ autoload :Elasticsearch, 'gitlab/qa/component/elasticsearch'
63
64
  end
64
65
 
65
66
  module Docker
66
- autoload :Command, 'qa/docker/command'
67
- autoload :Engine, 'qa/docker/engine'
68
- autoload :Shellout, 'qa/docker/shellout'
69
- autoload :Volumes, 'qa/docker/volumes'
67
+ autoload :Command, 'gitlab/qa/docker/command'
68
+ autoload :Engine, 'gitlab/qa/docker/engine'
69
+ autoload :Shellout, 'gitlab/qa/docker/shellout'
70
+ autoload :Volumes, 'gitlab/qa/docker/volumes'
70
71
  end
71
72
  end
72
73
  end
@@ -0,0 +1,57 @@
1
+ module Gitlab
2
+ module QA
3
+ module Component
4
+ class Elasticsearch
5
+ include Scenario::Actable
6
+
7
+ ELASTIC_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch'.freeze
8
+ ELASTIC_IMAGE_TAG = '5.6.12'.freeze
9
+
10
+ attr_reader :docker
11
+ attr_accessor :environment, :network
12
+ attr_writer :name
13
+
14
+ def initialize
15
+ @docker = Docker::Engine.new
16
+ @environment = {}
17
+ end
18
+
19
+ def name
20
+ @name ||= "elastic56"
21
+ end
22
+
23
+ def instance
24
+ prepare
25
+ start
26
+ yield self
27
+ ensure
28
+ teardown
29
+ end
30
+
31
+ def prepare
32
+ @docker.pull(ELASTIC_IMAGE, ELASTIC_IMAGE_TAG)
33
+ return if @docker.network_exists?(network)
34
+
35
+ @docker.network_create(network)
36
+ end
37
+
38
+ def start
39
+ @docker.run(ELASTIC_IMAGE, ELASTIC_IMAGE_TAG) do |command|
40
+ command << "-d"
41
+ command << "--name #{name}"
42
+ command << "--net #{network}"
43
+ command << "--publish 9200:9200"
44
+ command << "--publish 9300:9300"
45
+
46
+ command.env("discovery.type", "single-node")
47
+ end
48
+ end
49
+
50
+ def teardown
51
+ @docker.stop(name)
52
+ @docker.remove(name)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -8,10 +8,13 @@ module Gitlab
8
8
  class Staging
9
9
  ADDRESS = 'https://staging.gitlab.com'.freeze
10
10
  def self.release
11
- # Temporary fix so that the tests can run
11
+ # Auto-deploy builds have a tag formatted like 12.0.12345+5159f2949cb.59c9fa631
12
+ # but the version api returns a semver version like 12.0.1
13
+ # so images are tagged using minor and major semver components plus
14
+ # the EE commit ref, which is the 'revision' returned by the API
15
+ # and so the version used for the docker image tag is like 12.0-5159f2949cb
12
16
  # See: https://gitlab.com/gitlab-org/quality/staging/issues/56
13
- # version = Version.new(address).fetch!
14
- version = 'nightly'
17
+ version = Version.new(address).major_minor_revision
15
18
  image =
16
19
  if Runtime::Env.dev_access_token_variable
17
20
  "dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee:#{version}"
@@ -53,12 +56,20 @@ module Gitlab
53
56
 
54
57
  case response
55
58
  when Net::HTTPSuccess
56
- JSON.parse(response.body).fetch('version')
59
+ JSON.parse(response.body)
57
60
  else
58
61
  raise InvalidResponseError.new(@uri.to_s, response)
59
62
  end
60
63
  end
61
64
 
65
+ def major_minor_revision
66
+ api_response = fetch!
67
+ version_regexp = /^v?(?<major>\d+)\.(?<minor>\d+)\.\d+/
68
+ match = version_regexp.match(api_response.fetch('version'))
69
+
70
+ "#{match[:major]}.#{match[:minor]}-#{api_response.fetch('revision')}"
71
+ end
72
+
62
73
  private
63
74
 
64
75
  def request
@@ -7,8 +7,9 @@ module Gitlab
7
7
  # They're included here so that gitlab-qa treats them as valid options
8
8
  PASS_THROUGH_OPTS = [
9
9
  ['--address URL', 'Address of the instance to test'],
10
+ ['--enable-feature FEATURE_FLAG', 'Enable a feature before running tests'],
10
11
  ['--mattermost-address URL', 'Address of the Mattermost server'],
11
- ['--enable-feature FEATURE_FLAG', 'Enable a feature before running tests']
12
+ ['--parallel', 'Execute tests in parallel']
12
13
  ].freeze
13
14
 
14
15
  # rubocop:disable Metrics/AbcSize
@@ -0,0 +1,49 @@
1
+ module Gitlab
2
+ module QA
3
+ module Scenario
4
+ module Test
5
+ module Instance
6
+ ##
7
+ # Base class to be used to define deployment environment scenarios
8
+ #
9
+ class DeploymentBase < Scenario::Template
10
+ def perform(release_name = nil, *rspec_args)
11
+ Runtime::Env.require_no_license!
12
+
13
+ release_name ||= '--'
14
+
15
+ case release_name
16
+ when '--'
17
+ rspec_args.unshift('--')
18
+ release = deployment_component.release
19
+ else
20
+ release = Release.new(release_name)
21
+ end
22
+
23
+ if release.dev_gitlab_org?
24
+ Docker::Command.execute(
25
+ [
26
+ 'login',
27
+ '--username gitlab-qa-bot',
28
+ %(--password "#{Runtime::Env.dev_access_token_variable}"),
29
+ Release::DEV_REGISTRY
30
+ ]
31
+ )
32
+ end
33
+
34
+ Component::Specs.perform do |specs|
35
+ specs.suite = 'Test::Instance::All'
36
+ specs.release = release
37
+ specs.args = [deployment_component::ADDRESS, *rspec_args]
38
+ end
39
+ end
40
+
41
+ def deployment_component
42
+ raise NotImplementedError, 'Please define the Component for the deployment environment associated with this scenario.'
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -6,28 +6,9 @@ module Gitlab
6
6
  ##
7
7
  # Run test suite against pre.gitlab.com
8
8
  #
9
- class Preprod < Scenario::Template
10
- def perform(*rspec_args)
11
- Runtime::Env.require_no_license!
12
-
13
- release = Component::Preprod.release
14
-
15
- if release.dev_gitlab_org?
16
- Docker::Command.execute(
17
- [
18
- 'login',
19
- '--username gitlab-qa-bot',
20
- %(--password "#{Runtime::Env.dev_access_token_variable}"),
21
- Release::DEV_REGISTRY
22
- ]
23
- )
24
- end
25
-
26
- Component::Specs.perform do |specs|
27
- specs.suite = 'Test::Instance::All'
28
- specs.release = release
29
- specs.args = [Component::Preprod::ADDRESS, *rspec_args]
30
- end
9
+ class Preprod < DeploymentBase
10
+ def deployment_component
11
+ Component::Preprod
31
12
  end
32
13
  end
33
14
  end
@@ -6,28 +6,9 @@ module Gitlab
6
6
  ##
7
7
  # Run test suite against gitlab.com
8
8
  #
9
- class Production < Scenario::Template
10
- def perform(*rspec_args)
11
- Runtime::Env.require_no_license!
12
-
13
- release = Component::Production.release
14
-
15
- if release.dev_gitlab_org?
16
- Docker::Command.execute(
17
- [
18
- 'login',
19
- '--username gitlab-qa-bot',
20
- %(--password "#{Runtime::Env.dev_access_token_variable}"),
21
- Release::DEV_REGISTRY
22
- ]
23
- )
24
- end
25
-
26
- Component::Specs.perform do |specs|
27
- specs.suite = 'Test::Instance::All'
28
- specs.release = release
29
- specs.args = [Component::Production::ADDRESS, *rspec_args]
30
- end
9
+ class Production < DeploymentBase
10
+ def deployment_component
11
+ Component::Production
31
12
  end
32
13
  end
33
14
  end
@@ -6,28 +6,9 @@ module Gitlab
6
6
  ##
7
7
  # Run test suite against staging.gitlab.com
8
8
  #
9
- class Staging < Scenario::Template
10
- def perform(*rspec_args)
11
- Runtime::Env.require_no_license!
12
-
13
- release = Component::Staging.release
14
-
15
- if release.dev_gitlab_org?
16
- Docker::Command.execute(
17
- [
18
- 'login',
19
- '--username gitlab-qa-bot',
20
- %(--password "#{Runtime::Env.dev_access_token_variable}"),
21
- Release::DEV_REGISTRY
22
- ]
23
- )
24
- end
25
-
26
- Component::Specs.perform do |specs|
27
- specs.suite = 'Test::Instance::All'
28
- specs.release = release
29
- specs.args = [Component::Staging::ADDRESS, *rspec_args]
30
- end
9
+ class Staging < DeploymentBase
10
+ def deployment_component
11
+ Component::Staging
31
12
  end
32
13
  end
33
14
  end
@@ -0,0 +1,48 @@
1
+ module Gitlab
2
+ module QA
3
+ module Scenario
4
+ module Test
5
+ module Integration
6
+ class Elasticsearch < Scenario::Template
7
+ attr_reader :gitlab_name, :spec_suite
8
+
9
+ def initialize
10
+ @gitlab_name = 'gitlab-elastic'
11
+ @spec_suite = 'Test::Integration::Elasticsearch'
12
+ end
13
+
14
+ def before_perform(release)
15
+ raise ArgumentError, 'Elasticsearch is an EE only feature!' unless release.ee?
16
+ end
17
+
18
+ def perform(release, *rspec_args)
19
+ release = Release.new(release)
20
+ before_perform(release)
21
+
22
+ Component::Gitlab.perform do |gitlab|
23
+ gitlab.release = release
24
+ gitlab.name = gitlab_name
25
+ gitlab.network = 'test'
26
+
27
+ Component::Elasticsearch.perform do |elastic|
28
+ elastic.instance do
29
+ gitlab.instance do
30
+ puts "Running #{spec_suite} specs!"
31
+
32
+ Component::Specs.perform do |specs|
33
+ specs.suite = spec_suite
34
+ specs.release = gitlab.release
35
+ specs.network = gitlab.network
36
+ specs.args = [gitlab.address, *rspec_args]
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '3.3.0'.freeze
3
+ VERSION = '4.0.0'.freeze
4
4
  end
5
5
  end
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: 3.3.0
4
+ version: 4.0.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: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -148,6 +148,7 @@ files:
148
148
  - fixtures/ldap/tanuki.ldif
149
149
  - gitlab-qa.gemspec
150
150
  - lib/gitlab/qa.rb
151
+ - lib/gitlab/qa/component/elasticsearch.rb
151
152
  - lib/gitlab/qa/component/gitlab.rb
152
153
  - lib/gitlab/qa/component/internet_tunnel.rb
153
154
  - lib/gitlab/qa/component/ldap.rb
@@ -167,12 +168,14 @@ files:
167
168
  - lib/gitlab/qa/scenario/actable.rb
168
169
  - lib/gitlab/qa/scenario/template.rb
169
170
  - lib/gitlab/qa/scenario/test/instance/any.rb
171
+ - lib/gitlab/qa/scenario/test/instance/deployment_base.rb
170
172
  - lib/gitlab/qa/scenario/test/instance/image.rb
171
173
  - lib/gitlab/qa/scenario/test/instance/preprod.rb
172
174
  - lib/gitlab/qa/scenario/test/instance/production.rb
173
175
  - lib/gitlab/qa/scenario/test/instance/relative_url.rb
174
176
  - lib/gitlab/qa/scenario/test/instance/smoke.rb
175
177
  - lib/gitlab/qa/scenario/test/instance/staging.rb
178
+ - lib/gitlab/qa/scenario/test/integration/elasticsearch.rb
176
179
  - lib/gitlab/qa/scenario/test/integration/geo.rb
177
180
  - lib/gitlab/qa/scenario/test/integration/group_saml.rb
178
181
  - lib/gitlab/qa/scenario/test/integration/instance_saml.rb