Sha256: cffb4a38a6d7d3a685a649eace099660b342342e5f77efd7b7cf032f3feafaf3

Contents?: true

Size: 1.75 KB

Versions: 55

Compression:

Stored size: 1.75 KB

Contents

test_name "dsl::helpers::host_helpers #create_tmpdir_on" do
  step "#create_tmpdir_on returns a temporary directory on the remote system" do
    tmpdir = create_tmpdir_on default
    assert_match %r{/}, tmpdir
    assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
  end

  step "#create_tmpdir_on uses the specified path prefix when provided" do
    tmpdir = create_tmpdir_on(default, "mypathprefix")
    assert_match %r{/mypathprefix}, tmpdir
    assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
  end

  step "#create_tmpdir_on fails if a non-existent user is specified" do
    assert_raises Beaker::Host::CommandFailure do
      tmpdir = create_tmpdir_on default, '', 'fakeuser'
    end
  end

  step "#create_tmpdir_on sets the user if specified" do
    default.user_present('tmpdirtestuser')
    tmpdir = create_tmpdir_on(default, nil, 'tmpdirtestuser', nil)
    assert_match /tmpdirtestuser/, on(default, "ls -ld #{tmpdir}").output
    default.user_absent('tmpdirtestuser')
  end

  step "#create_tmpdir_on fails if a non-existent group is specified" do
    assert_raises Beaker::Host::CommandFailure do
      tmpdir = create_tmpdir_on default, '', nil, 'fakegroup'
    end
  end

  step "#create_tmpdir_on sets the group if specified" do
    default.group_present('tmpdirtestgroup')
    tmpdir = create_tmpdir_on(default, nil, nil, 'tmpdirtestgroup')
    assert_match /testgroup/, on(default, "ls -ld #{tmpdir}").output
    default.group_absent('tmpdirtestgroup')
  end

  step "#create_tmpdir_on operates on all hosts if given a hosts array" do
    tmpdirs = create_tmpdir_on hosts
    hosts.zip(tmpdirs).each do |(host, tmpdir)|
      assert_match %r{/}, tmpdir
      assert_equal 0, on(host, "touch #{tmpdir}/testfile").exit_code
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
beaker-puppet-1.18.13 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.12 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.11 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.10 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.9 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.8 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.7 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.6 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.5 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.4 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.3 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.2 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.1 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.18.0 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.17.0 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.16.0 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.15.1 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.15.0 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.14.0 acceptance/tests/create_tmpdir_on_test.rb
beaker-puppet-1.13.0 acceptance/tests/create_tmpdir_on_test.rb