Class: Gitlab::QA::Scenario::Test::Integration::Opensearch

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

perform

Constructor Details

#initializeOpensearch

Returns a new instance of Opensearch.



11
12
13
14
15
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 11

def initialize
  @gitlab_name = 'gitlab-opensearch'
  # Currently the test suite that tests Advanced Search features is called 'Elasticsearch' which we hope to abstract to 'Advancedsearch' in the future
  @spec_suite = 'QA::EE::Scenario::Test::Integration::Elasticsearch'
end

Instance Attribute Details

#gitlab_nameObject (readonly)

Returns the value of attribute gitlab_name.



9
10
11
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 9

def gitlab_name
  @gitlab_name
end

#spec_suiteObject (readonly)

Returns the value of attribute spec_suite.



9
10
11
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 9

def spec_suite
  @spec_suite
end

Instance Method Details

#before_perform(release) ⇒ Object

Raises:

  • (ArgumentError)


17
18
19
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 17

def before_perform(release)
  raise ArgumentError, 'OpenSearch is an EE only feature!' unless release.ee?
end

#empty_indexObject



47
48
49
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 47

def empty_index
  @empty_index ||= ["gitlab-rake gitlab:elastic:create_empty_index"]
end

#perform(release, *rspec_args) ⇒ Object



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
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 21

def perform(release, *rspec_args)
  release = QA::Release.new(release)
  before_perform(release)

  Component::Gitlab.perform do |gitlab|
    gitlab.release = release
    setup_opensearch_on gitlab

    Component::Opensearch.perform do |opensearch|
      opensearch.network = Runtime::Env.docker_network
      opensearch.instance do
        gitlab.instance do
          Runtime::Logger.info("Running #{spec_suite} specs!")

          Component::Specs.perform do |specs|
            specs.suite = spec_suite
            specs.release = gitlab.release
            specs.network = gitlab.network
            specs.args = [gitlab.address, *rspec_args]
          end
        end
      end
    end
  end
end

#setup_opensearch_on(instance) ⇒ Object



51
52
53
54
55
56
# File 'lib/gitlab/qa/scenario/test/integration/opensearch.rb', line 51

def setup_opensearch_on(instance)
  instance.name = gitlab_name
  instance.network = Runtime::Env.docker_network
  instance.elastic_url = "http://elastic68:9200"
  instance.exec_commands = empty_index
end