Class: Gitlab::QA::Component::PostgreSQL

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/qa/component/postgresql.rb

Constant Summary collapse

DOCKER_IMAGE =
'postgres'
DOCKER_IMAGE_TAG =
'11'

Constants inherited from Base

Base::CERTIFICATES_PATH

Instance Attribute Summary

Attributes inherited from Base

#additional_hosts, #airgapped_network, #docker, #environment, #network, #network_aliases, #ports, #runner_network, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #initialize, #instance, #ip_address, #prepare, #prepare_airgapped_network, #prepare_docker_container, #prepare_docker_image, #prepare_network, #prepare_runner_network, #process_exec_commands, #pull, #restart, #start_instance, #tag, #teardown, #teardown!

Methods included from Scenario::Actable

#act, included

Constructor Details

This class inherits a constructor from Gitlab::QA::Component::Base

Instance Method Details

#nameObject



10
11
12
# File 'lib/gitlab/qa/component/postgresql.rb', line 10

def name
  @name ||= "postgres"
end

#run_psql(command) ⇒ Object



24
25
26
# File 'lib/gitlab/qa/component/postgresql.rb', line 24

def run_psql(command)
  @docker.exec(name, %(psql -U postgres #{command}))
end

#startObject



14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/qa/component/postgresql.rb', line 14

def start
  @docker.run(image: image, tag: tag) do |command|
    command << "-d"
    command << "--name #{name}"
    command << "--net #{network}"

    command.env("POSTGRES_PASSWORD", "SQL_PASSWORD")
  end
end