Sha256: 2acfde86112aa0fa4b718c506c9ad0100b198dc8ac7802aca29f0fbbd4ab78cd

Contents?: true

Size: 875 Bytes

Versions: 35

Compression:

Stored size: 875 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
            sleep 5
            retry if Time.now - start < 60
            raise
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
gitlab-qa-7.0.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-7.0.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.23.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.22.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.22.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.21.4 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.21.3 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.21.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.21.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.21.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.20.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.20.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.19.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.18.2 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.18.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.18.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.17.1 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.17.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.16.0 lib/gitlab/qa/component/postgresql.rb
gitlab-qa-6.15.4 lib/gitlab/qa/component/postgresql.rb