Class: Gitlab::QA::Scenario::Test::Integration::Praefect

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

Instance Method Summary collapse

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

perform

Instance Method Details

#perform(release, *rspec_args) ⇒ Object

rubocop:disable Metrics/AbcSize



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/gitlab/qa/scenario/test/integration/praefect.rb', line 8

def perform(release, *rspec_args)
  Docker::Volumes.new.with_temporary_volumes do |volumes|
    # Create the Praefect database before enabling Praefect
    Component::Gitlab.perform do |gitlab|
      gitlab.release = QA::Release.new(release)
      gitlab.name = 'gitlab'
      gitlab.network = 'test'
      gitlab.volumes = volumes
      gitlab.exec_commands = ['gitlab-psql -d template1 -c "CREATE DATABASE praefect_production OWNER gitlab"']

      gitlab.act do
        prepare
        start
        reconfigure
        process_exec_commands
        wait
        teardown
      end
    end

    # Restart GitLab with Praefect enabled and then run the tests
    Component::Gitlab.perform do |gitlab|
      gitlab.release = QA::Release.new(release)
      gitlab.name = 'gitlab'
      gitlab.network = 'test'
      gitlab.volumes = volumes
      gitlab.omnibus_config = omnibus_config_with_praefect

      gitlab.act do
        prepare_gitlab_omnibus_config
        start
        reconfigure
        wait

        puts "Running Praefect specs!"

        Component::Specs.perform do |specs|
          specs.suite = 'Test::Instance::All'
          specs.release = gitlab.release
          specs.network = gitlab.network
          specs.args = [gitlab.address, *rspec_args]
          specs.env = { QA_PRAEFECT_REPOSITORY_STORAGE: 'default' }
        end

        teardown
      end
    end
  end
end