Class: Gitlab::QA::Docker::Specs

Inherits:
Object
  • Object
show all
Includes:
Scenario::Actable
Defined in:
lib/gitlab/qa/docker/specs.rb

Constant Summary collapse

IMAGE_NAME =
'gitlab/gitlab-qa'.freeze

Instance Method Summary collapse

Methods included from Scenario::Actable

#act, included

Constructor Details

#initializeSpecs

Returns a new instance of Specs.



9
10
11
# File 'lib/gitlab/qa/docker/specs.rb', line 9

def initialize
  @docker = Docker::Engine.new
end

Instance Method Details

#test(gitlab) ⇒ Object



13
14
15
16
# File 'lib/gitlab/qa/docker/specs.rb', line 13

def test(gitlab)
  test_address(gitlab.release.edition, gitlab.tag, gitlab.address,
               "#{gitlab.name}-specs", gitlab.network)
end

#test_address(edition, tag, address, name = nil, network = nil) ⇒ Object

rubocop:disable Metrics/MethodLength



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gitlab/qa/docker/specs.rb', line 20

def test_address(edition, tag, address, name = nil, network = nil)
  puts 'Running instance test scenarios for Gitlab ' \
       "#{edition.upcase} at #{address}"

  args = ['Test::Instance', address]

  @docker.run(IMAGE_NAME, "#{edition}-#{tag}", *args) do |command|
    command << "-t --rm --net=#{network || 'bridge'}"

    Runtime::Env.delegated.each do |env|
      command << %(-e #{env}="$#{env}") if ENV[env]
    end

    command << "-v #{Runtime::Env.screenshots_dir}:/home/qa/tmp"
    command << "--name #{name || ('gitlab-specs-' + Time.now.to_i)}"
  end
end