Class: Gitlab::QA::Scenario::Test::Integration::Import

Inherits:
Gitlab::QA::Scenario::Template show all
Defined in:
lib/gitlab/qa/scenario/test/integration/import.rb

Overview

Scenario type for testing importers

In addition to main gitlab instance, starts another gitlab instance to act as source

and mock server to replace all other possible import sources

Direct Known Subclasses

ImportWithSMTP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Gitlab::QA::Scenario::Template

perform

Constructor Details

#initializeImport

Returns a new instance of Import.



16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 16

def initialize
  @network = Runtime::Env.docker_network

  @source_gitlab = new_gitlab_instance
  @target_gitlab = new_gitlab_instance
  @mock_server = new_mock_server
  @mail_hog_server = new_mail_hog_server
  @spec_suite = 'Test::Integration::Import'
end

Instance Attribute Details

#mail_hog_serverObject (readonly)

Returns the value of attribute mail_hog_server.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def mail_hog_server
  @mail_hog_server
end

#mock_serverObject (readonly)

Returns the value of attribute mock_server.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def mock_server
  @mock_server
end

#networkObject (readonly)

Returns the value of attribute network.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def network
  @network
end

#source_gitlabObject (readonly)

Returns the value of attribute source_gitlab.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def source_gitlab
  @source_gitlab
end

#spec_suiteObject (readonly)

Returns the value of attribute spec_suite.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def spec_suite
  @spec_suite
end

#target_gitlabObject (readonly)

Returns the value of attribute target_gitlab.



26
27
28
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 26

def target_gitlab
  @target_gitlab
end

Instance Method Details

#configure_omnibus(gitlab, mail_hog) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 28

def configure_omnibus(gitlab, mail_hog)
  raise NotImplementedError
end

#perform(target_release, source_release = nil, *rspec_args) ⇒ void

This method returns an undefined value.

Import tests that spins up two gitlab instances

perform(gitlab-ee, gitlab-ee:17.4.0-ee.0)

> will perform import from gitlab-ee:17.4.0-ee.0 to gitlab-ee

Parameters:

  • target_release (String)

    target gitlab instance version release docker image(default)

  • source_release (String) (defaults to: nil)

    source gitlab instance version, if its not passed takes the target release as default

  • *rspec_args (Array)

    rspec arguments



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/gitlab/qa/scenario/test/integration/import.rb', line 42

def perform(target_release, source_release = nil, *rspec_args)
  # When source_release isn't actually passed but RSpec args arg passed with `-- rspec_args...`,
  # source_release is wrongly set to `--`, so we fix that here.
  if source_release == "--"
    rspec_args.prepend('--')
    source_release = nil
  end

  source_release = target_release if source_release.nil?
  start_mock_server
  start_gitlab_instances(source_release, target_release)

  run_specs(rspec_args)
ensure
  mock_server.teardown
  target_gitlab.teardown
  source_gitlab.teardown
end