summaryrefslogtreecommitdiffstats
path: root/test/ral
diff options
context:
space:
mode:
Diffstat (limited to 'test/ral')
-rwxr-xr-xtest/ral/manager/attributes.rb2
-rwxr-xr-xtest/ral/manager/manager.rb14
-rwxr-xr-xtest/ral/manager/type.rb22
-rwxr-xr-xtest/ral/providers/cron/crontab.rb10
-rwxr-xr-xtest/ral/providers/group.rb2
-rwxr-xr-xtest/ral/providers/host/netinfo.rb8
-rwxr-xr-xtest/ral/providers/mailalias/aliases.rb2
-rwxr-xr-xtest/ral/providers/mount/netinfo.rb26
-rwxr-xr-xtest/ral/providers/package.rb2
-rwxr-xr-xtest/ral/providers/package/aptitude.rb2
-rwxr-xr-xtest/ral/providers/package/aptrpm.rb8
-rwxr-xr-xtest/ral/providers/parsedfile.rb6
-rwxr-xr-xtest/ral/providers/port/parsed.rb6
-rwxr-xr-xtest/ral/providers/provider.rb6
-rwxr-xr-xtest/ral/providers/service/base.rb2
-rwxr-xr-xtest/ral/providers/sshkey/parsed.rb22
-rwxr-xr-xtest/ral/providers/user.rb8
-rwxr-xr-xtest/ral/type/cron.rb4
-rwxr-xr-xtest/ral/type/exec.rb14
-rwxr-xr-xtest/ral/type/file.rb64
-rwxr-xr-xtest/ral/type/fileignoresource.rb64
-rwxr-xr-xtest/ral/type/filesources.rb32
-rwxr-xr-xtest/ral/type/group.rb2
-rwxr-xr-xtest/ral/type/host.rb10
-rwxr-xr-xtest/ral/type/resources.rb44
-rwxr-xr-xtest/ral/type/sshkey.rb12
-rwxr-xr-xtest/ral/type/user.rb6
-rwxr-xr-xtest/ral/type/yumrepo.rb6
-rwxr-xr-xtest/ral/type/zone.rb4
29 files changed, 205 insertions, 205 deletions
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index ab5ba85d1..cf8f2f9ae 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -144,7 +144,7 @@ class TestTypeAttributes < Test::Unit::TestCase
type.newparam(:name) {}
type.newparam(:one) {}
type.newproperty(:two) {}
-
+
aliases = {
:three => :one,
:four => :two
diff --git a/test/ral/manager/manager.rb b/test/ral/manager/manager.rb
index 8f7e74d4d..8efea128d 100755
--- a/test/ral/manager/manager.rb
+++ b/test/ral/manager/manager.rb
@@ -9,19 +9,19 @@ require 'puppettest'
class TestTypeManager < Test::Unit::TestCase
include PuppetTest
-
+
class FakeManager
extend Puppet::MetaType::Manager
def self.clear
@types = {}
end
end
-
+
def teardown
super
FakeManager.clear
end
-
+
# Make sure we can remove defined types
def test_rmtype
assert_nothing_raised {
@@ -30,22 +30,22 @@ class TestTypeManager < Test::Unit::TestCase
end
}
assert(FakeManager.type(:testing), "Did not get fake type")
-
+
assert_nothing_raised do
FakeManager.rmtype(:testing)
end
-
+
assert_nil(FakeManager.type(:testing), "Type was not removed")
assert(! defined?(FakeManager::Testing), "Constant was not removed")
end
-
+
def test_newtype
assert_nothing_raised do
FakeManager.newtype(:testing, :self_refresh => true) do
newparam(:name, :namevar => true)
end
end
-
+
test = FakeManager.type(:testing)
assert(test, "did not get type")
assert(test.self_refresh, "did not set attribute")
diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb
index 7923610b3..2624e26ea 100755
--- a/test/ral/manager/type.rb
+++ b/test/ral/manager/type.rb
@@ -278,7 +278,7 @@ class TestType < Test::Unit::TestCase
# Make sure the title is sufficiently differentiated from the namevar.
def test_title_at_creation_with_hash
file = nil
- fileclass = Puppet::Type.type(:file)
+ fileclass = Puppet::Type.type(:file)
path = tempfile()
assert_nothing_raised do
@@ -415,7 +415,7 @@ class TestType < Test::Unit::TestCase
exec = Puppet::Type.newexec(:title => "yay", :command => "/bin/echo yay")
assert_equal("Exec[yay]", exec.ref)
end
-
+
def test_path
config = mk_catalog
@@ -434,33 +434,33 @@ class TestType < Test::Unit::TestCase
end
res
end
-
+
exec = mk.call(1, {})
-
+
assert_equal("/Exec[exec1]", exec.path)
-
+
comp = Puppet::Type.newcomponent :title => "My[component]", :type => "Yay"
config.add_resource comp
-
+
exec = mk.call(2, :parent => comp)
-
+
assert_equal("/My[component]/Exec[exec2]", exec.path)
-
+
comp = Puppet::Type.newcomponent :name => "Other[thing]"
config.add_resource comp
exec = mk.call(3, :parent => comp)
assert_equal("/Other[thing]/Exec[exec3]", exec.path)
-
+
comp = Puppet::Type.newcomponent :type => "server", :name => "server"
config.add_resource comp
exec = mk.call(4, :parent => comp)
assert_equal("/server/Exec[exec4]", exec.path)
-
+
comp = Puppet::Type.newcomponent :type => "whatever", :name => "class[main]"
config.add_resource comp
exec = mk.call(5, :parent => comp)
assert_equal("//Exec[exec5]", exec.path)
-
+
newcomp = Puppet::Type.newcomponent :type => "yay", :name => "Good[bad]"
config.add_resource newcomp
config.add_edge comp, newcomp
diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb
index d52105ce3..6a745a10c 100755
--- a/test/ral/providers/cron/crontab.rb
+++ b/test/ral/providers/cron/crontab.rb
@@ -21,7 +21,7 @@ class TestCronParsedProvider < Test::Unit::TestCase
# These are potentially multi-line records; there's no one-to-one map, but they model
# a full cron job. These tests assume individual record types will always be correctly
- # parsed, so all they
+ # parsed, so all they
def sample_crons
unless defined? @sample_crons
@sample_crons = YAML.load(File.read(File.join(@crondir, "crontab_collections.yaml")))
@@ -221,7 +221,7 @@ class TestCronParsedProvider < Test::Unit::TestCase
assert_nothing_raised("could not load %s" % file) do
str, args = YAML.load(File.read(file))
end
-
+
# Stupid old yaml
args.each do |hash|
hash.each do |param, value|
@@ -298,7 +298,7 @@ class TestCronParsedProvider < Test::Unit::TestCase
assert_equal("# Puppet Name: #{name}\n30 * * * * date > /dev/null", str,
"Cron did not generate correctly")
end
-
+
# Test that comments are correctly retained
def test_retain_comments
str = "# this is a comment\n#and another comment\n"
@@ -380,7 +380,7 @@ class TestCronParsedProvider < Test::Unit::TestCase
setme
target = @provider.target_object(@me)
-
+
[
"* * * * * /some/command",
"0,30 * * * * /some/command",
@@ -522,7 +522,7 @@ class TestCronParsedProvider < Test::Unit::TestCase
setme
target = @provider.target_object(@me)
-
+
[
"@daily /some/command",
"@daily /some/command more"
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index c5956bd78..8e62d7b1e 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -237,7 +237,7 @@ class TestGroupProvider < Test::Unit::TestCase
else
$stderr.puts "Not running as root; skipping group creation tests."
end
-
+
def test_autogen
provider = nil
group = Puppet::Type.type(:group).new(:name => nonrootgroup.name)
diff --git a/test/ral/providers/host/netinfo.rb b/test/ral/providers/host/netinfo.rb
index 131b32eec..0329edcd9 100755
--- a/test/ral/providers/host/netinfo.rb
+++ b/test/ral/providers/host/netinfo.rb
@@ -31,20 +31,20 @@ class TestNetinfoHostProvider < Test::Unit::TestCase
assert(list.detect { |provider| provider.name == "localhost"}, "Could not find localhost")
end
-
+
if Process.uid == 0
def test_simple
localhost = nil
assert_nothing_raised do
localhost = @host.create :name => "localhost", :check => [:ip], :provider => :netinfo
end
-
+
assert_nothing_raised do
localhost.retrieve
end
-
+
prov = localhost.provider
-
+
assert_nothing_raised do
assert(prov.ip, "Did not find value for ip")
assert(prov.ip != :absent, "Netinfo thinks the localhost is missing")
diff --git a/test/ral/providers/mailalias/aliases.rb b/test/ral/providers/mailalias/aliases.rb
index d938fbeef..6406e83e9 100755
--- a/test/ral/providers/mailalias/aliases.rb
+++ b/test/ral/providers/mailalias/aliases.rb
@@ -24,7 +24,7 @@ class TestMailaliasAliasesProvider < Test::Unit::TestCase
@provider.clear
super
end
-
+
def mkalias(name = "me")
if defined? @pcount
@pcount += 1
diff --git a/test/ral/providers/mount/netinfo.rb b/test/ral/providers/mount/netinfo.rb
index 7a9703c1b..2474cbdf7 100755
--- a/test/ral/providers/mount/netinfo.rb
+++ b/test/ral/providers/mount/netinfo.rb
@@ -6,7 +6,7 @@
require File.dirname(__FILE__) + '/../../../lib/puppettest'
require 'puppettest'
-#
+#
# if Puppet::Type.type(:mount).provider(:netinfo).suitable?
# class TestNetinfoMountProvider < Test::Unit::TestCase
# include PuppetTest
@@ -15,7 +15,7 @@ require 'puppettest'
# super
# @mount = Puppet::Type.type(:mount)
# end
-#
+#
# if Process.uid == 0 and Facter.value(:hostname) == "midden"
# def test_mount_nfs
# culain = nil
@@ -23,36 +23,36 @@ require 'puppettest'
# culain = @mount.create :name => "/mnt", :device => "culain:/home/luke", :options => "-o -P", :ensure => :present,
# :fstype => "nfs"
# end
-#
+#
# assert(culain, "Did not create fs")
-#
+#
# assert_apply(culain)
-#
+#
# assert_nothing_raised do
# culain.provider.mount
# end
-#
+#
# assert(culain.provider.mounted?, "fs is not considered mounted")
# assert_nothing_raised() { culain.provider.unmount }
-#
+#
# culain[:ensure] = :absent
-#
+#
# assert_apply(culain)
# end
# end
-#
+#
# def test_simple
# root = nil
# assert_nothing_raised do
# root = @mount.create :name => "/", :check => @mount.validproperties
# end
-#
+#
# assert_nothing_raised do
# root.retrieve
# end
-#
+#
# prov = root.provider
-#
+#
# assert_nothing_raised do
# assert(prov.device, "Did not value for device")
# assert(prov.device != :absent, "Netinfo thinks the root device is missing")
@@ -71,7 +71,7 @@ require 'puppettest'
# p obj
# assert(obj.is(:device), "Did not get value for device in %s" % obj[:name])
# end
-#
+#
# assert(list.detect { |m| m[:name] == "/"}, "Could not find root fs")
# end
# end
diff --git a/test/ral/providers/package.rb b/test/ral/providers/package.rb
index 8af5108cc..e7f930096 100755
--- a/test/ral/providers/package.rb
+++ b/test/ral/providers/package.rb
@@ -127,7 +127,7 @@ class TestPackageProvider < Test::Unit::TestCase
return
end
end
-
+
if cleancmd = hash[:cleanup]
hash.delete(:cleanup)
end
diff --git a/test/ral/providers/package/aptitude.rb b/test/ral/providers/package/aptitude.rb
index 5e4749333..6e94f0ab8 100755
--- a/test/ral/providers/package/aptitude.rb
+++ b/test/ral/providers/package/aptitude.rb
@@ -41,7 +41,7 @@ class AptitudePackageProviderTest < PuppetTest::TestCase
).returns(0)
pkg.evaluate.each { |state|
- state.forward
+ state.forward
}
end
diff --git a/test/ral/providers/package/aptrpm.rb b/test/ral/providers/package/aptrpm.rb
index 8a107c4d7..a3010cc92 100755
--- a/test/ral/providers/package/aptrpm.rb
+++ b/test/ral/providers/package/aptrpm.rb
@@ -12,7 +12,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase
super
@type = Puppet::Type.type(:package)
end
-
+
def test_install
pkg = @type.new :name => 'faff',
:provider => :aptrpm,
@@ -38,10 +38,10 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase
"install",
'faff'
).returns(0)
-
+
pkg.evaluate.each { |state| state.forward }
end
-
+
def test_uninstall
pkg = @type.new :name => 'faff', :provider => :aptrpm, :ensure => :absent
@@ -65,7 +65,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase
'remove',
'faff'
).returns(0)
-
+
pkg.evaluate.each { |state| state.forward }
end
diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb
index 8a9fa89d2..f0f47dc1f 100755
--- a/test/ral/providers/parsedfile.rb
+++ b/test/ral/providers/parsedfile.rb
@@ -587,14 +587,14 @@ class TestParsedFile < Test::Unit::TestCase
bills_values = bill.retrieve
end
- assert(bills_values[bill.property(:one)],
+ assert(bills_values[bill.property(:one)],
"Bill does not have a value for 'one'")
- assert(bills_values[bill.property(:one)],
+ assert(bills_values[bill.property(:one)],
"Bill does not have a value for 'one' on second try")
assert_nothing_raised do
bill.retrieve
end
- assert(bills_values[bill.property(:one)],
+ assert(bills_values[bill.property(:one)],
"bill's value for 'one' disappeared")
end
diff --git a/test/ral/providers/port/parsed.rb b/test/ral/providers/port/parsed.rb
index 41da17993..154d21260 100755
--- a/test/ral/providers/port/parsed.rb
+++ b/test/ral/providers/port/parsed.rb
@@ -24,7 +24,7 @@ require 'puppettest'
# @provider.clear
# super
# end
-#
+#
# # Generate a line from a hash. The line might include '\n'.
# def genline(hash)
# line = [hash[:name], "#{hash[:number]}/%s"].join("\t\t")
@@ -60,7 +60,7 @@ require 'puppettest'
# assert_equal("53", dns[:number], "dns number is wrong")
#
# text = nil
-# assert_nothing_raised("failed to generate %s" % file) do
+# assert_nothing_raised("failed to generate %s" % file) do
# text = @provider.to_file(@provider.target_records(file))
# end
#
@@ -68,7 +68,7 @@ require 'puppettest'
# newlines = text.chomp.split "\n"
# regex = /^(\S+)\s+(\d+)\/(\w+)/
# oldlines.zip(newlines).each do |old, new|
-# if omatch = regex.match(old)
+# if omatch = regex.match(old)
# assert(newmatch = regex.match(new),
# "Lines were not equivalent: %s vs %s" %
# [old.inspect, new.inspect]
diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb
index 9e5e585dc..79535bef2 100755
--- a/test/ral/providers/provider.rb
+++ b/test/ral/providers/provider.rb
@@ -453,7 +453,7 @@ class TestProviderFeatures < Test::Unit::TestCase
define_method(:one) {}
define_method(:two) {}
end
-
+
# Another with the numbers and a declaration
@type.provide(:both) do
define_method(:one) {}
@@ -461,7 +461,7 @@ class TestProviderFeatures < Test::Unit::TestCase
has_feature :alpha
end
-
+
# And just the declaration
@type.provide(:letters) do
has_feature :alpha
@@ -484,7 +484,7 @@ class TestProviderFeatures < Test::Unit::TestCase
features.sort! { |a,b| a.to_s <=> b.to_s }
assert_equal(features, provider.features, "Got incorrect feature list for provider instance %s" % name)
assert_equal(features, provider_class.features, "Got incorrect feature list for provider class %s" % name)
- features.each do |feat|
+ features.each do |feat|
assert(provider.feature?(feat), "Provider instance %s did not have feature %s" % [name, feat])
assert(provider_class.feature?(feat), "Provider class %s did not have feature %s" % [name, feat])
end
diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb
index 03ecca59d..e23e2fd11 100755
--- a/test/ral/providers/service/base.rb
+++ b/test/ral/providers/service/base.rb
@@ -47,7 +47,7 @@ class TestBaseServiceProvider < Test::Unit::TestCase
assert_equal(:stopped, provider.status, "status was not returned correctly")
end
end
-
+
# Testing #454
def test_that_failures_propagate
nope = "/no/such/command"
diff --git a/test/ral/providers/sshkey/parsed.rb b/test/ral/providers/sshkey/parsed.rb
index f2992386d..868640a10 100755
--- a/test/ral/providers/sshkey/parsed.rb
+++ b/test/ral/providers/sshkey/parsed.rb
@@ -22,7 +22,7 @@ class TestParsedSSHKey < Test::Unit::TestCase
@provider.clear
super
end
-
+
def mkkey(name = "host.domain.com")
if defined? @pcount
@pcount += 1
@@ -52,39 +52,39 @@ class TestParsedSSHKey < Test::Unit::TestCase
fakedataparse(file)
}
end
-
+
def test_simplekey
@provider.filetype = :ram
file = @provider.default_target
-
+
key = nil
assert_nothing_raised do
key = mkkey
end
-
+
assert(key, "did not create key")
-
+
assert_nothing_raised do
key.flush
end
-
+
assert(key.alias, "No alias set for key")
-
+
hash = key.property_hash.dup
text = @provider.target_object(file).read
names = [key.name, key.alias].flatten.join(",")
-
+
assert_equal("#{names} #{key.type} #{key.key}\n", text)
-
+
assert_nothing_raised do
@provider.prefetch
end
-
+
hash.each do |p, v|
next unless key.respond_to?(p)
assert_equal(v, key.send(p), "%s did not match" % p)
end
-
+
assert(key.name !~ /,/, "Aliases were not split out during parsing")
end
diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb
index 3f68469c1..a5d8e9210 100755
--- a/test/ral/providers/user.rb
+++ b/test/ral/providers/user.rb
@@ -535,16 +535,16 @@ class TestUserProvider < Test::Unit::TestCase
assert_equal("-s", user.send(:flag, :shell),
"Incorrect shell flag")
end
-
+
def test_autogen
provider = nil
user = Puppet::Type.type(:user).new(:name => nonrootuser.name)
provider = user.provider
assert(provider, "did not get provider")
-
+
# Everyone should be able to autogenerate a uid
assert_instance_of(Fixnum, provider.autogen(:uid))
-
+
# If we're Darwin, then we should get results, but everyone else should
# get nil
darwin = (Facter.value(:operatingsystem) == "Darwin")
@@ -554,7 +554,7 @@ class TestUserProvider < Test::Unit::TestCase
:home => "/var/empty",
:shell => "/usr/bin/false"
}
-
+
should.each do |param, value|
if darwin
assert_equal(value, provider.autogen(param), "did not autogen %s for darwin correctly" % param)
diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb
index 2e25d82df..89c5583e0 100755
--- a/test/ral/type/cron.rb
+++ b/test/ral/type/cron.rb
@@ -152,7 +152,7 @@ class TestCron < Test::Unit::TestCase
cron = mkcron(name)
catalog = mk_catalog(name, cron)
trans = assert_events([:cron_created], catalog, name)
-
+
cron.provider.class.prefetch
cron = nil
@@ -342,7 +342,7 @@ class TestCron < Test::Unit::TestCase
unless param =~ /=$/
param = "%s=" % param
end
-
+
cron.provider.send(param, value)
end
diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb
index 9384d09db..6c1a82a20 100755
--- a/test/ral/type/exec.rb
+++ b/test/ral/type/exec.rb
@@ -240,7 +240,7 @@ class TestExec < Test::Unit::TestCase
)
catalog = mk_catalog(file, baseobj, ofile, exec, cat)
-
+
rels = nil
assert_nothing_raised do
rels = exec.autorequire
@@ -312,7 +312,7 @@ class TestExec < Test::Unit::TestCase
# Verify that we can execute commands as a special user
def mknverify(file, user, group = nil, id = true)
File.umask(0022)
-
+
args = {
:command => "touch %s" % file,
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
@@ -541,7 +541,7 @@ class TestExec < Test::Unit::TestCase
assert_raise(ArgumentError, "Missing command did not raise error") {
exec.run("/bin/nosuchthingexists")
- }
+ }
end
def test_envparam
@@ -583,7 +583,7 @@ and stuff"
}
assert_equal("A B\n", output)
end
-
+
def test_environmentparam
exec = Puppet::Type.newexec(
:command => "echo $environmenttest",
@@ -627,13 +627,13 @@ and stuff"
def test_timeout
exec = Puppet::Type.type(:exec).new(:command => "sleep 1", :path => ENV["PATH"], :timeout => "0.2")
time = Time.now
-
+
assert_raise(Timeout::Error) {
exec.run("sleep 1")
}
Puppet.info "%s seconds, vs a timeout of %s" % [Time.now.to_f - time.to_f, exec[:timeout]]
-
-
+
+
assert_apply(exec)
end
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb
index 63d2a5270..8db306c32 100755
--- a/test/ral/type/file.rb
+++ b/test/ral/type/file.rb
@@ -385,24 +385,24 @@ class TestFile < Test::Unit::TestCase
Puppet::Type.allclear
}
end
-
+
def test_recurse?
file = Puppet::Type.type(:file).new :path => tempfile
-
+
# Make sure we default to false
assert(! file.recurse?, "Recurse defaulted to true")
-
+
[true, "true", 10, "inf", "remote"].each do |value|
file[:recurse] = value
assert(file.recurse?, "%s did not cause recursion" % value)
end
-
+
[false, "false", 0].each do |value|
file[:recurse] = value
assert(! file.recurse?, "%s caused recursion" % value)
end
end
-
+
def test_recursion
basedir = tempfile()
subdir = File.join(basedir, "subdir")
@@ -420,23 +420,23 @@ class TestFile < Test::Unit::TestCase
}
config = mk_catalog dir
transaction = Puppet::Transaction.new(config)
-
+
children = nil
assert_nothing_raised {
children = transaction.eval_generate(dir)
}
-
+
assert_equal([subdir], children.collect {|c| c.title },
"Incorrect generated children")
-
- # Remove our subdir resource,
+
+ # Remove our subdir resource,
subdir_resource = config.resource(:file, subdir)
config.remove_resource(subdir_resource)
# Create the test file
File.open(tmpfile, "w") { |f| f.puts "yayness" }
-
+
assert_nothing_raised {
children = transaction.eval_generate(dir)
}
@@ -444,7 +444,7 @@ class TestFile < Test::Unit::TestCase
# And make sure we get both resources back.
assert_equal([subdir, tmpfile].sort, children.collect {|c| c.title }.sort,
"Incorrect generated children when recurse == %s" % value.inspect)
-
+
File.unlink(tmpfile)
end
end
@@ -678,7 +678,7 @@ class TestFile < Test::Unit::TestCase
def test_backupmodes
File.umask(0022)
-
+
file = tempfile()
newfile = tempfile()
@@ -793,7 +793,7 @@ class TestFile < Test::Unit::TestCase
)
comp = mk_catalog(user, group, home)
}
-
+
# Now make sure we get a relationship for each of these
rels = nil
assert_nothing_raised { rels = home.autorequire }
@@ -932,23 +932,23 @@ class TestFile < Test::Unit::TestCase
end
end
end
-
+
if Process.uid == 0
# Testing #364.
def test_writing_in_directories_with_no_write_access
# Make a directory that our user does not have access to
dir = tempfile()
Dir.mkdir(dir)
-
+
# Get a fake user
user = nonrootuser
# and group
group = nonrootgroup
-
+
# First try putting a file in there
path = File.join(dir, "file")
file = Puppet::Type.newfile :path => path, :owner => user.name, :group => group.name, :content => "testing"
-
+
# Make sure we can create it
assert_apply(file)
assert(FileTest.exists?(path), "File did not get created")
@@ -957,7 +957,7 @@ class TestFile < Test::Unit::TestCase
assert_equal(group.gid, File.stat(path).gid, "File has the wrong group")
assert_equal("testing", File.read(path), "file has the wrong content")
-
+
# Now make a dir
subpath = File.join(dir, "subdir")
subdir = Puppet::Type.newfile :path => subpath, :owner => user.name, :group => group.name, :ensure => :directory
@@ -971,7 +971,7 @@ class TestFile < Test::Unit::TestCase
assert_equal("testing", File.read(path), "file has the wrong content")
end
end
-
+
# #366
def test_replace_aliases
file = Puppet::Type.newfile :path => tempfile()
@@ -980,14 +980,14 @@ class TestFile < Test::Unit::TestCase
file[:replace] = :no
assert_equal(:false, file[:replace], ":replace did not alias :false to :no")
end
-
+
def test_backup
path = tempfile()
file = Puppet::Type.newfile :path => path, :content => "yay"
catalog = mk_catalog(file)
catalog.finalize # adds the default resources.
-
+
[false, :false, "false"].each do |val|
assert_nothing_raised do
file[:backup] = val
@@ -1000,32 +1000,32 @@ class TestFile < Test::Unit::TestCase
end
assert_equal(".puppet-bak", file[:backup], "%s did not translate" % val.inspect)
end
-
+
# Now try a non-bucket string
assert_nothing_raised do
file[:backup] = ".bak"
end
assert_equal(".bak", file[:backup], ".bak did not translate")
-
+
# Now try a non-existent bucket
assert_nothing_raised do
file[:backup] = "main"
end
assert_equal("main", file[:backup], "bucket name was not retained")
assert_equal("main", file.bucket, "file's bucket was not set")
-
+
# And then an existing bucket
obj = Puppet::Type.type(:filebucket).new :name => "testing"
catalog.add_resource(obj)
bucket = obj.bucket
-
+
assert_nothing_raised do
file[:backup] = "testing"
end
assert_equal("testing", file[:backup], "backup value was reset")
assert_equal(obj.bucket, file.bucket, "file's bucket was not set")
end
-
+
def test_pathbuilder
dir = tempfile()
Dir.mkdir(dir)
@@ -1034,25 +1034,25 @@ class TestFile < Test::Unit::TestCase
obj = Puppet::Type.newfile :path => dir, :recurse => true, :mode => 0755
catalog = mk_catalog obj
transaction = Puppet::Transaction.new(catalog)
-
+
assert_equal("/%s" % obj.ref, obj.path)
-
+
list = transaction.eval_generate(obj)
fileobj = catalog.resource(:file, file)
assert(fileobj, "did not generate file object")
assert_equal("/%s" % fileobj.ref, fileobj.path, "did not generate correct subfile path")
end
-
+
# Testing #403
def test_removal_with_content_set
path = tempfile()
File.open(path, "w") { |f| f.puts "yay" }
file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo")
-
+
assert_apply(file)
assert(! FileTest.exists?(path), "File was not removed")
end
-
+
# Testing #438
def test_creating_properties_conflict
file = tempfile()
@@ -1114,7 +1114,7 @@ class TestFile < Test::Unit::TestCase
else
raise "invalid attr %s" % attr
end
-
+
# Run it again
run.call(file, "after modification with %s" % attr)
diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb
index 2c36bd3c6..ad68f703c 100755
--- a/test/ral/type/fileignoresource.rb
+++ b/test/ral/type/fileignoresource.rb
@@ -10,7 +10,7 @@ require 'fileutils'
class TestFileIgnoreSources < Test::Unit::TestCase
include PuppetTest::Support::Utils
include PuppetTest::FileTesting
-
+
def setup
super
begin
@@ -56,33 +56,33 @@ class TestFileIgnoreSources < Test::Unit::TestCase
#create source files
- File.open(File.join(frompath,sourcefile1),
+ File.open(File.join(frompath,sourcefile1),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "yayness"
}
-
- File.open(File.join(frompath,sourcefile2),
+
+ File.open(File.join(frompath,sourcefile2),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "even yayer"
}
-
+
#makes Puppet file Object
assert_nothing_raised {
tofile = Puppet::Type.type(:file).new(
:name => topath,
:source => frompath,
- :recurse => true,
- :ignore => "sourcefile2"
+ :recurse => true,
+ :ignore => "sourcefile2"
)
}
config = mk_catalog(tofile)
config.apply
-
-
+
+
#topath should exist as a directory with sourcedir as a directory
-
+
#This file should exist
assert(FileTest.exists?(File.join(topath,sourcefile1)))
@@ -104,7 +104,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
frompath = File.join(path,sourcedir)
FileUtils.mkdir_p frompath
-
+
FileUtils.mkdir_p(File.join(frompath, subdir))
FileUtils.mkdir_p(File.join(frompath, subdir2))
dir = Dir.glob(File.join(path,"**/*"))
@@ -117,18 +117,18 @@ class TestFileIgnoreSources < Test::Unit::TestCase
trans = nil
#create source files
-
- dir.each { |dir|
- File.open(File.join(dir,sourcefile1),
+
+ dir.each { |dir|
+ File.open(File.join(dir,sourcefile1),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "yayness"
}
-
- File.open(File.join(dir,sourcefile2),
+
+ File.open(File.join(dir,sourcefile2),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "even yayer"
}
-
+
}
#makes Puppet file Object
@@ -136,16 +136,16 @@ class TestFileIgnoreSources < Test::Unit::TestCase
tofile = Puppet::Type.type(:file).new(
:name => topath,
:source => frompath,
- :recurse => true,
- :ignore => "*2"
+ :recurse => true,
+ :ignore => "*2"
)
}
config = mk_catalog(tofile)
config.apply
-
+
#topath should exist as a directory with sourcedir as a directory
-
+
#This file should exist
assert(FileTest.exists?(File.join(topath,sourcefile1)))
assert(FileTest.exists?(File.join(topath,subdir)))
@@ -172,7 +172,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
frompath = File.join(path,sourcedir)
FileUtils.mkdir_p frompath
-
+
FileUtils.mkdir_p(File.join(frompath, subdir))
FileUtils.mkdir_p(File.join(frompath, subdir2))
FileUtils.mkdir_p(File.join(frompath, subdir3))
@@ -186,20 +186,20 @@ class TestFileIgnoreSources < Test::Unit::TestCase
trans = nil
#create source files
-
-
- sourcedir.each { |dir|
- File.open(File.join(dir,sourcefile1),
+
+
+ sourcedir.each { |dir|
+ File.open(File.join(dir,sourcefile1),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "yayness"
}
-
- File.open(File.join(dir,sourcefile2),
+
+ File.open(File.join(dir,sourcefile2),
File::WRONLY|File::CREAT|File::APPEND) { |of|
of.puts "even yayer"
}
-
+
}
@@ -209,8 +209,8 @@ class TestFileIgnoreSources < Test::Unit::TestCase
:name => topath,
:source => frompath,
:recurse => true,
- :ignore => ["*2", "an*"]
- # :ignore => ["*2", "an*", "nomatch"]
+ :ignore => ["*2", "an*"]
+ # :ignore => ["*2", "an*", "nomatch"]
)
}
@@ -224,7 +224,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
assert(FileTest.exists?(File.join(topath,sourcefile1)), "file1 not in destdir")
assert(FileTest.exists?(File.join(topath,subdir)), "subdir1 not in destdir")
assert(FileTest.exists?(File.join(File.join(topath,subdir),sourcefile1)), "file1 not in subdir")
- # proper files in source
+ # proper files in source
assert(FileTest.exists?(File.join(frompath,subdir)), "subdir not in source")
assert(FileTest.exists?(File.join(frompath,subdir2)), "subdir2 not in source")
assert(FileTest.exists?(File.join(frompath,subdir3)), "subdir3 not in source")
diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb
index 573bcb2ce..a39176121 100755
--- a/test/ral/type/filesources.rb
+++ b/test/ral/type/filesources.rb
@@ -20,7 +20,7 @@ class TestFileSources < Test::Unit::TestCase
end
@file = Puppet::Type.type(:file)
Puppet[:filetimeout] = -1
- Puppet::Util::SUIDManager.stubs(:asuser).yields
+ Puppet::Util::SUIDManager.stubs(:asuser).yields
Facter.stubs(:to_hash).returns({})
end
@@ -28,7 +28,7 @@ class TestFileSources < Test::Unit::TestCase
super
Puppet::Network::HttpPool.clear_http_instances
end
-
+
def use_storage
begin
initstorage
@@ -41,14 +41,14 @@ class TestFileSources < Test::Unit::TestCase
Puppet::Util::Storage.init
Puppet::Util::Storage.load
end
-
+
# Make a simple recursive tree.
def mk_sourcetree
source = tempfile()
sourcefile = File.join(source, "file")
Dir.mkdir source
File.open(sourcefile, "w") { |f| f.puts "yay" }
-
+
dest = tempfile()
destfile = File.join(dest, "file")
return source, dest, sourcefile, destfile
@@ -131,7 +131,7 @@ class TestFileSources < Test::Unit::TestCase
# and make sure they're still equal
assert_trees_equal(fromdir,todir)
-
+
# Now try it with the directory being read-only
File.chmod(0111, todir)
recursive_source_test(fromdir, todir)
@@ -144,7 +144,7 @@ class TestFileSources < Test::Unit::TestCase
fromdir, todir, one, two = run_complex_sources
assert(FileTest.exists?(todir))
-
+
# Modify a dest file
File.open(two, "w") { |f| f.puts "something else" }
@@ -199,7 +199,7 @@ class TestFileSources < Test::Unit::TestCase
:mode => 0755
)
}
-
+
assert_apply(rootobj)
assert_equal(0755, filemode(file1))
@@ -269,9 +269,9 @@ class TestFileSources < Test::Unit::TestCase
:name => name
)
- assert_raise Puppet::Error do
+ assert_raise Puppet::Error do
file.retrieve
- end
+ end
comp = mk_catalog(file)
comp.apply
@@ -299,7 +299,7 @@ class TestFileSources < Test::Unit::TestCase
currentvalue = file.retrieve
- assert(currentvalue[file.property(:checksum)],
+ assert(currentvalue[file.property(:checksum)],
"File does not have a checksum property")
assert_equal(0, file.evaluate.length, "File produced changes")
@@ -307,7 +307,7 @@ class TestFileSources < Test::Unit::TestCase
def test_sourcepaths
files = []
- 3.times {
+ 3.times {
files << tempfile()
}
@@ -489,7 +489,7 @@ class TestFileSources < Test::Unit::TestCase
assert(FileTest.exists?(file3), "File from source 1 was not copied")
assert_equal("0", File.read(file3), "file3 got wrong contents")
end
-
+
def test_recursive_sourceselect
dest = tempfile()
source1 = tempfile()
@@ -506,15 +506,15 @@ class TestFileSources < Test::Unit::TestCase
File.open(file, "w") { |f| f.puts "yaysecond-%s" % i}
files << file
end
-
+
obj = Puppet::Type.newfile(:path => dest, :source => [source1, source2], :sourceselect => :all, :recurse => true)
-
+
assert_apply(obj)
-
+
["file0", "file1", "second-file0", "second-file1", "subdir/file2", "subdir/second-file2", "subdir/file3", "subdir/second-file3"].each do |file|
path = File.join(dest, file)
assert(FileTest.exists?(path), "did not create %s" % file)
-
+
assert_equal("yay%s\n" % File.basename(file).sub("file", ''), File.read(path), "file was not copied correctly")
end
end
diff --git a/test/ral/type/group.rb b/test/ral/type/group.rb
index c6d6c5ee6..f1264116f 100755
--- a/test/ral/type/group.rb
+++ b/test/ral/type/group.rb
@@ -129,7 +129,7 @@ class TestGroup < Test::Unit::TestCase
current_values = gobj.retrieve
}
- assert(current_values[gobj.property(:gid)],
+ assert(current_values[gobj.property(:gid)],
"Failed to retrieve gid")
}
end
diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb
index 95f698157..ef5472030 100755
--- a/test/ral/type/host.rb
+++ b/test/ral/type/host.rb
@@ -112,7 +112,7 @@ class TestHost < Test::Unit::TestCase
assert_events([:host_created], host)
- current_values = nil
+ current_values = nil
assert_nothing_raised {
current_values = host.retrieve
}
@@ -128,13 +128,13 @@ class TestHost < Test::Unit::TestCase
current_values = host.retrieve
}
- assert_equal(%w{madstop kirby yayness},
+ assert_equal(%w{madstop kirby yayness},
current_values[host.property(:alias)])
-
+
host[:ensure] = :absent
assert_events([:host_removed], host)
end
-
+
def test_invalid_ipaddress
host = mkhost()
@@ -195,7 +195,7 @@ class TestHost < Test::Unit::TestCase
}
end
- end
+ end
def test_aliasisproperty
assert_equal(:property, @hosttype.attrtype(:alias))
end
diff --git a/test/ral/type/resources.rb b/test/ral/type/resources.rb
index 426e76b0e..8d9f09204 100755
--- a/test/ral/type/resources.rb
+++ b/test/ral/type/resources.rb
@@ -18,7 +18,7 @@ class TestResources < Test::Unit::TestCase
end
end
end
-
+
def mk_purger(managed = false)
@purgenum ||= 0
@purgenum += 1
@@ -62,35 +62,35 @@ class TestResources < Test::Unit::TestCase
def test_purge
# Create a purgeable type
mkpurgertype
-
+
purger = nil
assert_nothing_raised do
purger = @type.new :name => "purgetest", :noop => true, :loglevel => :warning
end
assert(purger, "did not get purger manager")
add_purge_lister()
-
+
assert_equal($purgemembers.values.sort, @purgetype.instances.sort)
-
+
# and it should now succeed
assert_nothing_raised do
purger[:purge] = true
end
assert(purger.purge?, "purge boolean was not enabled")
-
+
# Okay, now let's try doing some purging, yo
managed = []
unmanned = []
3.times { managed << mk_purger(true) } # 3 managed
3.times { unmanned << mk_purger(false) } # 3 unmanaged
-
+
managed.each do |m|
assert(m.managed?, "managed resource was not considered managed")
end
unmanned.each do |u|
assert(! u.managed?, "unmanaged resource was considered managed")
end
-
+
# First make sure we get nothing back when purge is false
genned = nil
purger[:purge] = false
@@ -98,7 +98,7 @@ class TestResources < Test::Unit::TestCase
genned = purger.generate
end
assert_equal([], genned, "Purged even when purge is false")
-
+
# Now make sure we can purge
purger[:purge] = true
assert_nothing_raised do
@@ -110,11 +110,11 @@ class TestResources < Test::Unit::TestCase
assert(res.purging, "did not mark resource for purging")
end
assert(! genned.empty?, "generated resource list was empty")
-
+
# Now make sure the generate method only finds the unmanaged resources
assert_equal(unmanned.collect { |r| r.title }.sort, genned.collect { |r| r.title },
"Did not return correct purge list")
-
+
# Now make sure our metaparams carried over
genned.each do |res|
[:noop, :loglevel].each do |param|
@@ -122,33 +122,33 @@ class TestResources < Test::Unit::TestCase
end
end
end
-
+
# Part of #408.
def test_check
# First check a non-user
res = Puppet::Type.type(:resources).new :name => :package
assert_nil(res[:unless_system_user], "got bad default for package")
-
-
+
+
assert_nothing_raised {
assert(res.check("A String"), "String failed check")
assert(res.check(Puppet::Type.type(:file).new(:path => tempfile())), "File failed check")
assert(res.check(Puppet::Type.type(:user).new(:name => "yayness")), "User failed check in package")
}
-
+
# Now create a user manager
res = Puppet::Type.type(:resources).new :name => :user
-
+
# Make sure the default is 500
assert_equal(500, res[:unless_system_user], "got bad default")
-
+
# Now make sure root fails the test
@user = Puppet::Type.type(:user)
assert_nothing_raised {
assert(! res.check(@user.create(:name => "root")), "root passed check")
assert(! res.check(@user.create(:name => "nobody")), "nobody passed check")
}
-
+
# Now find a user between 0 and the limit
low = high = nil
Etc.passwd { |entry|
@@ -163,7 +163,7 @@ class TestResources < Test::Unit::TestCase
end
end
}
-
+
if low
assert(! res.check(@user.create(:name => low)), "low user %s passed check" % low)
end
@@ -172,16 +172,16 @@ class TestResources < Test::Unit::TestCase
assert(res.check(@user.create(:name => high)), "high user %s failed check" % high)
end
end
-
+
# The other half of #408.
def test_check_is_called
res = Puppet::Type.type(:resources).new :name => :user, :purge => true
-
+
list = nil
assert_nothing_raised { list = res.generate }
-
+
assert(! list.empty?, "did not get any users")
-
+
bad = list.find_all { |u|
%w{root bin nobody}.include?(u[:name]) or (cv = u.retrieve and cv[u.property(:uid)] < 500)
}
diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb
index 981079e92..a3d7cb656 100755
--- a/test/ral/type/sshkey.rb
+++ b/test/ral/type/sshkey.rb
@@ -82,20 +82,20 @@ class TestSSHKey < Test::Unit::TestCase
key[:provider] = :parsed
assert_apply(key)
-
+
assert_events([], key, "created events on in-sync key")
-
+
assert(key.provider.exists?, "Key did not get created")
-
+
# Now create a new key object
name = key.name
key = nil
-
+
key = @sshkeytype.new :name => name, :target => file, :provider => :parsed
key.retrieve
-
+
assert(key.provider.exists?, "key thinks it does not exist")
-
+
end
def test_moddingkey
diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb
index 7cceef710..611201a64 100755
--- a/test/ral/type/user.rb
+++ b/test/ral/type/user.rb
@@ -345,7 +345,7 @@ class TestUser < Test::Unit::TestCase
)
comp = mk_catalog(user, group, home, ogroup)
}
-
+
rels = nil
assert_nothing_raised() { rels = user.autorequire }
@@ -401,12 +401,12 @@ class TestUser < Test::Unit::TestCase
user[:ensure] = :absent
assert_apply(user)
end
-
+
# Testing #455
def test_autorequire_with_no_group_should
user = Puppet::Type.type(:user).new(:name => "yaytest", :check => :all)
catalog = mk_catalog(user)
-
+
assert_nothing_raised do
user.autorequire
end
diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb
index f3221fb84..e1ac53820 100755
--- a/test/ral/type/yumrepo.rb
+++ b/test/ral/type/yumrepo.rb
@@ -67,7 +67,7 @@ class TestYumRepo < Test::Unit::TestCase
def test_absent
copy_datafiles
baseurl = 'http://example.com/'
- devel = make_repo("development",
+ devel = make_repo("development",
{ :mirrorlist => 'absent',
:baseurl => baseurl })
devel.retrieve
@@ -97,7 +97,7 @@ class TestYumRepo < Test::Unit::TestCase
FileUtils::copy(src, dst)
}
end
-
+
CREATE_EXP = <<'EOF'
[base]
name=Fedora Core $releasever - $basearch - Base
@@ -110,4 +110,4 @@ proxy_username=username
proxy_password=password
EOF
-end
+end
diff --git a/test/ral/type/zone.rb b/test/ral/type/zone.rb
index 59447d74b..a784b8bcf 100755
--- a/test/ral/type/zone.rb
+++ b/test/ral/type/zone.rb
@@ -344,7 +344,7 @@ end
currentvalues = zone.retrieve
- assert_equal(:absent, currentvalues[zone.property(:ensure)],
+ assert_equal(:absent, currentvalues[zone.property(:ensure)],
"Zone is not absent")
end
@@ -411,7 +411,7 @@ end
currentvalues = zone.retrieve
- assert_equal(:absent, currentvalues[zone.property(:ensure)],
+ assert_equal(:absent, currentvalues[zone.property(:ensure)],
"Zone is not absent")
end
end