class Gitlab::QA::Component::PostgreSQL

Constants

DOCKER_IMAGE
DOCKER_IMAGE_TAG

Public Instance Methods

name() click to toggle source
# File lib/gitlab/qa/component/postgresql.rb, line 8
def name
  @name ||= "postgres"
end
run_psql(command) click to toggle source
# File lib/gitlab/qa/component/postgresql.rb, line 22
def run_psql(command)
  @docker.exec(name, %(psql -U postgres #{command}))
end
start() click to toggle source
# File lib/gitlab/qa/component/postgresql.rb, line 12
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

Private Instance Methods

wait_until_ready() click to toggle source
# File lib/gitlab/qa/component/postgresql.rb, line 28
def wait_until_ready
  start = Time.now
  begin
    run_psql 'template1'
  rescue StandardError
    sleep 5
    retry if Time.now - start < 60
    raise
  end
end