Sha256: 5a941e625c7b8c2b7310b1ca6335f0cb58d0926da317f0395bef331cffddb378

Contents?: true

Size: 868 Bytes

Versions: 2

Compression:

Stored size: 868 Bytes

Contents

test_name 'FACT-2054: Execute on Windows with expand => false should raise an error' do
  tag 'risk:high'

  confine :to, :platform => /windows/

  content = <<-EOM
    Facter.add(:foo) do
      setcode do
        Facter::Core::Execution.execute("cmd", {:expand => false})
      end
    end
  EOM

  agents.each do |agent|
    fact_dir = agent.tmpdir('facter')
    fact_file = File.join(fact_dir, 'test_facts.rb')
    create_remote_file(agent, fact_file, content)
    env = {'FACTERLIB' => fact_dir}

    teardown do
      on(agent, "rm -rf '#{fact_dir}'")
    end

    step "Agent: Verify that exception is raised" do
      on(agent, facter('foo', :environment => env), :acceptable_exit_codes => [0, 1]) do |output|
        assert_match(/Unsupported argument on Windows/, output.stderr, '{:expand => false} on Windows should raise error')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facter-4.0.29 acceptance/tests/custom_facts/windows_not_expand_command.rb
facter-4.0.28 acceptance/tests/custom_facts/windows_not_expand_command.rb