Sha256: 120f93235e2d3ad1e04b6e34542cc3c8ae6d7f6c3d524f028a0b309a9fdbb30b

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'rspec/core'
require 'fileutils'

SPEC_DIRECTORY = File.dirname(__FILE__)

describe 'r10k container' do
  before(:all) do
    @image = ENV['PUPPET_TEST_DOCKER_IMAGE']
    if @image.nil?
      error_message = <<-MSG
* * * * *
  PUPPET_TEST_DOCKER_IMAGE environment variable must be set so we
  know which image to test against!
* * * * *
      MSG
      fail error_message
    end
    @container = %x(docker run --rm --detach --entrypoint /bin/bash --interactive --volume #{File.join(SPEC_DIRECTORY, 'fixtures')}:/test #{@image}).chomp
    %x(docker exec #{@container} cp test/Puppetfile /)
  end

  after(:all) do
    %x(docker container kill #{@container})
    FileUtils.rm_rf(File.join(SPEC_DIRECTORY, 'fixtures', 'modules'))
  end

  it 'should validate the Puppetfile' do
    %x(docker exec #{@container} r10k puppetfile check)
    status = $?
    expect(status).to eq(0)
  end

  it 'should install the Puppetfile' do
    %x(docker exec #{@container} r10k puppetfile install)
    status = $?
    expect(status).to eq(0)
    expect(Dir.exist?(File.join(SPEC_DIRECTORY, 'fixtures', 'modules', 'ntp'))).to eq(true)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r10k-3.0.4 docker/r10k/spec/dockerfile_spec.rb
r10k-3.1.0 docker/r10k/spec/dockerfile_spec.rb