gitlab-qa 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 32ba2e013021db66a5aa650661b9b84853494bb4
4
- data.tar.gz: e46916c8c07a846e132713918c7cb27aaf0688dc
3
+ metadata.gz: 1c2b6de72f64ffc8c5b1400cb9a96ddf6734ca74
4
+ data.tar.gz: da79c5ba4b2e2c6b2113213fce6ea51810979508
5
5
  SHA512:
6
- metadata.gz: c5c3a6a1b4eeffd67ef375c288217e2501371ae8c36f5bba98902f16e02893b5befc1b94fea238b34e2aeefd94411198c10481202df78c2cb7fd3f4a66365e8e
7
- data.tar.gz: 69d51e22a352ed08f05ca2bd99adcc3ec59ccc3b32fde0c5cddd22f9b29ab19cf6ebe88d8eaea69bed34a02a420efbc5c98bc79c6b04fe7b2449b6eb557f3419
6
+ metadata.gz: 8aa3ad66f489c2c4996e4dba9f937b6fef4fceced5ae2b4b2f2f9d25c5ff2b8d48d3ecf71ead553ded3e1efe8e7a632cbbf28063f5338b830e08e117d61c1572
7
+ data.tar.gz: 463dbd089d21e6b49627b40b7cbbe04ecbd6f961e6605f90ef2ab0cc2066eb79118f4efee447ac627de3187f3e772a8f07fe4f23713f1cf09f4fb09f4e57bfc8
@@ -11,6 +11,7 @@ variables:
11
11
  DOCKER_DRIVER: overlay
12
12
  DOCKER_HOST: tcp://docker:2375
13
13
  QA_SCREENSHOTS_DIR: $CI_PROJECT_DIR/screenshots
14
+ QA_LOGS_DIR: $CI_PROJECT_DIR/logs
14
15
 
15
16
  before_script:
16
17
  - bundle install
@@ -61,43 +62,47 @@ ee:version:
61
62
  expire_in: 30d
62
63
  paths:
