Sha256: bbf29da73fcc629c40ae1dfdd8b33d96d7e2b54d1a61c4f0b6dfb3b8b3c8d2ce

Contents?: true

Size: 887 Bytes

Versions: 71

Compression:

Stored size: 887 Bytes

Contents

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

        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

71 entries across 71 versions & 1 rubygems

Version Path
gitlab-qa-7.34.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.33.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.32.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.31.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.30.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.29.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.29.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.27.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.27.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.27.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.26.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.25.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.25.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.6 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.5 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.4 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.3 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.24.0 lib/gitlab/qa/component/postgresql.rb