Sha256: 6c22890ef3b222c59e53dc4a1ed6096e409e2a44846215c48591401d11cbd94b

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

require 'tmpdir'

module Gitlab
  module QA
    module Docker
      class Volumes
        VOLUMES = { 'config' => '/etc/gitlab',
                    'logs' => '/var/log/gitlab',
                    'data' => '/var/opt/gitlab' }.freeze

        def initialize(volumes = VOLUMES)
          @volumes = volumes
        end

        def with_temporary_volumes
          # macOS's tmpdir is a symlink /var/folders -> /private/var/folders
          # but Docker on macOS exposes /private and disallow exposing /var/
          # so we need to get the real tmpdir path
          Dir.mktmpdir('gitlab-qa-', File.realpath(Dir.tmpdir)).tap do |dir|
            yield Hash[@volumes.map { |k, v| ["#{dir}/#{k}", v] }]
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab-qa-0.5.0 lib/gitlab/qa/docker/volumes.rb