diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-16 04:14:32 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-09-16 04:14:32 +0000 |
| commit | ac0454a4bfcf6e9ecd3f3eb6037f04caa3c3ce59 (patch) | |
| tree | 200749a544b99507b6d6ff0347df03aaa7cf82db /test | |
| parent | f7116e58714d9c66409acfc836ba271957b1b2af (diff) | |
| download | puppet-ac0454a4bfcf6e9ecd3f3eb6037f04caa3c3ce59.tar.gz puppet-ac0454a4bfcf6e9ecd3f3eb6037f04caa3c3ce59.tar.xz puppet-ac0454a4bfcf6e9ecd3f3eb6037f04caa3c3ce59.zip | |
making "Type.new" private, and switching to "Type.create", so that i can merge new objects with existing objects and such; converted all files, and tested them
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@674 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/other/tc_events.rb | 18 | ||||
| -rwxr-xr-x | test/other/tc_relationships.rb | 4 | ||||
| -rw-r--r-- | test/other/tc_state.rb | 2 | ||||
| -rw-r--r-- | test/other/tc_transactions.rb | 6 | ||||
| -rw-r--r-- | test/puppettest.rb | 2 | ||||
| -rw-r--r-- | test/server/tc_server.rb | 44 | ||||
| -rw-r--r-- | test/types/tc_basic.rb | 6 | ||||
| -rwxr-xr-x | test/types/tc_component.rb | 24 | ||||
| -rwxr-xr-x | test/types/tc_cron.rb | 26 | ||||
| -rwxr-xr-x | test/types/tc_exec.rb | 30 | ||||
| -rw-r--r-- | test/types/tc_file.rb | 22 | ||||
| -rwxr-xr-x | test/types/tc_filebucket.rb | 4 | ||||
| -rw-r--r-- | test/types/tc_fileignoresource.rb | 8 | ||||
| -rwxr-xr-x | test/types/tc_filesources.rb | 14 | ||||
| -rw-r--r-- | test/types/tc_filetype.rb | 4 | ||||
| -rwxr-xr-x | test/types/tc_group.rb | 4 | ||||
| -rw-r--r-- | test/types/tc_package.rb | 6 | ||||
| -rw-r--r-- | test/types/tc_query.rb | 6 | ||||
| -rw-r--r-- | test/types/tc_service.rb | 4 | ||||
| -rwxr-xr-x | test/types/tc_symlink.rb | 2 | ||||
| -rwxr-xr-x | test/types/tc_tidy.rb | 4 | ||||
| -rw-r--r-- | test/types/tc_type.rb | 6 | ||||
| -rwxr-xr-x | test/types/tc_user.rb | 2 |
23 files changed, 113 insertions, 135 deletions
diff --git a/test/other/tc_events.rb b/test/other/tc_events.rb index b09436b55..5f3ddcd67 100755 --- a/test/other/tc_events.rb +++ b/test/other/tc_events.rb @@ -17,11 +17,11 @@ class TestEvents < TestPuppet end def test_simplesubscribe - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => "/tmp/eventtestingA", :create => true ) - exec = Puppet::Type::Exec.new( + exec = Puppet::Type::Exec.create( :name => "echo true", :path => "/usr/bin:/bin", :refreshonly => true, @@ -30,7 +30,7 @@ class TestEvents < TestPuppet @@tmpfiles << "/tmp/eventtestingA" - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "eventtesting" ) comp.push exec @@ -46,11 +46,11 @@ class TestEvents < TestPuppet end def test_simplerequire - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => "/tmp/eventtestingA", :create => true ) - exec = Puppet::Type::Exec.new( + exec = Puppet::Type::Exec.create( :name => "echo true", :path => "/usr/bin:/bin", :refreshonly => true, @@ -59,7 +59,7 @@ class TestEvents < TestPuppet @@tmpfiles << "/tmp/eventtestingA" - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "eventtesting" ) comp.push exec @@ -82,13 +82,13 @@ class TestEvents < TestPuppet case l when :a name = "/tmp/eventtesting%s" % l - objects[l] = Puppet::Type::PFile.new( + objects[l] = Puppet::Type::PFile.create( :name => name, :create => true ) @@tmpfiles << name when :b - objects[l] = Puppet::Type::Exec.new( + objects[l] = Puppet::Type::Exec.create( :name => "touch %s" % fname, :path => "/usr/bin:/bin", :refreshonly => true @@ -97,7 +97,7 @@ class TestEvents < TestPuppet end - comps[l] = Puppet::Type::Component.new( + comps[l] = Puppet::Type::Component.create( :name => "eventtesting%s" % l ) diff --git a/test/other/tc_relationships.rb b/test/other/tc_relationships.rb index 9b3270cfe..44960b569 100755 --- a/test/other/tc_relationships.rb +++ b/test/other/tc_relationships.rb @@ -32,7 +32,7 @@ class TestRelationships < Test::Unit::TestCase assert_nothing_raised() { cfile = File.join($puppetbase,"examples/root/etc/configfile") unless Puppet::Type::PFile.has_key?(cfile) - Puppet::Type::PFile.new( + Puppet::Type::PFile.create( :path => cfile, :check => [:mode, :owner, :group] ) @@ -44,7 +44,7 @@ class TestRelationships < Test::Unit::TestCase def newservice assert_nothing_raised() { unless Puppet::Type::Service.has_key?("sleeper") - Puppet::Type::Service.new( + Puppet::Type::Service.create( :name => "sleeper", :path => File.join($puppetbase,"examples/root/etc/init.d"), :check => [:running] diff --git a/test/other/tc_state.rb b/test/other/tc_state.rb index 9b2b4c575..6bbe76277 100644 --- a/test/other/tc_state.rb +++ b/test/other/tc_state.rb @@ -68,7 +68,7 @@ class TestStorage < TestPuppet file = nil state = nil assert_nothing_raised { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => "/etc/passwd" ) } diff --git a/test/other/tc_transactions.rb b/test/other/tc_transactions.rb index 9a8523883..946d53279 100644 --- a/test/other/tc_transactions.rb +++ b/test/other/tc_transactions.rb @@ -65,13 +65,13 @@ class TestTransactions < FileTesting @@tmpfiles.push tmpfile hash[:name] = tmpfile assert_nothing_raised() { - return Puppet::Type::PFile.new(hash) + return Puppet::Type::PFile.create(hash) } end def newservice assert_nothing_raised() { - return Puppet::Type::Service.new( + return Puppet::Type::Service.create( :name => "sleeper", :path => File.join($puppetbase,"examples/root/etc/init.d"), :check => [:running] @@ -81,7 +81,7 @@ class TestTransactions < FileTesting def newexec(file) assert_nothing_raised() { - return Puppet::Type::Exec.new( + return Puppet::Type::Exec.create( :name => "touch %s" % file, :path => "/bin:/usr/bin:/sbin:/usr/sbin", :returns => 0 diff --git a/test/puppettest.rb b/test/puppettest.rb index fe00ee2ce..23d940d08 100644 --- a/test/puppettest.rb +++ b/test/puppettest.rb @@ -8,7 +8,7 @@ end class TestPuppet < Test::Unit::TestCase def newcomp(name,*ary) - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => name ) ary.each { |item| comp.push item } diff --git a/test/server/tc_server.rb b/test/server/tc_server.rb index 988a1e17a..b0afc6398 100644 --- a/test/server/tc_server.rb +++ b/test/server/tc_server.rb @@ -27,50 +27,6 @@ class TestServer < ServerTest print "\n\n\n\n" if Puppet[:debug] end - # just do a simple start test - def test_start - Puppet[:autosign] = true - server = nil - # make a test manifest - file = mktestmanifest() - - # create a simple server - # we can use threading here because we're not talking to the server, - # just starting and stopping it - assert_nothing_raised() { - server = Puppet::Server.new( - :Port => @@port, - :Handlers => { - :CA => {}, # so that certs autogenerate - :Master => { - :File => file, - }, - :Status => nil - } - ) - - } - - # start it - sthread = nil - assert_nothing_raised() { - trap(:INT) { server.shutdown } - sthread = Thread.new { - server.start - } - } - - # and stop it - assert_nothing_raised { - server.shutdown - } - - # and then wait - assert_nothing_raised { - sthread.join - } - end - # test that we can connect to the server # we have to use fork here, because we apparently can't use threads # to talk to other threads diff --git a/test/types/tc_basic.rb b/test/types/tc_basic.rb index 6910485ae..585caaa95 100644 --- a/test/types/tc_basic.rb +++ b/test/types/tc_basic.rb @@ -21,7 +21,7 @@ class TestBasic < Test::Unit::TestCase Puppet[:loglevel] = :debug if __FILE__ == $0 assert_nothing_raised() { - @component = Puppet::Type::Component.new( + @component = Puppet::Type::Component.create( :name => "yaytest", :type => "testing" ) @@ -30,14 +30,14 @@ class TestBasic < Test::Unit::TestCase assert_nothing_raised() { @filepath = "/tmp/testfile" system("rm -f %s" % @filepath) - @configfile = Puppet::Type::PFile.new( + @configfile = Puppet::Type::PFile.create( :path => @filepath, :create => true, :checksum => "md5" ) } assert_nothing_raised() { - @sleeper = Puppet::Type::Service.new( + @sleeper = Puppet::Type::Service.create( :name => "sleeper", :path => File.join($puppetbase,"examples/root/etc/init.d"), :running => 1 diff --git a/test/types/tc_component.rb b/test/types/tc_component.rb index 5fcee859c..8cf3ece4b 100755 --- a/test/types/tc_component.rb +++ b/test/types/tc_component.rb @@ -48,7 +48,7 @@ class TestComponent < TestPuppet end name = "/tmp/componentrandfile" + num.to_s - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => name, :checksum => "md5" ) @@ -57,7 +57,7 @@ class TestComponent < TestPuppet end def mkcomp - Puppet::Type::Component.new(:name => "component_" + randnum(1000).to_s) + Puppet::Type::Component.create(:name => "component_" + randnum(1000).to_s) end def mkrandcomp(numfiles, numdivs) @@ -120,12 +120,12 @@ class TestComponent < TestPuppet File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| of.puts rand(100) } - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => tmpfile, :checksum => "md5" ) assert_nothing_raised { - cmd = Puppet::Type::Exec.new( + cmd = Puppet::Type::Exec.create( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :subscribe => [[file.class.name,file.name]], @@ -151,12 +151,12 @@ class TestComponent < TestPuppet File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| of.puts rand(100) } - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => tmpfile, :checksum => "md5" ) assert_nothing_raised { - cmd = Puppet::Type::Exec.new( + cmd = Puppet::Type::Exec.create( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :subscribe => [[file.class.name,file.name]], @@ -164,7 +164,7 @@ class TestComponent < TestPuppet ) } - comp = Puppet::Type::Component.new(:name => "RefreshTest") + comp = Puppet::Type::Component.create(:name => "RefreshTest") [cmd, file].each { |obj| comp.push obj } @@ -189,12 +189,12 @@ class TestComponent < TestPuppet File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| of.puts rand(100) } - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => tmpfile, :checksum => "md5" ) assert_nothing_raised { - cmd = Puppet::Type::Exec.new( + cmd = Puppet::Type::Exec.create( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :refreshonly => true @@ -230,12 +230,12 @@ class TestComponent < TestPuppet File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| of.puts rand(100) } - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => tmpfile, :checksum => "md5" ) assert_nothing_raised { - cmd = Puppet::Type::Exec.new( + cmd = Puppet::Type::Exec.create( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :refreshonly => true @@ -244,7 +244,7 @@ class TestComponent < TestPuppet ocmd = nil assert_nothing_raised { - ocmd = Puppet::Type::Exec.new( + ocmd = Puppet::Type::Exec.create( :command => "echo true", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :refreshonly => true diff --git a/test/types/tc_cron.rb b/test/types/tc_cron.rb index 6c6218a83..d35d873f3 100755 --- a/test/types/tc_cron.rb +++ b/test/types/tc_cron.rb @@ -14,8 +14,15 @@ require 'facter' class TestExec < TestPuppet def setup - @me = %x{whoami}.chomp - assert(@me != "", "Could not retrieve user name") + id = %x{id}.chomp + if id =~ /uid=\d+\(([^\)]+)\)/ + @me = $1 + else + puts id + end + unless defined? @me + raise "Could not retrieve user name; 'id' did not work" + end super end @@ -24,4 +31,19 @@ class TestExec < TestPuppet Puppet::Type::Cron.retrieve(@me) } end + + def test_mkcron + cron = nil + assert_nothing_raised { + cron = Puppet::Type::Cron.create( + :command => "date > %s/crontest" % tmpdir(), + :name => "testcron", + :user => @me + ) + } + + comp = newcomp("crontest", cron) + + trans = assert_events(comp, [:cron_created], "crontest") + end end diff --git a/test/types/tc_exec.rb b/test/types/tc_exec.rb index f2a8775b8..7e1f5f161 100755 --- a/test/types/tc_exec.rb +++ b/test/types/tc_exec.rb @@ -16,7 +16,7 @@ class TestExec < TestPuppet command = nil output = nil assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "/bin/echo" ) } @@ -33,7 +33,7 @@ class TestExec < TestPuppet command = nil output = nil assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "/bin/echo", :returns => 0 ) @@ -46,7 +46,7 @@ class TestExec < TestPuppet } Puppet::Type::Exec.clear assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "/bin/echo", :returns => "0" ) @@ -63,26 +63,26 @@ class TestExec < TestPuppet command = nil output = nil assert_raise(TypeError) { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "echo" ) } Puppet::Type::Exec.clear assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "echo", :path => "/usr/bin:/bin:/usr/sbin:/sbin" ) } Puppet::Type::Exec.clear assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "/bin/echo" ) } Puppet::Type::Exec.clear assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "/bin/echo", :path => "/usr/bin:/bin:/usr/sbin:/sbin" ) @@ -91,21 +91,21 @@ class TestExec < TestPuppet def test_nonzero_returns assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "mkdir /this/directory/does/not/exist", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "touch /etc", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 1 ) } assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "thiscommanddoesnotexist", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :returns => 127 @@ -120,7 +120,7 @@ class TestExec < TestPuppet Dir.getwd } assert_nothing_raised { - command = Puppet::Type::Exec.new( + command = Puppet::Type::Exec.create( :command => "pwd", :cwd => dir, :path => "/usr/bin:/bin:/usr/sbin:/sbin", @@ -145,12 +145,12 @@ class TestExec < TestPuppet File.open(tmpfile, File::WRONLY|File::CREAT|File::TRUNC) { |of| of.puts rand(100) } - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => tmpfile, :checksum => "md5" ) assert_nothing_raised { - cmd = Puppet::Type::Exec.new( + cmd = Puppet::Type::Exec.create( :command => "pwd", :path => "/usr/bin:/bin:/usr/sbin:/sbin", :subscribe => [[file.class.name,file.name]], @@ -158,7 +158,7 @@ class TestExec < TestPuppet ) } - comp = Puppet::Type::Component.new(:name => "RefreshTest") + comp = Puppet::Type::Component.create(:name => "RefreshTest") [file,cmd].each { |obj| comp.push obj } @@ -197,7 +197,7 @@ class TestExec < TestPuppet file = tempfile() exec = nil assert_nothing_raised { - exec = Puppet::Type::Exec.new( + exec = Puppet::Type::Exec.create( :command => "touch %s" % file, :path => "/usr/bin:/bin:/usr/sbin:/sbin", :creates => file diff --git a/test/types/tc_file.rb b/test/types/tc_file.rb index 303865f3f..169b32995 100644 --- a/test/types/tc_file.rb +++ b/test/types/tc_file.rb @@ -19,7 +19,7 @@ class TestFile < FileTesting def mkfile(hash) file = nil assert_nothing_raised { - file = Puppet::Type::PFile.new(hash) + file = Puppet::Type::PFile.create(hash) } return file end @@ -173,7 +173,7 @@ class TestFile < FileTesting %w{a b c d}.collect { |name| "/tmp/createst%s" % name }.each { |path| file =nil assert_nothing_raised() { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => path, :create => true ) @@ -197,7 +197,7 @@ class TestFile < FileTesting %w{a b c d}.collect { |name| "/tmp/createst%s" % name }.each { |path| file = nil assert_nothing_raised() { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => path, :create => "directory" ) @@ -264,13 +264,13 @@ class TestFile < FileTesting events = nil # okay, we now know that we have a file... assert_nothing_raised() { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => path, :create => true, :checksum => type ) } - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "componentfile" ) comp.push file @@ -304,12 +304,12 @@ class TestFile < FileTesting # now recreate the file assert_nothing_raised() { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => path, :checksum => type ) } - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "componentfile" ) comp.push file @@ -345,13 +345,13 @@ class TestFile < FileTesting initstorage assert_nothing_raised { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( param => path, :recurse => true, :checksum => "md5" ) } - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "component" ) comp.push file @@ -424,7 +424,7 @@ class TestFile < FileTesting Puppet.err tmpdir() assert_nothing_raised { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => tmpdir(), :check => :type ) @@ -437,7 +437,7 @@ class TestFile < FileTesting assert_equal("directory", file.state(:type).is) assert_nothing_raised { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => "/etc/passwd", :check => :type ) diff --git a/test/types/tc_filebucket.rb b/test/types/tc_filebucket.rb index 48cb9fd17..6c57c8dab 100755 --- a/test/types/tc_filebucket.rb +++ b/test/types/tc_filebucket.rb @@ -18,7 +18,7 @@ class TestFileBucket < FileTesting def mkfile(hash) file = nil assert_nothing_raised { - file = Puppet::Type::PFile.new(hash) + file = Puppet::Type::PFile.create(hash) } return file end @@ -26,7 +26,7 @@ class TestFileBucket < FileTesting def mkbucket(name,path) bucket = nil assert_nothing_raised { - bucket = Puppet::Type::PFileBucket.new( + bucket = Puppet::Type::PFileBucket.create( :name => name, :path => path ) diff --git a/test/types/tc_fileignoresource.rb b/test/types/tc_fileignoresource.rb index 72d4ddb2b..2029b763f 100644 --- a/test/types/tc_fileignoresource.rb +++ b/test/types/tc_fileignoresource.rb @@ -74,7 +74,7 @@ class TestFileIgnoreSources < FileTesting #makes Puppet file Object assert_nothing_raised { - tofile = Puppet::Type::PFile.new( + tofile = Puppet::Type::PFile.create( :name => topath, :source => frompath, :recurse => true, @@ -83,7 +83,7 @@ class TestFileIgnoreSources < FileTesting } #make a component and adds the file - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "component" ) comp.push tofile @@ -154,7 +154,7 @@ class TestFileIgnoreSources < FileTesting #makes Puppet file Object assert_nothing_raised { - tofile = Puppet::Type::PFile.new( + tofile = Puppet::Type::PFile.create( :name => topath, :source => frompath, :recurse => true, @@ -163,7 +163,7 @@ class TestFileIgnoreSources < FileTesting } #make a component and adds the file - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "component" ) comp.push tofile diff --git a/test/types/tc_filesources.rb b/test/types/tc_filesources.rb index 1045cfc09..c4a35682c 100755 --- a/test/types/tc_filesources.rb +++ b/test/types/tc_filesources.rb @@ -19,7 +19,7 @@ class TestFileSources < FileTesting def mkfile(hash) file = nil assert_nothing_raised { - file = Puppet::Type::PFile.new(hash) + file = Puppet::Type::PFile.create(hash) } return file end @@ -69,7 +69,7 @@ class TestFileSources < FileTesting comp = nil trans = nil assert_nothing_raised { - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :name => path ) } @@ -101,12 +101,12 @@ class TestFileSources < FileTesting of.puts "yayness" } assert_nothing_raised { - tofile = Puppet::Type::PFile.new( + tofile = Puppet::Type::PFile.create( :name => topath, :source => frompath ) } - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "component" ) comp.push tofile @@ -133,14 +133,14 @@ class TestFileSources < FileTesting trans = nil assert_nothing_raised { - tofile = Puppet::Type::PFile.new( + tofile = Puppet::Type::PFile.create( :name => todir, "recurse" => true, "backup" => false, "source" => fromdir ) } - comp = Puppet::Type::Component.new( + comp = Puppet::Type::Component.create( :name => "component" ) comp.push tofile @@ -260,7 +260,7 @@ class TestFileSources < FileTesting File.open(file1, "w") { |f| 3.times { f.print rand(100) } } rootobj = nil assert_nothing_raised { - rootobj = Puppet::Type::PFile.new( + rootobj = Puppet::Type::PFile.create( :name => basedir, :recurse => true, :check => %w{type owner} diff --git a/test/types/tc_filetype.rb b/test/types/tc_filetype.rb index 521a4bbb5..c6749ba3d 100644 --- a/test/types/tc_filetype.rb +++ b/test/types/tc_filetype.rb @@ -19,7 +19,7 @@ class TestFileType @passwdtype = Puppet::Type::FileType["passwd"] if @passwdtype.nil? assert_nothing_raised() { - @passwdtype = Puppet::Type::FileType.newtype( + @passwdtype = Puppet::Type::FileType.createtype( :name => "passwd" ) @passwdtype.addrecord( @@ -33,7 +33,7 @@ class TestFileType @syslogtype = Puppet::Type::FileType["syslog"] if @syslogtype.nil? assert_nothing_raised() { - @syslogtype = Puppet::Type::FileType.newtype( + @syslogtype = Puppet::Type::FileType.createtype( :escapednewlines => true, :name => "syslog" ) diff --git a/test/types/tc_group.rb b/test/types/tc_group.rb index a53c49bfb..afbd91cc1 100755 --- a/test/types/tc_group.rb +++ b/test/types/tc_group.rb @@ -171,7 +171,7 @@ class TestGroup < TestPuppet gobj = nil comp = nil assert_nothing_raised { - gobj = Puppet::Type::Group.new( + gobj = Puppet::Type::Group.create( :name => group, :check => [:gid] ) @@ -210,7 +210,7 @@ class TestGroup < TestPuppet assert(missing?(name), "Group %s is still present" % name) assert_nothing_raised { - gobj = Puppet::Type::Group.new( + gobj = Puppet::Type::Group.create( :name => name ) diff --git a/test/types/tc_package.rb b/test/types/tc_package.rb index d4c3f2b12..2437b64f9 100644 --- a/test/types/tc_package.rb +++ b/test/types/tc_package.rb @@ -49,7 +49,7 @@ class TestPackages < FileTesting def mkpkgcomp(pkg) assert_nothing_raised { - pkg = Puppet::Type::Package.new(:name => pkg, :install => true) + pkg = Puppet::Type::Package.create(:name => pkg, :install => true) } assert_nothing_raised { pkg.retrieve @@ -104,7 +104,7 @@ class TestPackages < FileTesting obj = nil assert_nothing_raised { - obj = Puppet::Type::Package.new( + obj = Puppet::Type::Package.create( :name => pkg ) } @@ -139,7 +139,7 @@ class TestPackages < FileTesting pkgs.each { |pkg| assert_nothing_raised { - pkg = Puppet::Type::Package.new(:name => pkg, :install => true) + pkg = Puppet::Type::Package.create(:name => pkg, :install => true) } assert_nothing_raised { pkg.retrieve diff --git a/test/types/tc_query.rb b/test/types/tc_query.rb index 52d641e4c..5ba0e0c64 100644 --- a/test/types/tc_query.rb +++ b/test/types/tc_query.rb @@ -27,7 +27,7 @@ class TestQuery < Test::Unit::TestCase assert_nothing_raised() { cfile = File.join($puppetbase,"examples/root/etc/configfile") unless Puppet::Type::PFile.has_key?(cfile) - Puppet::Type::PFile.new( + Puppet::Type::PFile.create( :path => cfile, :check => [:mode, :owner, :checksum] ) @@ -40,7 +40,7 @@ class TestQuery < Test::Unit::TestCase def service assert_nothing_raised() { unless Puppet::Type::Service.has_key?("sleeper") - Puppet::Type::Service.new( + Puppet::Type::Service.create( :name => "sleeper", :path => File.join($puppetbase,"examples/root/etc/init.d"), :check => [:running] @@ -54,7 +54,7 @@ class TestQuery < Test::Unit::TestCase def component(name,*args) assert_nothing_raised() { - @component = Puppet::Type::Component.new(:name => name) + @component = Puppet::Type::Component.create(:name => name) } args.each { |arg| diff --git a/test/types/tc_service.rb b/test/types/tc_service.rb index 4bbc37594..a1633aec7 100644 --- a/test/types/tc_service.rb +++ b/test/types/tc_service.rb @@ -21,7 +21,7 @@ class TestService < Test::Unit::TestCase Puppet[:loglevel] = :debug if __FILE__ == $0 assert_nothing_raised() { unless Puppet::Type::Service.has_key?("sleeper") - Puppet::Type::Service.new( + Puppet::Type::Service.create( :name => "sleeper", :path => File.join($puppetbase,"examples/root/etc/init.d"), :running => 1 @@ -79,7 +79,7 @@ class TestService < Test::Unit::TestCase def testFailOnNoPath assert_raise(Puppet::Error) { - Puppet::Type::Service.new( + Puppet::Type::Service.create( :name => "sleeper" ) } diff --git a/test/types/tc_symlink.rb b/test/types/tc_symlink.rb index e11c595c3..9c09d2505 100755 --- a/test/types/tc_symlink.rb +++ b/test/types/tc_symlink.rb @@ -40,7 +40,7 @@ class TestSymlink < FileTesting unless hash.include?(:target) hash[:target] = mktmpfile() end - link = Puppet::Type::Symlink.new(hash) + link = Puppet::Type::Symlink.create(hash) return link end diff --git a/test/types/tc_tidy.rb b/test/types/tc_tidy.rb index f41972307..676d866dc 100755 --- a/test/types/tc_tidy.rb +++ b/test/types/tc_tidy.rb @@ -36,7 +36,7 @@ class TestTidy < FileTesting f.puts rand(100) } - tidy = Puppet::Type::Tidy.new( + tidy = Puppet::Type::Tidy.create( :name => dir, :size => "1b", :recurse => true @@ -66,7 +66,7 @@ class TestTidy < FileTesting f.puts rand(100) } - tidy = Puppet::Type::Tidy.new( + tidy = Puppet::Type::Tidy.create( :name => dir, :size => "1b", :age => "1s", diff --git a/test/types/tc_type.rb b/test/types/tc_type.rb index 1cc7669e0..56eb7071b 100644 --- a/test/types/tc_type.rb +++ b/test/types/tc_type.rb @@ -53,7 +53,7 @@ class TestType < TestPuppet path = "/tmp/testfile" assert_nothing_raised() { system("rm -f %s" % path) - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( :path => path, :create => true, :recurse => true, @@ -69,7 +69,7 @@ class TestType < TestPuppet Puppet::Type::PFile.clear assert_nothing_raised() { system("rm -f %s" % path) - file = Puppet::Type::PFile.new( + file = Puppet::Type::PFile.create( "path" => path, "create" => true, "recurse" => true, @@ -100,7 +100,7 @@ class TestType < TestPuppet # currently groups are the only objects with the namevar as a state group = nil assert_nothing_raised { - group = Puppet::Type::Group.new( + group = Puppet::Type::Group.create( :name => "testing" ) } diff --git a/test/types/tc_user.rb b/test/types/tc_user.rb index a70e55ce6..0e0072b96 100755 --- a/test/types/tc_user.rb +++ b/test/types/tc_user.rb @@ -261,7 +261,7 @@ class TestUser < TestPuppet } assert_nothing_raised { - user = Puppet::Type::User.new( + user = Puppet::Type::User.create( :name => name, :comment => "Puppet Testing User" ) |
