summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-02-09 15:17:53 -0800
committerMarkus Roberts <Markus@reality.com>2010-02-09 15:17:53 -0800
commit27322e5460130b854835aef56ab7076bab83a00b (patch)
treeb69501ce3c7fd616880f60999ad38304a40abba2 /test
parent70c71c58c1dd038d033d5fdd3fecc8f15b11fd52 (diff)
parent71653a74d91b1e6e9845b4a41249861319c0d6b0 (diff)
downloadpuppet-27322e5460130b854835aef56ab7076bab83a00b.tar.gz
puppet-27322e5460130b854835aef56ab7076bab83a00b.tar.xz
puppet-27322e5460130b854835aef56ab7076bab83a00b.zip
Merge branch '0.25.x'
Conflicts: lib/puppet/agent.rb lib/puppet/application/puppet.rb lib/puppet/configurer.rb man/man5/puppet.conf.5 spec/integration/defaults.rb spec/unit/configurer.rb
Diffstat (limited to 'test')
-rwxr-xr-xtest/executables/puppetmodule.rb55
-rw-r--r--test/lib/puppettest/support/utils.rb3
-rwxr-xr-xtest/other/transactions.rb2
-rwxr-xr-xtest/ral/providers/host/parsed.rb12
-rwxr-xr-xtest/ral/providers/sshkey/parsed.rb10
-rwxr-xr-xtest/ral/type/host.rb8
-rwxr-xr-xtest/ral/type/sshkey.rb4
-rwxr-xr-xtest/util/settings.rb10
8 files changed, 25 insertions, 79 deletions
diff --git a/test/executables/puppetmodule.rb b/test/executables/puppetmodule.rb
deleted file mode 100755
index ce28796d7..000000000
--- a/test/executables/puppetmodule.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + '/../lib/puppettest'
-
-require 'puppettest'
-
-class TestPuppetModule < Test::Unit::TestCase
- include PuppetTest::ExeTest
-
-
- def setup
- super
- @module = File.join(basedir, "ext", "module_puppet")
- end
-
- def test_existence
- assert(FileTest.exists?(@module), "Module does not exist")
- end
-
- def test_execution
- file = tempfile()
-
- createdfile = tempfile()
-
- File.open(file, "w") { |f|
- f.puts "class yaytest { file { \"#{createdfile}\": ensure => file } }"
- }
-
- output = nil
- cmd = @module
- cmd += " --verbose"
- #cmd += " --fqdn %s" % fqdn
- cmd += " --confdir %s" % Puppet[:confdir]
- cmd += " --vardir %s" % Puppet[:vardir]
- if Puppet[:debug]
- cmd += " --logdest %s" % "console"
- cmd += " --debug"
- cmd += " --trace"
- else
- cmd += " --logdest %s" % "/dev/null"
- end
-
- ENV["CFALLCLASSES"] = "yaytest:all"
- libsetup
-
- out = nil
- assert_nothing_raised {
- out = %x{#{cmd + " " + file} 2>&1}
- }
- assert($? == 0, "Puppet module exited with code %s: %s" % [$?.to_i, out])
-
- assert(FileTest.exists?(createdfile), "Failed to create config'ed file")
- end
-end
-
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb
index 655308d3b..5dd531200 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -154,11 +154,12 @@ end
module PuppetTest
include PuppetTest::Support::Utils
- def self.fakedata(dir,pat='*')
+ def fakedata(dir,pat='*')
glob = "#{basedir}/test/#{dir}/#{pat}"
files = Dir.glob(glob,File::FNM_PATHNAME)
raise Puppet::DevError, "No fakedata matching #{glob}" if files.empty?
files
end
+ module_function :fakedata
end
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index d0c6b8554..dd7742797 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -326,7 +326,7 @@ class TestTransactions < Test::Unit::TestCase
# 'subscribe' expects an array of arrays
#component[:require] = [[file.class.name,file.name]]
- ecomp[:subscribe] = fcomp
+ ecomp[:subscribe] = fcomp.ref
exec[:refreshonly] = true
trans = assert_events([], config)
diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb
index 28b553356..ce70f5c9f 100755
--- a/test/ral/providers/host/parsed.rb
+++ b/test/ral/providers/host/parsed.rb
@@ -45,7 +45,7 @@ class TestParsedHostProvider < Test::Unit::TestCase
return {
:name => "fakehost%s" % @hcount,
:ip => "192.168.27.%s" % @hcount,
- :alias => ["alias%s" % @hcount],
+ :host_aliases => ["alias%s" % @hcount],
:ensure => :present
}
end
@@ -67,7 +67,7 @@ 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", :alias => %w{another host}}
+ hash = {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}}
str = nil
assert_nothing_raised do
@@ -103,7 +103,7 @@ class TestParsedHostProvider < Test::Unit::TestCase
assert_equal([
{:record_type => :comment, :line => "# comment one"},
{:record_type => :blank, :line => ""},
- {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :alias => %w{another host}},
+ {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}},
{:record_type => :blank, :line => " "},
{:record_type => :comment, :line => "# another comment"},
{:record_type => :parsed, :name => "anotherhost", :ip => "192.168.43.57"}
@@ -150,13 +150,13 @@ class TestParsedHostProvider < Test::Unit::TestCase
}
# Remove a single field and make sure it gets tossed
- name = host.alias
- host.alias = [:absent]
+ name = host.host_aliases
+ host.host_aliases = [:absent]
assert_nothing_raised {
host.flush
assert(! file.read.include?(name[0]),
- "Did not remove alias from disk")
+ "Did not remove host_aliases from disk")
}
# Make sure it throws up if we remove a required field
diff --git a/test/ral/providers/sshkey/parsed.rb b/test/ral/providers/sshkey/parsed.rb
index 868640a10..cad758568 100755
--- a/test/ral/providers/sshkey/parsed.rb
+++ b/test/ral/providers/sshkey/parsed.rb
@@ -32,7 +32,7 @@ class TestParsedSSHKey < Test::Unit::TestCase
args = {
:name => name || "/fspuppet%s" % @pcount,
:key => "thisismykey%s" % @pcount,
- :alias => ["host1.domain.com","192.168.0.1"],
+ :host_aliases => ["host1.domain.com","192.168.0.1"],
:type => "dss",
:ensure => :present
}
@@ -68,11 +68,11 @@ class TestParsedSSHKey < Test::Unit::TestCase
key.flush
end
- assert(key.alias, "No alias set for key")
+ assert(key.host_aliases, "No host_aliases set for key")
hash = key.property_hash.dup
text = @provider.target_object(file).read
- names = [key.name, key.alias].flatten.join(",")
+ names = [key.name, key.host_aliases].flatten.join(",")
assert_equal("#{names} #{key.type} #{key.key}\n", text)
@@ -94,12 +94,12 @@ class TestParsedSSHKey < Test::Unit::TestCase
result = @provider.parse_line("one,two type key")
end
assert_equal("one", result[:name], "Did not call post hook")
- assert_equal(%w{two}, result[:alias], "Did not call post hook")
+ assert_equal(%w{two}, result[:host_aliases], "Did not call post hook")
assert_equal("one,two type key",
@provider.to_line(:record_type => :parsed,
:name => "one",
- :alias => %w{two},
+ :host_aliases => %w{two},
:type => "type",
:key => "key"),
"Did not use pre-hook when generating line"
diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb
index 537adc717..dce882b96 100755
--- a/test/ral/type/host.rb
+++ b/test/ral/type/host.rb
@@ -108,7 +108,7 @@ class TestHost < Test::Unit::TestCase
# This was a hard bug to track down.
assert_instance_of(String, current_values[host.property(:ip)])
- host[:alias] = %w{madstop kirby yayness}
+ host[:host_aliases] = %w{madstop kirby yayness}
assert_events([:host_changed], host)
@@ -117,7 +117,7 @@ class TestHost < Test::Unit::TestCase
}
assert_equal(%w{madstop kirby yayness},
- current_values[host.property(:alias)])
+ current_values[host.property(:host_aliases)])
host[:ensure] = :absent
assert_events([:host_removed], host)
@@ -184,13 +184,13 @@ class TestHost < Test::Unit::TestCase
end
def test_aliasisproperty
- assert_equal(:property, @hosttype.attrtype(:alias))
+ assert_equal(:property, @hosttype.attrtype(:host_aliases))
end
def test_multivalues
host = mkhost
assert_raise(Puppet::Error) {
- host[:alias] = "puppetmasterd yayness"
+ host[:host_aliases] = "puppetmasterd yayness"
}
end
diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb
index 74dd812bb..b528317a3 100755
--- a/test/ral/type/sshkey.rb
+++ b/test/ral/type/sshkey.rb
@@ -116,13 +116,13 @@ class TestSSHKey < Test::Unit::TestCase
end
def test_aliasisproperty
- assert_equal(:property, @sshkeytype.attrtype(:alias))
+ assert_equal(:property, @sshkeytype.attrtype(:host_aliases))
end
def test_multivalues
key = mkkey
assert_raise(Puppet::Error) {
- key[:alias] = "puppetmasterd yayness"
+ key[:host_aliases] = "puppetmasterd yayness"
}
end
diff --git a/test/util/settings.rb b/test/util/settings.rb
index c9e324564..1ec8ceeab 100755
--- a/test/util/settings.rb
+++ b/test/util/settings.rb
@@ -463,7 +463,7 @@ yay = /a/path
def test_correct_type_assumptions
file = Puppet::Util::Settings::FileSetting
- element = Puppet::Util::Settings::Setting
+ setting = Puppet::Util::Settings::Setting
bool = Puppet::Util::Settings::BooleanSetting
# We have to keep these ordered, unfortunately.
@@ -472,8 +472,8 @@ yay = /a/path
["true", bool],
[true, bool],
["false", bool],
- ["server", element],
- ["http://$server/yay", element],
+ ["server", setting],
+ ["http://$server/yay", setting],
["$server/yayness", file],
["$server/yayness.conf", file]
].each do |ary|
@@ -483,7 +483,7 @@ yay = /a/path
assert_nothing_raised {
config.setdefaults(:yayness, name => { :default => value, :desc => name.to_s})
}
- elem = config.element(name)
+ elem = config.setting(name)
assert_instance_of(type, elem,
"%s got created as wrong type" % value.inspect)
@@ -529,7 +529,7 @@ yay = /a/path
assert_nothing_raised do
config.setdefaults :test, :blocktest => {:default => "yay", :desc => "boo", :hook => proc { |value| testing = value }}
end
- elem = config.element(:blocktest)
+ elem = config.setting(:blocktest)
assert_nothing_raised do
assert_equal("yay", elem.value)