class Gitlab::QA::Component::PostgreSQL
def name
def name @name ||= "postgres" end
def run_psql(command)
def run_psql(command) @docker.exec(name, %(psql -U postgres #{command})) end
def start
def start @docker.run(image, tag) do |command| command << "-d" command << "--name #{name}" command << "--net #{network}" command.env("POSTGRES_PASSWORD", "SQL_PASSWORD") end end
def wait_until_ready
def wait_until_ready start = Time.now begin run_psql 'template1' rescue StandardError sleep 5 retry if Time.now - start < 60 raise end end