diff options
| author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:39:04 -0400 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:12:00 +1000 |
| commit | 4f2c066a97e59a89df64af4b25beac6f3f0553c2 (patch) | |
| tree | 126540beec3c65448e01e1b48d27275ec4ee6ea4 /test/other | |
| parent | 97e6975d69f239e24993315a25a3117b1daa48c3 (diff) | |
| download | puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.gz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.xz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.zip | |
Removed extra whitespace from end of lines
Diffstat (limited to 'test/other')
| -rwxr-xr-x | test/other/dsl.rb | 2 | ||||
| -rwxr-xr-x | test/other/events.rb | 4 | ||||
| -rwxr-xr-x | test/other/puppet.rb | 2 | ||||
| -rwxr-xr-x | test/other/relationships.rb | 22 | ||||
| -rwxr-xr-x | test/other/report.rb | 28 | ||||
| -rwxr-xr-x | test/other/transactions.rb | 74 |
6 files changed, 66 insertions, 66 deletions
diff --git a/test/other/dsl.rb b/test/other/dsl.rb index 3ef21a372..deafca791 100755 --- a/test/other/dsl.rb +++ b/test/other/dsl.rb @@ -75,7 +75,7 @@ class TestDSL < Test::Unit::TestCase def test_evaluate parent = child = nil parenteval = childeval = nil - + assert_nothing_raised do parent = aspect :parent do if parenteval diff --git a/test/other/events.rb b/test/other/events.rb index a954cd7f6..052afc0c9 100755 --- a/test/other/events.rb +++ b/test/other/events.rb @@ -107,14 +107,14 @@ class TestEvents < Test::Unit::TestCase execs = [exec1, exec2, exec3] config = mk_catalog(exec1,exec2,exec3) - + trans = Puppet::Transaction.new(config) execs.each do |e| assert(config.vertex?(e), "%s is not in graph" % e.title) end trans.prepare execs.each do |e| assert(config.vertex?(e), "%s is not in relgraph" % e.title) end reverse = trans.relationship_graph.reversal execs.each do |e| assert(reverse.vertex?(e), "%s is not in reversed graph" % e.title) end - + config.apply assert(FileTest.exists?(file), "File does not exist") diff --git a/test/other/puppet.rb b/test/other/puppet.rb index 2dcd7e576..1839333e5 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -9,7 +9,7 @@ require 'puppettest' class TestPuppetModule < Test::Unit::TestCase include PuppetTest include SignalObserver - + def mkfakeclient Class.new(Puppet::Network::Client) do def initialize diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 976d6d894..b15ff5062 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -11,7 +11,7 @@ class TestRelationships < Test::Unit::TestCase super Puppet::Type.type(:exec) end - + def newfile assert_nothing_raised() { return Puppet::Type.type(:file).new( @@ -20,7 +20,7 @@ class TestRelationships < Test::Unit::TestCase ) } end - + def check_relationship(sources, targets, out, refresher) if out deps = sources.builddepends @@ -31,17 +31,17 @@ class TestRelationships < Test::Unit::TestCase end assert_instance_of(Array, deps) assert(! deps.empty?, "Did not receive any relationships") - + deps.each do |edge| assert_instance_of(Puppet::Relationship, edge) end - + sources.each do |source| targets.each do |target| edge = deps.find { |e| e.source == source and e.target == target } assert(edge, "Could not find edge for %s => %s" % [source.ref, target.ref]) - + if refresher assert_equal(:ALL_EVENTS, edge.event) assert_equal(:refresh, edge.callback) @@ -56,12 +56,12 @@ class TestRelationships < Test::Unit::TestCase def test_autorequire # We know that execs autorequire their cwd, so we'll use that path = tempfile() - + file = Puppet::Type.type(:file).new(:title => "myfile", :path => path, :ensure => :directory) exec = Puppet::Type.newexec(:title => "myexec", :cwd => path, :command => "/bin/echo") - + catalog = mk_catalog(file, exec) reqs = nil assert_nothing_raised do @@ -70,18 +70,18 @@ class TestRelationships < Test::Unit::TestCase assert_instance_of(Puppet::Relationship, reqs[0], "Did not return a relationship edge") assert_equal(file, reqs[0].source, "Did not set the autorequire source correctly") assert_equal(exec, reqs[0].target, "Did not set the autorequire target correctly") - - # Now make sure that these relationships are added to the + + # Now make sure that these relationships are added to the # relationship graph catalog.apply do |trans| assert(catalog.relationship_graph.edge?(file, exec), "autorequire edge was not created") end end - + # Testing #411. It was a problem with builddepends. def test_missing_deps file = Puppet::Type.type(:file).new :path => tempfile, :require => Puppet::Resource::Reference.new("file", "/no/such/file") - + assert_raise(Puppet::Error) do file.builddepends end diff --git a/test/other/report.rb b/test/other/report.rb index a77c48362..692ed54b6 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -80,7 +80,7 @@ class TestReports < Test::Unit::TestCase def test_store_report # Create a bunch of log messages in an array. report = Puppet::Transaction::Report.new - + # We have to reuse reporting here because of something going on in the # server/report.rb file Puppet.settings.use(:main, :puppetmasterd) @@ -143,31 +143,31 @@ class TestReports < Test::Unit::TestCase else $stderr.puts "Install RRD for metric reporting tests" end - + def test_tagmail_parsing report = Object.new report.extend(Puppet::Reports.report(:tagmail)) - + passers = File.join(datadir, "reports", "tagmail_passers.conf") assert(FileTest.exists?(passers), "no passers file %s" % passers) - + File.readlines(passers).each do |line| assert_nothing_raised("Could not parse %s" % line.inspect) do report.parse(line) end end - + # Now make sure the failers fail failers = File.join(datadir, "reports", "tagmail_failers.conf") assert(FileTest.exists?(failers), "no failers file %s" % failers) - + File.readlines(failers).each do |line| assert_raise(ArgumentError, "Parsed %s" % line.inspect) do report.parse(line) end end end - + def test_tagmail_parsing_results report = Object.new report.extend(Puppet::Reports.report(:tagmail)) @@ -179,27 +179,27 @@ class TestReports < Test::Unit::TestCase "tag, !other: abuse@domain.com" => [%w{abuse@domain.com}, %w{tag}, %w{other}], "tag, !other, one, !two: abuse@domain.com" => [%w{abuse@domain.com}, %w{tag one}, %w{other two}], "tag: abuse@domain.com, other@domain.com" => [%w{abuse@domain.com other@domain.com}, %w{tag}, []] - + }.each do |line, results| assert_nothing_raised("Failed to parse %s" % line.inspect) do assert_equal(results, report.parse(line).shift, "line %s returned incorrect results %s" % [line.inspect, results.inspect]) end end end - + def test_tagmail_matching report = Puppet::Transaction::Report.new Puppet::Util::Log.close [%w{one}, %w{one two}, %w{one two three}, %w{one two three four}].each do |tags| log = Puppet::Util::Log.new(:level => :notice, :message => tags.join(" "), :tags => tags) - + report << log end - + list = report.logs.collect { |l| l.to_report } - + report.extend(Puppet::Reports.report(:tagmail)) - + { [%w{abuse@domain.com}, %w{all}, []] => list, [%w{abuse@domain.com}, %w{all}, %w{three}] => list[0..1], @@ -212,7 +212,7 @@ class TestReports < Test::Unit::TestCase assert_nothing_raised("Could not match with %s" % args.inspect) do results = report.match([args]) end - + if expected assert_equal([args[0], expected.join("\n")], results[0], "did get correct results for %s" % args.inspect) else diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 8375145f9..6cb772d88 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -33,12 +33,12 @@ class TestTransactions < Test::Unit::TestCase def log(msg) end end - - + + def mkgenerator(&block) $finished = [] cleanup { $finished = nil } - + # Create a bogus type that generates new instances with shorter type = Puppet::Type.newtype(:generator) do newparam(:name, :namevar => true) @@ -52,10 +52,10 @@ class TestTransactions < Test::Unit::TestCase cleanup do Puppet::Type.rmtype(:generator) end - + return type end - + # Create a new type that generates instances with shorter names. def mkreducer(&block) type = mkgenerator() do @@ -69,11 +69,11 @@ class TestTransactions < Test::Unit::TestCase ret end end - + if block type.class_eval(&block) end - + return type end @@ -126,7 +126,7 @@ class TestTransactions < Test::Unit::TestCase type = Puppet::Type.newtype(name) do newparam(:name) {} end - + cleanup do Puppet::Type.rmtype(name) end @@ -140,7 +140,7 @@ class TestTransactions < Test::Unit::TestCase # Now create an instance inst = type.new :name => "yay" - + # Create a transaction trans = Puppet::Transaction.new(mk_catalog(inst)) @@ -545,17 +545,17 @@ class TestTransactions < Test::Unit::TestCase config = mk_catalog(yay, rah) trans = Puppet::Transaction.new(config) - + assert_nothing_raised do trans.generate end - + %w{ya ra y r}.each do |name| assert(trans.catalog.vertex?(Puppet::Type.type(:generator)[name]), "Generated %s was not a vertex" % name) assert($finished.include?(name), "%s was not finished" % name) end - + # Now make sure that cleanup gets rid of those generated types. assert_nothing_raised do trans.cleanup @@ -572,7 +572,7 @@ class TestTransactions < Test::Unit::TestCase transaction = Puppet::Transaction.new(config) assert(transaction.ignore_tags?, "Not ignoring tags when applying a non-host catalog") end - + def test_missing_tags? resource = stub 'resource', :tagged? => true config = Puppet::Resource::Catalog.new @@ -588,7 +588,7 @@ class TestTransactions < Test::Unit::TestCase transaction = Puppet::Transaction.new(config) assert(! transaction.missing_tags?(resource), "Considered a resource to be missing tags when not running a host catalog") - # + # config.host_config = true transaction = Puppet::Transaction.new(config) assert(! transaction.missing_tags?(resource), "Considered a resource to be missing tags when running a host catalog and all tags are present") @@ -597,7 +597,7 @@ class TestTransactions < Test::Unit::TestCase resource.stubs :tagged? => false assert(transaction.missing_tags?(resource), "Considered a resource not to be missing tags when running a host catalog and tags are missing") end - + # Make sure changes generated by eval_generated resources have proxies # set to the top-level resource. def test_proxy_resources @@ -607,7 +607,7 @@ class TestTransactions < Test::Unit::TestCase :path => :path, :is => "start_value", :should => "desired_value", :name => self.name, :resource => "fake_parent"), :is) end end - + resource = type.new :name => "test" config = mk_catalog(resource) trans = Puppet::Transaction.new(config) @@ -618,14 +618,14 @@ class TestTransactions < Test::Unit::TestCase end changes = trans.instance_variable_get("@changes") - + assert(changes.length > 0, "did not get any changes") - + changes.each do |change| assert_equal(resource.object_id, change.resource.object_id, "change did not get proxy set correctly") end end - + # Make sure changes in contained files still generate callback events. def test_generated_callbacks dir = tempfile() @@ -635,12 +635,12 @@ class TestTransactions < Test::Unit::TestCase File.open(file, "w") { |f| f.puts "" } File.chmod(0644, file) File.chmod(0755, dir) # So only the child file causes a change - + dirobj = Puppet::Type.type(:file).new :mode => "755", :recurse => true, :path => dir exec = Puppet::Type.type(:exec).new :title => "make", :command => "touch #{maker}", :path => ENV['PATH'], :refreshonly => true, :subscribe => dirobj - + assert_apply(dirobj, exec) assert(FileTest.exists?(maker), "Did not make callback file") end @@ -719,29 +719,29 @@ class TestTransactions < Test::Unit::TestCase assert(trans.triggered?(c, :refresh), "Transaction did not store the trigger") end - + def test_set_target file = Puppet::Type.type(:file).new(:path => tempfile(), :content => "yay") exec1 = Puppet::Type.type(:exec).new :command => "/bin/echo exec1" exec2 = Puppet::Type.type(:exec).new :command => "/bin/echo exec2" trans = Puppet::Transaction.new(mk_catalog(file, exec1, exec2)) - + # First try it with an edge that has no callback edge = Puppet::Relationship.new(file, exec1) assert_nothing_raised { trans.set_trigger(edge) } assert(! trans.targeted?(exec1), "edge with no callback resulted in a target") - + # Now with an edge that has an unsupported callback edge = Puppet::Relationship.new(file, exec1, :callback => :nosuchmethod, :event => :ALL_EVENTS) assert_nothing_raised { trans.set_trigger(edge) } assert(! trans.targeted?(exec1), "edge with invalid callback resulted in a target") - + # Lastly, with an edge with a supported callback edge = Puppet::Relationship.new(file, exec1, :callback => :refresh, :event => :ALL_EVENTS) assert_nothing_raised { trans.set_trigger(edge) } assert(trans.targeted?(exec1), "edge with valid callback did not result in a target") end - + # Testing #401 -- transactions are calling refresh() on classes that don't support it. def test_callback_availability $called = [] @@ -758,9 +758,9 @@ class TestTransactions < Test::Unit::TestCase file = Puppet::Type.type(:file).new :path => tempfile(), :content => "yay" one = klass.new :name => "one", :subscribe => file - + assert_apply(file, one) - + assert(! $called.include?(:refresh), "Called refresh when it wasn't set as a method") end @@ -794,7 +794,7 @@ class TestTransactions < Test::Unit::TestCase assert_apply(obj) end - + def test_self_refresh_causes_triggering type = Puppet::Type.newtype(:refresher, :self_refresh => true) do attr_accessor :refreshed, :testing @@ -814,16 +814,16 @@ class TestTransactions < Test::Unit::TestCase end end cleanup { Puppet::Type.rmtype(:refresher)} - + obj = type.new(:name => "yay", :testing => "cool") - + assert(! obj.insync?(obj.retrieve), "fake object is already in sync") - + # Now make sure it gets refreshed when the change happens assert_apply(obj) assert(obj.refreshed, "object was not refreshed during transaction") end - + # Testing #433 def test_explicit_dependencies_beat_automatic # Create a couple of different resource sets that have automatic relationships and make sure the manual relationships win @@ -831,7 +831,7 @@ class TestTransactions < Test::Unit::TestCase # First users and groups group = Puppet::Type.type(:group).new(:name => nonrootgroup.name, :ensure => :present) user = Puppet::Type.type(:user).new(:name => nonrootuser.name, :ensure => :present, :gid => group.title) - + # Now add the explicit relationship group[:require] = user rels[group] = user @@ -840,17 +840,17 @@ class TestTransactions < Test::Unit::TestCase f = File.join(d, "file") file = Puppet::Type.type(:file).new(:path => f, :content => "yay") dir = Puppet::Type.type(:file).new(:path => d, :ensure => :directory, :require => file) - + rels[dir] = file rels.each do |after, before| config = mk_catalog(before, after) trans = Puppet::Transaction.new(config) str = "from %s to %s" % [before, after] - + assert_nothing_raised("Failed to create graph %s" % str) do trans.prepare end - + graph = trans.relationship_graph assert(graph.edge?(before, after), "did not create manual relationship %s" % str) assert(! graph.edge?(after, before), "created automatic relationship %s" % str) |
