Sha256: 2bb24b256ff792d80221992d5784642590d84dd4cad4be338bf5118f1e9283ec

Contents?: true

Size: 855 Bytes

Versions: 18

Compression:

Stored size: 855 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, 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
            retry if Time.now - start < 30
            raise
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gitlab-qa-6.4.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.4.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.3.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.2.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.1.3 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.1.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.1.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.1.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.0.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.17.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.17.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.16.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.15.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.14.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.14.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.13.7 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.13.5 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-5.13.4 lib/gitlab/qa/component/postgresql.rb