Sha256: 651c886f132650d90297f31c373562a0ef7f111de3a59bf0f10887e2c99b248a

Contents?: true

Size: 904 Bytes

Versions: 92

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

module Gitlab
  module QA
    module Component
      class PostgreSQL < Base
        DOCKER_IMAGE = 'postgres'
        DOCKER_IMAGE_TAG = '11'

        def name
          @name ||= "postgres"
        end

        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

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

        private

        def wait_until_ready
          start = Time.now
          begin
            run_psql 'template1'
          rescue StandardError
            sleep 5
            retry if Time.now - start < 60
            raise
          end
        end
      end
    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
gitlab-qa-15.3.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-15.2.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-15.1.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-15.0.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.21.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.20.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.19.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.19.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.19.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.18.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.17.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.16.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.15.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.14.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.13.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.12.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.11.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.9.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.8.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-14.8.0 lib/gitlab/qa/component/postgresql.rb