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

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

Constant Summary collapse

DOCKER_IMAGE =
'postgres'.freeze
DOCKER_IMAGE_TAG =
'11'.freeze

Instance Attribute Summary

Attributes inherited from Base

#docker, #environment, #network, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #initialize, #instance, #prepare, #prepare_docker_image, #prepare_network, #process_exec_commands, #pull, #restart, #tag, #teardown

Methods included from Scenario::Actable

#act, included

Constructor Details

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

Instance Method Details

#nameObject



8
9
10
# File 'lib/gitlab/qa/component/postgresql.rb', line 8

def name
  @name ||= "postgres"
end

#run_psql(command) ⇒ Object



22
23
24
# File 'lib/gitlab/qa/component/postgresql.rb', line 22

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

#startObject



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

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

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