summaryrefslogtreecommitdiffstats
path: root/test/util
diff options
context:
space:
mode:
Diffstat (limited to 'test/util')
-rwxr-xr-xtest/util/filetype.rb4
-rwxr-xr-xtest/util/log.rb2
-rwxr-xr-xtest/util/metrics.rb2
-rwxr-xr-xtest/util/settings.rb167
-rwxr-xr-xtest/util/storage.rb4
-rwxr-xr-xtest/util/utiltest.rb19
6 files changed, 7 insertions, 191 deletions
diff --git a/test/util/filetype.rb b/test/util/filetype.rb
index 6c7ede07b..24a968552 100755
--- a/test/util/filetype.rb
+++ b/test/util/filetype.rb
@@ -85,7 +85,7 @@ class TestFileType < Test::Unit::TestCase
assert_nothing_raised("Could not call backup with no buckets") do
obj.backup
end
- puppet = type["puppet"]
+ puppet = type.mkdefaultbucket
assert(puppet, "Did not create default filebucket")
assert_equal("one", puppet.bucket.getfile(Digest::MD5.hexdigest(File.read(path))), "Could not get file from backup")
@@ -99,7 +99,7 @@ class TestFileType < Test::Unit::TestCase
assert_equal("two", puppet.bucket.getfile(Digest::MD5.hexdigest(File.read(path))), "Could not get file from backup")
end
- if Facter["operatingsystem"].value == "Darwin"
+ if Facter["operatingsystem"].value == "Darwin" and Facter["operatingsystemrelease"] != "9.1.0"
def test_ninfotoarray
obj = nil
type = nil
diff --git a/test/util/log.rb b/test/util/log.rb
index 8c7703cb9..74bb1faa1 100755
--- a/test/util/log.rb
+++ b/test/util/log.rb
@@ -129,7 +129,7 @@ class TestLog < Test::Unit::TestCase
# Verify that the error and source are always strings
def test_argsAreStrings
msg = nil
- file = Puppet.type(:file).create(
+ file = Puppet::Type.type(:file).new(
:path => tempfile(),
:check => %w{owner group}
)
diff --git a/test/util/metrics.rb b/test/util/metrics.rb
index b0ac1e2f5..b3219fc1a 100755
--- a/test/util/metrics.rb
+++ b/test/util/metrics.rb
@@ -17,7 +17,7 @@ class TestMetric < PuppetTest::TestCase
eventmax = 10
maxdiff = 10
- types = [Puppet.type(:file), Puppet.type(:package), Puppet.type(:package)]
+ types = [Puppet::Type.type(:file), Puppet::Type.type(:package), Puppet::Type.type(:package)]
data = [:total, :managed, :outofsync, :changed, :totalchanges]
events = [:file_changed, :package_installed, :service_started]
diff --git a/test/util/settings.rb b/test/util/settings.rb
index b6097c4c9..c4096f0bc 100755
--- a/test/util/settings.rb
+++ b/test/util/settings.rb
@@ -42,23 +42,6 @@ class TestSettings < Test::Unit::TestCase
assert(count > 0, "Found no users")
end
- def test_to_transportable
- set_configs
- trans = nil
- assert_nothing_raised("Could not convert to a transportable") {
- trans = @config.to_transportable
- }
-
- comp = nil
- assert_nothing_raised("Could not convert transportable to component") {
- comp = trans.to_type
- }
-
- assert_nothing_raised("Could not retrieve transported config") {
- comp.retrieve
- }
- end
-
def test_to_config
set_configs
@@ -256,69 +239,6 @@ yay = /a/path
end
end
- def test_old_parse
- text = %{
-one = this is a test
-two = another test
-owner = root
-group = root
-yay = /a/path
-
-[section1]
- attr = value
- owner = puppet
- group = puppet
- attrdir = /some/dir
- attr3 = $attrdir/other
- }
-
- file = tempfile()
- File.open(file, "w") { |f| f.puts text }
-
- assert_nothing_raised {
- @config.setdefaults("puppet",
- :one => ["a", "one"],
- :two => ["a", "two"],
- :yay => ["/default/path", "boo"],
- :mkusers => [true, "uh, yeah"]
- )
- }
-
- assert_nothing_raised {
- @config.setdefaults("section1",
- :attr => ["a", "one"],
- :attrdir => ["/another/dir", "two"],
- :attr3 => ["$attrdir/maybe", "boo"]
- )
- }
-
- assert_nothing_raised {
- @config.old_parse(file)
- }
-
- assert_equal("value", @config[:attr])
- assert_equal("/some/dir", @config[:attrdir])
- assert_equal(:directory, @config.element(:attrdir).type)
- assert_equal("/some/dir/other", @config[:attr3])
-
- elem = nil
- assert_nothing_raised {
- elem = @config.element(:attr3)
- }
-
- assert(elem)
- assert_equal("puppet", elem.owner)
-
- config = nil
- assert_nothing_raised {
- config = @config.to_config
- }
-
- assert_nothing_raised("Could not create transportable config") {
- @config.to_transportable
- }
- end
-
def test_parse
result = {
:main => {:main => "main", :bad => "invalid", :cliparam => "reset"},
@@ -548,91 +468,6 @@ yay = /a/path
assert_equal(should, result, "Add args functional test failed")
end
- def test_usesection
- # We want to make sure that config processes do not result in graphing.
- Puppet[:graphdir] = tempfile()
- Puppet[:graph] = true
- Dir.mkdir(Puppet[:graphdir])
- c = mkconfig
-
- dir = tempfile()
- file = "$mydir/myfile"
- realfile = File.join(dir, "myfile")
- otherfile = File.join(dir, "otherfile")
- section = "testing"
- assert_nothing_raised {
- @config.setdefaults(section,
- :mydir => [dir, "A dir arg"],
- :otherfile => {
- :default => "$mydir/otherfile",
- :create => true,
- :desc => "A file arg"
- },
- :myfile => [file, "A file arg"]
- )
- }
-
- assert_nothing_raised("Could not use a section") {
- @config.use(section)
- }
-
- assert_nothing_raised("Could not reuse a section") {
- @config.use(section)
- }
-
- # Make sure it didn't graph anything, which is the only real way
- # to test that the transaction was marked as a configurator.
- assert(Dir.entries(Puppet[:graphdir]).reject { |f| f =~ /^\.\.?$/ }.empty?, "Graphed config process")
-
- assert(FileTest.directory?(dir), "Did not create directory")
- assert(FileTest.exists?(otherfile), "Did not create file")
- assert(!FileTest.exists?(realfile), "Created file")
- end
-
- def test_setdefaultsarray
- c = mkconfig
-
- assert_nothing_raised {
- @config.setdefaults("yay",
- :a => [false, "some value"],
- :b => ["/my/file", "a file"]
- )
- }
-
- assert_equal(false, @config[:a], "Values are not equal")
- assert_equal("/my/file", @config[:b], "Values are not equal")
- end
-
- def test_setdefaultshash
- c = mkconfig
-
- assert_nothing_raised {
- @config.setdefaults("yay",
- :a => {:default => false, :desc => "some value"},
- :b => {:default => "/my/file", :desc => "a file"}
- )
- }
-
- assert_equal(false, @config[:a], "Values are not equal")
- assert_equal("/my/file", @config[:b], "Values are not equal")
- end
-
- def test_notmanagingdev
- c = mkconfig
- path = "/dev/testing"
- @config.setdefaults(:test,
- :file => {
- :default => path,
- :mode => 0640,
- :desc => 'yay'
- }
- )
-
- config = @config.to_configuration
-
- assert(! config.resource(:file, "/dev/testing"), "Created dev file")
- end
-
def test_groupsetting
cfile = tempfile()
@@ -981,7 +816,7 @@ yay = /a/path
# Now enable it so they'll be added
config[:mkusers] = true
- comp = config.to_configuration
+ comp = config.to_catalog
comp.vertices.find_all { |r| r.class.name == :user }.each do |u|
assert(u.name != "root", "Tried to manage root user")
diff --git a/test/util/storage.rb b/test/util/storage.rb
index d3860d6d7..cc378c690 100755
--- a/test/util/storage.rb
+++ b/test/util/storage.rb
@@ -12,7 +12,7 @@ class TestStorage < Test::Unit::TestCase
path = tempfile()
File.open(path, "w") { |f| f.puts :yayness }
- f = Puppet.type(:file).create(
+ f = Puppet::Type.type(:file).new(
:name => path,
:check => %w{checksum type}
)
@@ -77,7 +77,7 @@ class TestStorage < Test::Unit::TestCase
def test_caching
hash = nil
- one = Puppet::Type.type(:exec).create :title => "/bin/echo one"
+ one = Puppet::Type.type(:exec).new :title => "/bin/echo one"
[one, :yayness].each do |object|
assert_nothing_raised do
hash = Puppet::Util::Storage.cache(object)
diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb
index f838b39fc..41c9b517a 100755
--- a/test/util/utiltest.rb
+++ b/test/util/utiltest.rb
@@ -231,24 +231,5 @@ class TestPuppetUtil < Test::Unit::TestCase
# Puppet::Util.execute(cmd, 0, 0)
#}
end
-
- # This is mostly to test #380.
- def test_get_provider_value
- group = Puppet::Type.type(:group).create :name => "yayness", :ensure => :present
-
- root = Puppet::Type.type(:user).create :name => "root", :ensure => :present
-
- val = nil
- assert_nothing_raised do
- val = Puppet::Util.get_provider_value(:group, :gid, "yayness")
- end
- assert_nil(val, "returned a value on a missing group")
-
- # Now make sure we get a value for one we know exists
- assert_nothing_raised do
- val = Puppet::Util.get_provider_value(:user, :uid, "root")
- end
- assert_equal(0, val, "got invalid uid for root")
- end
end