63
64
  - screenshots/*.png
65
+ - logs/*.log
64
66
 
65
67
  ce:instance:
66
- script: bin/qa Test::Instance::Image CE
68
+ script: bin/qa Test::Instance::Image ${RELEASE:=CE}
67
69
  <<: *test
68
70
 
69
71
  ee:instance:
70
- script: bin/qa Test::Instance::Image EE
72
+ script: bin/qa Test::Instance::Image ${RELEASE:=EE}
71
73
  <<: *test
72
74
 
73
75
  ce:image:
74
- script: bin/qa Test::Omnibus::Image CE
76
+ script: bin/qa Test::Omnibus::Image ${RELEASE:=CE}
75
77
  <<: *test
76
78
 
77
79
  ee:image:
78
- script: bin/qa Test::Omnibus::Image EE
80
+ script: bin/qa Test::Omnibus::Image ${RELEASE:=EE}
79
81
  <<: *test
80
82
 
81
- ce:upgrade:
82
- script: bin/qa Test::Omnibus::Upgrade CE
83
+ ce:update:
84
+ script: bin/qa Test::Omnibus::Update ${RELEASE:=CE}
83
85
  <<: *test
84
86
 
85
- ee:upgrade:
86
- script: bin/qa Test::Omnibus::Upgrade EE
87
+ ee:update:
88
+ script: bin/qa Test::Omnibus::Update ${RELEASE:=EE}
89
+ <<: *test
90
+
91
+ ce:upgrade:
92
+ script: bin/qa Test::Omnibus::Upgrade
87
93
  <<: *test
88
94
 
89
95
  ce:mattermost:
90
- script: bin/qa Test::Integration::Mattermost CE
96
+ script: bin/qa Test::Integration::Mattermost ${RELEASE:=CE}
91
97
  <<: *test
92
98
 
93
99
  ee:mattermost:
94
- script: bin/qa Test::Integration::Mattermost EE
100
+ script: bin/qa Test::Integration::Mattermost ${RELEASE:=EE}
95
101
  <<: *test
96
102
 
97
103
  ee:geo:
98
- script: bin/qa Test::Integration::Geo EE
104
+ script: bin/qa Test::Integration::Geo ${RELEASE:=EE}
99
105
  <<: *test
100
- allow_failure: true
101
106
  tags:
102
107
  - docker
103
108
  - 7gb
data/README.md CHANGED
@@ -33,9 +33,13 @@ command in your system.
33
33
 
34
34
  `gitlab-qa Test::Integration::Mattermost CE|EE|<full image address>`
35
35
 
36
- 1. Test upgrade process:
36
+ 1. Test update process between two CE or EE subsequent versions:
37
37
 
38
- `gitlab-qa Test::Omnibus::Upgrade CE|EE|<full image address>`
38
+ `gitlab-qa Test::Omnibus::Update CE|EE|<full image address>`
39
+
40
+ 1. Test upgrade process from CE to EE:
41
+
42
+ `gitlab-qa Test::Omnibus::Upgrade CE|<full CE image address>`
39
43
 
40
44
  1. Run tests against any existing instance:
41
45
 
@@ -93,7 +97,9 @@ tests against it (see `Test::Instance::Image` above).
93
97
  * `GITLAB_PASSWORD` - password to use when signing in to GitLab
94
98
  * `EE_LICENSE` - Enterprise Edition license
95
99
  * `QA_SCREENSHOTS_DIR` - Path to a directory where screenshots for failing tests
96
- will be saved (default: `/tmp/gitlab-qa-screenshots`)
100
+ will be saved (default: `/tmp/gitlab-qa/screenshots`)
101
+ * `QA_LOGS_DIR` - Path to a directory where logs will be saved (default:
102
+ `/tmp/gitlab-qa/logs`)
97
103
  * `DOCKER_HOST` - Docker host to run tests against (default: `http://localhost`)
98
104
 
99
105
  ## Contributing
@@ -0,0 +1,4 @@
1
+ # GitLab QA Documentation
2
+
3
+ - [Architecture](architecture.md)
4
+ - [Trainings](trainings.md)
@@ -0,0 +1,8 @@
1
+ # GitLab QA trainings
2
+
3
+ ## Build team training on GitLab QA
4
+
5
+ A great introduction to the GitLab QA project, its internal structure, how it's
6
+ used, and how to start contributing to it. Check out the
7
+ [video](https://youtu.be/Ym159ATYN_g) and
8
+ [slides](https://docs.google.com/presentation/d/1-3YlYTIBzd2kSjGVYGPq1xqz4O7qtfABhoZRi_PcGRg/edit?usp=sharing).
@@ -20,6 +20,7 @@ module Gitlab
20
20
 
21
21
  module Omnibus
22
22
  autoload :Image, 'qa/scenario/test/omnibus/image'
23
+ autoload :Update, 'qa/scenario/test/omnibus/update'
23
24
  autoload :Upgrade, 'qa/scenario/test/omnibus/upgrade'
24
25
  end
25
26
 
@@ -43,6 +44,7 @@ module Gitlab
43
44
  autoload :Engine, 'qa/docker/engine'
44
45
  autoload :Command, 'qa/docker/command'
45
46
  autoload :Shellout, 'qa/docker/shellout'
47
+ autoload :Volumes, 'qa/docker/volumes'
46
48
  end
47
49
  end
48
50
  end
@@ -6,8 +6,6 @@ module Gitlab
6
6
  # the `qa/` directory located in GitLab CE / EE repositories.
7
7
  #
8
8
  class Specs < Scenario::Template
9
- IMAGE = 'gitlab/gitlab-qa'.freeze
10
-
11
9
  attr_accessor :suite, :release, :network, :args
12
10
 
13
11
  def initialize
@@ -19,7 +17,7 @@ module Gitlab
19
17
 
20
18
  puts "Running test suite `#{suite}` for #{release.project_name}"
21
19
 
22
- @docker.run(IMAGE, release.edition_tag, suite, *args) do |command|
20
+ @docker.run(release.qa_image, release.tag, suite, *args) do |command|
23
21
  command << "-t --rm --net=#{network || 'bridge'}"
24
22
 
25
23
  Runtime::Env.delegated.each do |env|
@@ -27,6 +25,7 @@ module Gitlab
27
25
  end
28
26
 
29
27
  command.volume('/var/run/docker.sock', '/var/run/docker.sock')
28
+ command.volume(Runtime::Env.logs_dir, '/var/log/gitlab')
30
29
  command.volume(Runtime::Env.screenshots_dir, '/home/qa/tmp')
31
30
  command.name("gitlab-specs-#{Time.now.to_i}")
32
31
  end
@@ -0,0 +1,26 @@
1
+ require 'tmpdir'
2
+
3
+ module Gitlab
4
+ module QA
5
+ module Docker
6
+ class Volumes
7
+ VOLUMES = { 'config' => '/etc/gitlab',
8
+ 'logs' => '/var/log/gitlab',
9
+ 'data' => '/var/opt/gitlab' }.freeze
10
+
11
+ def initialize(volumes = VOLUMES)
12
+ @volumes = volumes
13
+ end
14
+
15
+ def with_temporary_volumes
16
+ # macOS's tmpdir is a symlink /var/folders -> /private/var/folders
17
+ # but Docker on macOS exposes /private and disallow exposing /var/
18
+ # so we need to get the real tmpdir path
19
+ Dir.mktmpdir('gitlab-qa-', File.realpath(Dir.tmpdir)).tap do |dir|
20
+ yield Hash[@volumes.map { |k, v| ["#{dir}/#{k}", v] }]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -3,7 +3,8 @@ module Gitlab
3
3
  class Release
4
4
  CANONICAL_REGEX = /\A(?<edition>ce|ee):?(?<tag>.+)?/i
5
5
  CUSTOM_GITLAB_IMAGE_REGEX = %r{/gitlab-(?<edition>[ce]e):(?<tag>.+)\z}
6
- DEFAULT_TAG = 'nightly'.freeze
6
+ DEFAULT_TAG = 'latest'.freeze
7
+ DEFAULT_CANONICAL_TAG = 'nightly'.freeze
7
8
 
8
9
  attr_reader :release
9
10
  attr_writer :tag
@@ -31,6 +32,16 @@ module Gitlab
31
32
  end
32
33
  end
33
34
 
35
+ def ee?
36
+ edition == :ee
37
+ end
38
+
39
+ def to_ee
40
+ return self if ee?
41
+
42
+ self.class.new(to_s.sub('ce:', 'ee:'))
43
+ end
44
+
34
45
  def image
35
46
  @image ||=
36
47
  if canonical?
@@ -40,6 +51,10 @@ module Gitlab
40
51
  end
41
52
  end
42
53
 
54
+ def qa_image
55
+ "#{image}-qa"
56
+ end
57
+
43
58
  def project_name
44
59
  @project_name ||= image.sub(%r{^gitlab\/}, '')
45
60
  end
@@ -47,9 +62,9 @@ module Gitlab
47
62
  def tag
48
63
  @tag ||=
49
64
  if canonical?
50
- release.match(CANONICAL_REGEX)[:tag] || DEFAULT_TAG
65
+ release.match(CANONICAL_REGEX)[:tag] || DEFAULT_CANONICAL_TAG
51
66
  else
52
- release.match(CUSTOM_GITLAB_IMAGE_REGEX)[:tag]
67
+ release.match(CUSTOM_GITLAB_IMAGE_REGEX)&.[](:tag) || DEFAULT_TAG
53
68
  end
54
69
  end
55
70
 
@@ -10,7 +10,11 @@ module Gitlab
10
10
  EE_LICENSE].freeze
11
11
 
12
12
  def screenshots_dir
13
- ENV['QA_SCREENSHOTS_DIR'] || '/tmp/gitlab-qa-screenshots'
13
+ ENV['QA_SCREENSHOTS_DIR'] || '/tmp/gitlab-qa/screenshots'
14
+ end
15
+
16
+ def logs_dir
17
+ ENV['QA_LOGS_DIR'] || '/tmp/gitlab-qa/logs'
14
18
  end
15
19
 
16
20
  def delegated
@@ -11,9 +11,7 @@ module Gitlab
11
11
  def perform(release)
12
12
  release = Release.new(release)
13
13
 
14
- unless release.edition == :ee
15
- raise ArgumentError, 'Geo is EE only!'
16
- end
14
+ raise ArgumentError, 'Geo is EE only!' unless release.ee?
17
15
 
18
16
  Component::Gitlab.perform do |primary|
19
17
  primary.release = release
@@ -0,0 +1,30 @@
1
+ require 'tmpdir'
2
+ require 'fileutils'
3
+
4
+ module Gitlab
5
+ module QA
6
+ module Scenario
7
+ module Test
8
+ module Omnibus
9
+ class Update < Scenario::Template
10
+ def perform(next_release)
11
+ next_release = Release.new(next_release)
12
+
13
+ Docker::Volumes.new.with_temporary_volumes do |volumes|
14
+ Scenario::Test::Instance::Image
15
+ .perform(next_release.previous_stable) do |scenario|
16
+ scenario.volumes = volumes
17
+ end
18
+
19
+ Scenario::Test::Instance::Image
20
+ .perform(next_release) do |scenario|
21
+ scenario.volumes = volumes
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -7,31 +7,25 @@ module Gitlab
7
7
  module Test
8
8
  module Omnibus
9
9
  class Upgrade < Scenario::Template
10
- VOLUMES = { 'config' => '/etc/gitlab',
11
- 'logs' => '/var/log/gitlab',
12
- 'data' => '/var/opt/gitlab' }.freeze
10
+ def perform(image = 'CE')
11
+ ce_release = Release.new(image)
13
12
 
14
- def perform(next_release)
15
- next_release = Release.new(next_release)
13
+ if ce_release.ee?
14
+ raise ArgumentError, 'Only CE can be upgraded to EE!'
15
+ end
16
16
 
17
- with_temporary_volumes do |volumes|
17
+ Docker::Volumes.new.with_temporary_volumes do |volumes|
18
18
  Scenario::Test::Instance::Image
19
- .perform(next_release.previous_stable) do |scenario|
19
+ .perform(ce_release) do |scenario|
20
20
  scenario.volumes = volumes
21
21
  end
22
22
 
23
23
  Scenario::Test::Instance::Image
24
- .perform(next_release) do |scenario|
24
+ .perform(ce_release.to_ee) do |scenario|
25
25
  scenario.volumes = volumes
26
26
  end
27
27
  end
28
28
  end
29
-
30
- def with_temporary_volumes
31
- Dir.mktmpdir('gitlab-qa-').tap do |dir|
32
- yield Hash[VOLUMES.map { |k, v| ["#{dir}/#{k}", v] }]
33
- end
34
- end
35
29
  end
36
30
  end
37
31
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.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: 0.4.0
4
+ version: 0.5.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: 2017-11-22 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,7 +102,9 @@ files:
102
102
  - bin/console
103
103
  - bin/qa
104
104
  - bin/setup
105
+ - docs/README.md
105
106
  - docs/architecture.md
107
+ - docs/trainings.md
106
108
  - exe/gitlab-qa
107
109
  - gitlab-qa.gemspec
108
110
  - lib/gitlab/qa.rb
@@ -111,6 +113,7 @@ files:
111
113
  - lib/gitlab/qa/docker/command.rb
112
114
  - lib/gitlab/qa/docker/engine.rb
113
115
  - lib/gitlab/qa/docker/shellout.rb
116
+ - lib/gitlab/qa/docker/volumes.rb
114
117
  - lib/gitlab/qa/release.rb
115
118
  - lib/gitlab/qa/runtime/env.rb
116
119
  - lib/gitlab/qa/scenario/actable.rb
@@ -120,6 +123,7 @@ files:
120
123
  - lib/gitlab/qa/scenario/test/integration/geo.rb
121
124
  - lib/gitlab/qa/scenario/test/integration/mattermost.rb
122
125
  - lib/gitlab/qa/scenario/test/omnibus/image.rb
126
+ - lib/gitlab/qa/scenario/test/omnibus/update.rb
123
127
  - lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
124
128
  - lib/gitlab/qa/scenario/test/sanity/version.rb
125
129
  - lib/gitlab/qa/version.rb