summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2010-11-23 16:42:06 -0800
committerNick Lewis <nick@puppetlabs.com>2010-11-23 16:42:06 -0800
commit4b35402ba85d8842d757becec5c8a7bf4d6f6654 (patch)
tree5da174c4c1c106b99e8c464e45e89d7b5ba2b5a2 /test
parenta7bd1630622cace01d0e4c974c76366e4b3b886c (diff)
parent2bc6727b6ac7348dbac98099f1fe0aeb3cd1295f (diff)
downloadpuppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.tar.gz
puppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.tar.xz
puppet-4b35402ba85d8842d757becec5c8a7bf4d6f6654.zip
Merge branch 'next'
Diffstat (limited to 'test')
-rw-r--r--test/data/providers/host/parsed/valid_hosts19
-rwxr-xr-xtest/lib/puppettest.rb4
-rwxr-xr-xtest/other/provider.rb13
-rwxr-xr-xtest/puppet/tc_suidmanager.rb19
-rwxr-xr-xtest/ral/manager/type.rb2
-rwxr-xr-xtest/ral/providers/host/parsed.rb9
-rwxr-xr-xtest/ral/providers/provider.rb6
7 files changed, 37 insertions, 35 deletions
diff --git a/test/data/providers/host/parsed/valid_hosts b/test/data/providers/host/parsed/valid_hosts
new file mode 100644
index 000000000..24636295d
--- /dev/null
+++ b/test/data/providers/host/parsed/valid_hosts
@@ -0,0 +1,19 @@
+# Some leading comment, that should be ignored
+# The next line is empty so it should be ignored
+
+::1 localhost
+
+# We now try another delimiter: Several tabs
+127.0.0.1 localhost
+
+# No test trailing spaces
+10.0.0.1 host1
+
+# Ok its time to test aliases
+2001:252:0:1::2008:8 ipv6host alias1
+192.168.0.1 ipv4host alias2 alias3
+
+# Testing inlinecomments now
+192.168.0.2 host3 # This is host3
+192.168.0.3 host4 alias10 # This is host4
+192.168.0.4 host5 alias11 alias12 # This is host5
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index 0b3a89a72..a60092cf7 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -185,7 +185,7 @@ module PuppetTest
#if rake? or ! Puppet[:debug]
#if defined?($puppet_debug) or ! rake?
Puppet[:color] = false if textmate?
- Puppet::Util::Log.newdestination(@logs)
+ Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
if defined? $console
Puppet.info @method_name
Puppet::Util::Log.newdestination(:console)
@@ -305,7 +305,7 @@ module PuppetTest
def logstore
@logs = []
- Puppet::Util::Log.newdestination(@logs)
+ Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
end
end
diff --git a/test/other/provider.rb b/test/other/provider.rb
index 052d7a0d0..a539ee5a7 100755
--- a/test/other/provider.rb
+++ b/test/other/provider.rb
@@ -70,24 +70,13 @@ class TestImpl < Test::Unit::TestCase
child = @type.provide("child", :parent => parent.name) {}
}
- assert_nothing_raised {
- child.commands :which => "which"
- }
-
- assert(child.command(:which), "Did not find 'which' command")
-
- assert(child.command(:which) =~ /^\//,
- "Command did not become fully qualified")
- assert(FileTest.exists?(child.command(:which)),
- "Did not find actual 'which' binary")
-
assert_raise(Puppet::DevError) do
child.command(:nosuchcommand)
end
# Now create a parent command
assert_nothing_raised {
- parent.commands :sh => Puppet::Util.binary('sh')
+ parent.commands :sh => Puppet::Util.which('sh')
}
assert(parent.command(:sh), "Did not find 'sh' command")
diff --git a/test/puppet/tc_suidmanager.rb b/test/puppet/tc_suidmanager.rb
index 449f2aef5..eeb56f2c9 100755
--- a/test/puppet/tc_suidmanager.rb
+++ b/test/puppet/tc_suidmanager.rb
@@ -80,20 +80,11 @@ class TestSUIDManager < Test::Unit::TestCase
warn "Cannot run this test on ruby < 1.8.4"
else
set_exit_status!
-
-
- Puppet::Util.expects(:execute).with(
- 'yay',
- { :failonfail => false,
- :uid => @user.uid,
-
- :gid => @user.gid }
- ).returns('output')
-
-
- output = Puppet::Util::SUIDManager.run_and_capture 'yay',
- @user.uid,
- @user.gid
+ Puppet::Util.
+ expects(:execute).
+ with('yay',:combine => true, :failonfail => false, :uid => @user.uid, :gid => @user.gid).
+ returns('output')
+ output = Puppet::Util::SUIDManager.run_and_capture 'yay', @user.uid, @user.gid
assert_equal 'output', output.first
assert_kind_of Process::Status, output.last
diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb
index 7df643005..145877722 100755
--- a/test/ral/manager/type.rb
+++ b/test/ral/manager/type.rb
@@ -276,7 +276,7 @@ class TestType < Test::Unit::TestCase
def test_isomorphic_names
catalog = mk_catalog
# First do execs, since they're not isomorphic.
- echo = Puppet::Util.binary "echo"
+ echo = Puppet::Util.which "echo"
exec1 = exec2 = nil
assert_nothing_raised do
diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb
index c2367d566..955edd5d3 100755
--- a/test/ral/providers/host/parsed.rb
+++ b/test/ral/providers/host/parsed.rb
@@ -67,7 +67,8 @@ class TestParsedHostProvider < Test::Unit::TestCase
# Make sure we convert both directlys correctly using a simple host.
def test_basic_isomorphism
- hash = {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}}
+ hash = {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host},
+ :comment => ''}
str = nil
assert_nothing_raised do
@@ -105,11 +106,13 @@ class TestParsedHostProvider < Test::Unit::TestCase
[
{:record_type => :comment, :line => "# comment one"},
{:record_type => :blank, :line => ""},
- {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}},
+ {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host},
+ :comment => ''},
{:record_type => :blank, :line => " "},
{:record_type => :comment, :line => "# another comment"},
- {:record_type => :parsed, :name => "anotherhost", :ip => "192.168.43.57", :host_aliases => []}
+ {:record_type => :parsed, :name => "anotherhost", :ip => "192.168.43.57", :host_aliases => [],
+ :comment => ''}
], instances)
newtext = nil
diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb
index cb0b2a19e..f46e03f82 100755
--- a/test/ral/providers/provider.rb
+++ b/test/ral/providers/provider.rb
@@ -9,7 +9,7 @@ class TestProvider < Test::Unit::TestCase
include PuppetTest
def echo
- echo = Puppet::Util.binary("echo")
+ echo = Puppet::Util.which("echo")
raise "Could not find 'echo' binary; cannot complete test" unless echo
@@ -95,7 +95,7 @@ class TestProvider < Test::Unit::TestCase
provider.commands :testing => "/no/such/path"
- provider.stubs(:binary).returns "/no/such/path"
+ provider.stubs(:which).returns "/no/such/path"
provider.command(:testing)
assert_equal("/no/such/path", provider.command(:testing), "Did not return correct binary path")
@@ -187,7 +187,7 @@ class TestProvider < Test::Unit::TestCase
dir = tstdir
file = File.join(dir, "mycmd")
- sh = Puppet::Util.binary("sh")
+ sh = Puppet::Util.which("sh")
File.open(file, "w") { |f|
f.puts %{#!#{sh}
echo A Failure >&2