summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-09 01:51:20 +0000
committerballman <ballman@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-09 01:51:20 +0000
commitc1643600e1130e2ddd112abcf16bb040fbffe0bf (patch)
tree73db9055495e529b0cac11ba8e81eb910db1e6a5 /test
parent8f187461a357898395ded25fb0c29a0d90a76896 (diff)
downloadpuppet-c1643600e1130e2ddd112abcf16bb040fbffe0bf.tar.gz
puppet-c1643600e1130e2ddd112abcf16bb040fbffe0bf.tar.xz
puppet-c1643600e1130e2ddd112abcf16bb040fbffe0bf.zip
Merging of refactor-transacton to the trunk. This work removes the :is attribute from properties and relies on the provider to cache or return the current value of the property.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2487 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/lib/puppettest/support/assertions.rb4
-rwxr-xr-xtest/other/propertychange.rb14
-rwxr-xr-xtest/other/transactions.rb8
-rwxr-xr-xtest/ral/manager/attributes.rb16
-rwxr-xr-xtest/ral/manager/type.rb4
-rwxr-xr-xtest/ral/providers/package/apt.rb4
-rwxr-xr-xtest/ral/providers/package/aptitude.rb27
-rwxr-xr-xtest/ral/providers/package/aptrpm.rb4
-rwxr-xr-xtest/ral/providers/package/dpkg.rb4
-rwxr-xr-xtest/ral/providers/parsedfile.rb27
-rwxr-xr-xtest/ral/providers/user/useradd.rb4
-rwxr-xr-xtest/ral/types/cron.rb79
-rwxr-xr-xtest/ral/types/file.rb70
-rwxr-xr-xtest/ral/types/file/target.rb6
-rwxr-xr-xtest/ral/types/filesources.rb43
-rwxr-xr-xtest/ral/types/group.rb6
-rwxr-xr-xtest/ral/types/host.rb25
-rwxr-xr-xtest/ral/types/mount.rb18
-rwxr-xr-xtest/ral/types/package.rb6
-rwxr-xr-xtest/ral/types/property.rb31
-rwxr-xr-xtest/ral/types/resources.rb2
-rwxr-xr-xtest/ral/types/schedule.rb2
-rwxr-xr-xtest/ral/types/service.rb3
-rwxr-xr-xtest/ral/types/tidy.rb19
-rwxr-xr-xtest/ral/types/user.rb28
-rwxr-xr-xtest/ral/types/yumrepo.rb4
-rwxr-xr-xtest/ral/types/zone.rb39
27 files changed, 261 insertions, 236 deletions
diff --git a/test/lib/puppettest/support/assertions.rb b/test/lib/puppettest/support/assertions.rb
index 979f3fbd9..9369f17e7 100644
--- a/test/lib/puppettest/support/assertions.rb
+++ b/test/lib/puppettest/support/assertions.rb
@@ -34,8 +34,8 @@ module PuppetTest
FileUtils.rm(filename)
end
- def assert_rollback_events(events, trans, msg = nil)
- run_events(:rollback, events, trans, msg)
+ def assert_rollback_events(trans, events, msg = nil)
+ run_events(:rollback, trans, events, msg)
end
def assert_events(events, *items)
diff --git a/test/other/propertychange.rb b/test/other/propertychange.rb
index d60a2ba2c..97ee3268c 100755
--- a/test/other/propertychange.rb
+++ b/test/other/propertychange.rb
@@ -12,11 +12,11 @@ class TestPropertyChange < Test::Unit::TestCase
class FakeProperty < Puppet::Type::Property
attr_accessor :is, :should, :parent
attr_reader :noop
- def change_to_s
+ def change_to_s(currentvalue, newvalue)
"fake change"
end
- def insync?
- @is == @should
+ def insync?(is)
+ is == @should
end
def log(msg)
Puppet::Util::Log.create(
@@ -35,11 +35,11 @@ class TestPropertyChange < Test::Unit::TestCase
def path
"fakechange"
end
- def should_to_s
- @should.to_s
+ def should_to_s(newvalue)
+ newvalue.to_s
end
def sync
- if insync?
+ if insync?(@is)
return nil
else
@is = @should
@@ -58,7 +58,7 @@ class TestPropertyChange < Test::Unit::TestCase
property.parent = :parent
change = nil
assert_nothing_raised do
- change = Puppet::PropertyChange.new(property)
+ change = Puppet::PropertyChange.new(property, :start)
end
change.transaction = :trans
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 00241c93e..3a9ba3d79 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -17,7 +17,7 @@ class TestTransactions < Test::Unit::TestCase
def should_to_s
@should.to_s
end
- def insync?
+ def insync?(foo)
true
end
def info(*args)
@@ -466,7 +466,7 @@ class TestTransactions < Test::Unit::TestCase
file[:content] = "totally different content"
- assert(! file.insync?, "Uh, file is in sync?")
+ assert(! file.insync?(file.retrieve), "Uh, file is in sync?")
assert_events([:file_changed, :triggered], comp)
assert(FileTest.exists?(fname), "File did not get recreated")
@@ -766,7 +766,7 @@ class TestTransactions < Test::Unit::TestCase
type = mkreducer do
def evaluate
return Puppet::PropertyChange.new(Fakeprop.new(
- :path => :path, :is => :is, :should => :should, :name => self.name, :parent => "a parent"))
+ :path => :path, :is => :is, :should => :should, :name => self.name, :parent => "a parent"), :is)
end
end
@@ -1015,7 +1015,7 @@ class TestTransactions < Test::Unit::TestCase
obj = type.create(:name => "yay", :testing => "cool")
- assert(! obj.insync?, "fake object is already in sync")
+ assert(! obj.insync?(obj.retrieve), "fake object is already in sync")
# Now make sure it gets refreshed when the change happens
assert_apply(obj)
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index 43f716ec2..9826638ee 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -42,19 +42,14 @@ class TestTypeAttributes < Test::Unit::TestCase
if param == :property
assert(inst.property(param), "did not get obj for %s" % param)
- end
-
- if param == :property
assert_equal(true, inst.should(param),
"should value did not get set")
- inst.is = [:property, true]
+ else
+ assert_equal(true, inst[param],
+ "did not get correct value for %s from symbol" % param)
+ assert_equal(true, inst[param.to_s],
+ "did not get correct value for %s from string" % param)
end
-
- # Now make sure we can get it back
- assert_equal(true, inst[param],
- "did not get correct value for %s from symbol" % param)
- assert_equal(true, inst[param.to_s],
- "did not get correct value for %s from string" % param)
end
end
@@ -232,7 +227,6 @@ class TestTypeAttributes < Test::Unit::TestCase
type.provide(:testing) {}
provider = type.attrclass(:provider)
should = [[name, :param], [provider, :param], [two, :property], [one, :param]]
-
assert_nothing_raised do
result = nil
type.eachattr do |obj, name|
diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb
index 6c1d6156c..3872ef637 100755
--- a/test/ral/manager/type.rb
+++ b/test/ral/manager/type.rb
@@ -452,7 +452,7 @@ end
ret = inst.retrieve
}
- assert_equal(:noopts, inst.is)
+ assert_equal(:noopts, inst.retrieve)
# Now create a property with a different way of doing it
property = nil
@@ -468,7 +468,7 @@ end
ret = inst.retrieve
}
- assert_equal(:yayness, inst.is)
+ assert_equal(:yayness, ret)
end
def test_name_vs_title
diff --git a/test/ral/providers/package/apt.rb b/test/ral/providers/package/apt.rb
index d289bdd3c..97998e4bb 100755
--- a/test/ral/providers/package/apt.rb
+++ b/test/ral/providers/package/apt.rb
@@ -28,7 +28,7 @@ class AptPackageProviderTest < PuppetTest::TestCase
'faff'
).returns(
"deinstall ok config-files faff 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:aptget
@@ -56,7 +56,7 @@ class AptPackageProviderTest < PuppetTest::TestCase
'faff'
).returns(
"install ok installed faff 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:aptget
).with(
diff --git a/test/ral/providers/package/aptitude.rb b/test/ral/providers/package/aptitude.rb
index a8ab6f7b7..891603f64 100755
--- a/test/ral/providers/package/aptitude.rb
+++ b/test/ral/providers/package/aptitude.rb
@@ -19,16 +19,16 @@ class AptitudePackageProviderTest < PuppetTest::TestCase
:ensure => :present,
:source => "/tmp/faff.deb"
- pkg.provider.expects(
- :dpkgquery
- ).with(
- '-W',
- '--showformat',
- '${Status} ${Package} ${Version}\n',
- 'faff'
- ).returns(
- "deinstall ok config-files faff 1.2.3-1\n"
- )
+ pkg.provider.expects(
+ :dpkgquery
+ ).with(
+ '-W',
+ '--showformat',
+ '${Status} ${Package} ${Version}\n',
+ 'faff'
+ ).returns(
+ "deinstall ok config-files faff 1.2.3-1\n"
+ ).times(2)
pkg.provider.expects(
:aptitude
@@ -40,7 +40,10 @@ class AptitudePackageProviderTest < PuppetTest::TestCase
'faff'
).returns(0)
- pkg.evaluate.each { |state| state.transaction = self; state.forward }
+ pkg.evaluate.each { |state|
+ state.transaction = self
+ state.forward
+ }
end
def test_purge
@@ -55,7 +58,7 @@ class AptitudePackageProviderTest < PuppetTest::TestCase
'faff'
).returns(
"install ok installed faff 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:aptitude
).with(
diff --git a/test/ral/providers/package/aptrpm.rb b/test/ral/providers/package/aptrpm.rb
index 488862683..0388135df 100755
--- a/test/ral/providers/package/aptrpm.rb
+++ b/test/ral/providers/package/aptrpm.rb
@@ -28,7 +28,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase
'--nodigest',
'--qf',
"%{NAME}-%{VERSION}-%{RELEASE} %{VERSION}-%{RELEASE}\n"
- ).raises(Puppet::ExecutionFailure, "couldn't find rpm")
+ ).raises(Puppet::ExecutionFailure, "couldn't find rpm").times(2)
pkg.provider.expects(
:aptget
@@ -56,7 +56,7 @@ class AptrpmPackageProviderTest < PuppetTest::TestCase
"%{NAME}-%{VERSION}-%{RELEASE} %{VERSION}-%{RELEASE}\n"
).returns(
"faff-1.2.3-1 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:aptget
).with(
diff --git a/test/ral/providers/package/dpkg.rb b/test/ral/providers/package/dpkg.rb
index 3d26150d8..69b6a3c10 100755
--- a/test/ral/providers/package/dpkg.rb
+++ b/test/ral/providers/package/dpkg.rb
@@ -27,7 +27,7 @@ class DpkgPackageProviderTest < PuppetTest::TestCase
'faff'
).returns(
"deinstall ok config-files faff 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:dpkg
@@ -51,7 +51,7 @@ class DpkgPackageProviderTest < PuppetTest::TestCase
'faff'
).returns(
"install ok installed faff 1.2.3-1\n"
- )
+ ).times(2)
pkg.provider.expects(
:dpkg
).with(
diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb
index cfc966a6c..015d0a8b7 100755
--- a/test/ral/providers/parsedfile.rb
+++ b/test/ral/providers/parsedfile.rb
@@ -301,14 +301,14 @@ class TestParsedFile < Test::Unit::TestCase
# Lastly, create a model with separate is and should values
mtarget = tempfile()
- istarget = tempfile()
+ # istarget = tempfile()
files[:models] = mtarget
- files[:ismodels] = istarget
+ # files[:ismodels] = istarget
model = mkmodel "yay", :target => mtarget
- model.is = [:target, istarget]
+ # model.is = [:target, istarget]
assert(model.should(:target), "Did not get a value for target")
- assert(model.is(:target), "Did not get a value for target")
+ # assert(model.is(:target), "Did not get a value for target")
list = nil
assert_nothing_raised do
@@ -559,12 +559,20 @@ class TestParsedFile < Test::Unit::TestCase
# First make sure we can retrieve values multiple times from the
# provider
- assert(bill.is(:one), "Bill does not have a value for 'one'")
- assert(bill.is(:one), "Bill does not have a value for 'one' on second try")
+ bills_values = nil
+ assert_nothing_raised do
+ bills_values = bill.retrieve
+ end
+
+ assert(bills_values[bill.property(:one)],
+ "Bill does not have a value for '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(bill.is(:one), "bill's value for 'one' disappeared")
+ assert(bills_values[bill.property(:one)],
+ "bill's value for 'one' disappeared")
end
# Make sure that creating a new model finds existing records in memory
@@ -603,11 +611,12 @@ class TestParsedFile < Test::Unit::TestCase
assert_apply(bill)
prov.prefetch
+ current_value = nil
assert_nothing_raised do
- bill.retrieve
+ current_value = bill.retrieve
end
- assert(bill.insync?,
+ assert(bill.insync?(current_value),
"An invalid field marked the record out of sync")
end
diff --git a/test/ral/providers/user/useradd.rb b/test/ral/providers/user/useradd.rb
index ca917f6c4..55bb96f2a 100755
--- a/test/ral/providers/user/useradd.rb
+++ b/test/ral/providers/user/useradd.rb
@@ -29,7 +29,6 @@ class UserAddProviderTest < PuppetTest::TestCase
@vals.each do |name, val|
next unless @user.class.validproperty?(name)
- @user.is = [name, :absent]
end
@user
end
@@ -46,7 +45,6 @@ class UserAddProviderTest < PuppetTest::TestCase
@vals.each do |name, val|
next unless user.class.validproperty?(name)
- user.is = [name, :absent]
end
user.expects(:allowdupe?).returns(false)
@@ -204,8 +202,6 @@ class UserAddProviderTest < PuppetTest::TestCase
# Now mark the user made, and make sure the right command is called
setup_user
- @user.is = [:ensure, :present]
- @user.is = [:password, :present]
@vals[:password] = "somethingelse"
@user.provider.expects(:execute).with do |params|
diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb
index 2b09fd66d..ead815071 100755
--- a/test/ral/types/cron.rb
+++ b/test/ral/types/cron.rb
@@ -97,9 +97,9 @@ class TestCron < Test::Unit::TestCase
assert_events([:cron_created], comp)
cron.provider.class.prefetch
- cron.retrieve
+ currentvalue = cron.retrieve
- assert(cron.insync?, "Cron is not in sync")
+ assert(cron.insync?(currentvalue), "Cron is not in sync")
assert_events([], comp)
@@ -114,9 +114,9 @@ class TestCron < Test::Unit::TestCase
assert_events([:cron_removed], comp)
cron.provider.class.prefetch
- cron.retrieve
+ currentvalue = cron.retrieve
- assert(cron.insync?, "Cron is not in sync")
+ assert(cron.insync?(currentvalue), "Cron is not in sync")
assert_events([], comp)
end
@@ -137,10 +137,12 @@ class TestCron < Test::Unit::TestCase
}
property = cron.send(:property, :command)
cron.provider.command = command
+ cron.provider.ensure = :present
+ cron.provider.month = ["4"]
cron.provider.class.prefetch
- cron.retrieve
+ currentvalue = cron.retrieve
- assert(property.insync?, "command parsing removes trailing whitespace")
+ assert(cron.insync?(currentvalue), "command parsing removes trailing whitespace")
@crontype.clear
end
end
@@ -230,12 +232,14 @@ class TestCron < Test::Unit::TestCase
)
}
- minute = cron.send(:property, :minute)
+ #minute = cron.send(:property, :minute)
+ cron.provider.ensure = :present
+ cron.provider.command = '/bin/date > /dev/null'
cron.provider.minute = %w{0 30}
cron.provider.class.prefetch
- cron.retrieve
+ currentvalue = cron.retrieve
- assert(minute.insync?, "minute is out of sync with %s" % provider.name)
+ assert(cron.insync?(currentvalue), "minute is out of sync with %s" % provider.name)
@crontype.clear
end
end
@@ -256,11 +260,13 @@ class TestCron < Test::Unit::TestCase
cron[:minute] = :absent
assert_events([:cron_changed], cron)
+
+ current_values = nil
assert_nothing_raised {
cron.provider.class.prefetch
- cron.retrieve
+ current_values = cron.retrieve
}
- assert_equal(:absent, cron.is(:minute))
+ assert_equal(:absent, current_values[cron.property(:minute)])
end
def test_listing
@@ -325,9 +331,9 @@ class TestCron < Test::Unit::TestCase
assert_apply(cron)
cron.provider.class.prefetch
- cron.retrieve
+ currentvalue = cron.retrieve
- assert_equal(["*/5"], cron.is(:minute))
+ assert_equal(["*/5"], currentvalue[cron.property(:minute)])
end
def test_ranges
@@ -336,10 +342,22 @@ class TestCron < Test::Unit::TestCase
assert_apply(cron)
- cron.provider.class.prefetch
- cron.retrieve
+ current_values = nil
+ assert_nothing_raised {
+ cron.provider.class.prefetch
+ current_values = cron.retrieve
+ }
+
+ assert_equal(["2-4"], current_values[cron.property(:minute)])
+ end
+
- assert_equal(["2-4"], cron.is(:minute))
+ def provider_set(cron, param, value)
+ unless param =~ /=$/
+ param = "%s=" % param
+ end
+
+ cron.provider.send(param, value)
end
def test_value
@@ -353,22 +371,19 @@ class TestCron < Test::Unit::TestCase
assert(property, "Did not get %s property" % param)
assert_nothing_raised {
- property.is = :absent
+# property.is = :absent
+ provider_set(cron, param, :absent)
}
- val = [:absent]
+ val = "*"
assert_equal(val, cron.value(param))
- # Make sure we correctly get the "is" value if that's all there is
- cron.is = [param, "1"]
- assert_equal(%w{1}, cron.value(param))
-
# Make sure arrays work, too
- cron.is = [param, ["1"]]
+ provider_set(cron, param, ["1"])
assert_equal(%w{1}, cron.value(param))
# Make sure values get comma-joined
- cron.is = [param, %w{2 3}]
+ provider_set(cron, param, %w{2 3})
assert_equal(%w{2 3}, cron.value(param))
# Make sure "should" values work, too
@@ -381,7 +396,7 @@ class TestCron < Test::Unit::TestCase
cron[param] = ["4", "5"]
assert_equal(%w{4 5}, cron.value(param))
- cron.is = [param, :absent]
+ provider_set(cron, param, :absent)
assert_equal(%w{4 5}, cron.value(param))
end
@@ -393,20 +408,16 @@ class TestCron < Test::Unit::TestCase
property = cron.property(:command)
assert_nothing_raised {
- property.is = :absent
+ provider_set(cron, :command, :absent)
}
param = :command
- # Make sure we correctly get the "is" value if that's all there is
- cron.is = [param, "/bin/echo"]
- assert_equal("/bin/echo", cron.value(param))
-
# Make sure arrays work, too
- cron.is = [param, ["/bin/echo"]]
+ provider_set(cron, param, ["/bin/echo"])
assert_equal("/bin/echo", cron.value(param))
# Make sure values are not comma-joined
- cron.is = [param, %w{/bin/echo /bin/test}]
+ provider_set(cron, param, %w{/bin/echo /bin/test})
assert_equal("/bin/echo", cron.value(param))
# Make sure "should" values work, too
@@ -419,7 +430,7 @@ class TestCron < Test::Unit::TestCase
cron[param] = %w{/bin/echo /bin/test}
assert_equal("/bin/echo", cron.value(param))
- cron.is = [param, :absent]
+ provider_set(cron, param, :absent)
assert_equal("/bin/echo", cron.value(param))
end
@@ -455,7 +466,7 @@ class TestCron < Test::Unit::TestCase
end
# Make sure the user stuff defaults correctly.
- def test_default_user
+ def test_default_user
crontab = @crontype.provider(:crontab)
if crontab.suitable?
inst = @crontype.create(
diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb
index e58095764..2dcfb17ec 100755
--- a/test/ral/types/file.rb
+++ b/test/ral/types/file.rb
@@ -237,15 +237,15 @@ class TestFile < Test::Unit::TestCase
}
assert(changes.length > 0)
assert_apply(file)
- file.retrieve
- assert(file.insync?())
+ currentvalue = file.retrieve
+ assert(file.insync?(currentvalue))
assert_nothing_raised() {
file[:owner] = uid
}
assert_apply(file)
- file.retrieve
+ currentvalue = file.retrieve
# make sure changing to number doesn't cause a sync
- assert(file.insync?())
+ assert(file.insync?(currentvalue))
}
# We no longer raise an error here, because we check at run time
@@ -269,8 +269,8 @@ class TestFile < Test::Unit::TestCase
assert(file.property(:group))
assert(file.property(:group).should)
assert_apply(file)
- file.retrieve
- assert(file.insync?())
+ currentvalue = file.retrieve
+ assert(file.insync?(currentvalue))
assert_nothing_raised() {
file.delete(:group)
}
@@ -311,7 +311,7 @@ class TestFile < Test::Unit::TestCase
assert_events([:file_created], file)
assert_events([], file)
assert(FileTest.file?(path), "File does not exist")
- assert(file.insync?())
+ assert(file.insync?(file.retrieve))
@@tmpfiles.push path
}
end
@@ -331,7 +331,7 @@ class TestFile < Test::Unit::TestCase
[path])
assert_events([:directory_created], file)
assert_events([], file)
- assert(file.insync?())
+ assert(file.insync?(file.retrieve))
assert(FileTest.directory?(path))
@@tmpfiles.push path
}
@@ -348,7 +348,7 @@ class TestFile < Test::Unit::TestCase
assert_events([:file_changed], file)
assert_events([], file)
- assert(file.insync?())
+ assert(file.insync?(file.retrieve))
assert_nothing_raised() {
file.delete(:mode)
@@ -387,11 +387,11 @@ class TestFile < Test::Unit::TestCase
}
trans = nil
- file.retrieve
+ currentvalues = file.retrieve
if file.title !~ /nonexists/
sum = file.property(:checksum)
- assert(sum.insync?, "file is not in sync")
+ assert(sum.insync?(currentvalues[sum]), "file is not in sync")
end
events = assert_apply(file)
@@ -424,10 +424,11 @@ class TestFile < Test::Unit::TestCase
# Run it a few times to make sure we aren't getting
# spurious changes.
+ sum = nil
assert_nothing_raised do
- file.property(:checksum).retrieve
+ sum = file.property(:checksum).retrieve
end
- assert(file.property(:checksum).insync?,
+ assert(file.property(:checksum).insync?(sum),
"checksum is not in sync")
sleep 1.1 if type =~ /time/
@@ -713,7 +714,7 @@ class TestFile < Test::Unit::TestCase
file.evaluate
}
- assert_equal("directory", file.property(:type).is)
+ assert_equal("directory", file.property(:type).retrieve)
# And then check files
assert_nothing_raised {
@@ -727,15 +728,16 @@ class TestFile < Test::Unit::TestCase
file[:check] = "type"
assert_apply(file)
- assert_equal("file", file.property(:type).is)
+ assert_equal("file", file.property(:type).retrieve)
file[:type] = "directory"
- assert_nothing_raised { file.retrieve }
+ currentvalues = {}
+ assert_nothing_raised { currentvalues = file.retrieve }
# The 'retrieve' method sets @should to @is, so they're never
# out of sync. It's a read-only class.
- assert(file.insync?)
+ assert(file.insync?(currentvalues))
end
def test_remove
@@ -840,13 +842,13 @@ class TestFile < Test::Unit::TestCase
)
}
- assert(!obj.insync?, "Object is incorrectly in sync")
+ assert(!obj.insync?(obj.retrieve), "Object is incorrectly in sync")
assert_events([:file_created], obj)
- obj.retrieve
+ currentvalues = obj.retrieve
- assert(obj.insync?, "Object is not in sync")
+ assert(obj.insync?(currentvalues), "Object is not in sync")
text = File.read(file)
@@ -856,7 +858,7 @@ class TestFile < Test::Unit::TestCase
obj[:content] = newstr
- assert(!obj.insync?, "Object is incorrectly in sync")
+ assert(!obj.insync?(obj.retrieve), "Object is incorrectly in sync")
assert_events([:file_changed], obj)
@@ -864,8 +866,8 @@ class TestFile < Test::Unit::TestCase
assert_equal(newstr, text, "Content did not copy correctly")
- obj.retrieve
- assert(obj.insync?, "Object is not in sync")
+ currentvalues = obj.retrieve
+ assert(obj.insync?(currentvalues), "Object is not in sync")
end
# Unfortunately, I know this fails
@@ -943,7 +945,7 @@ class TestFile < Test::Unit::TestCase
)
}
- file.retrieve
+ currentvalues = file.retrieve
assert_events([:file_created], file)
file.retrieve
@@ -1218,21 +1220,21 @@ class TestFile < Test::Unit::TestCase
file = Puppet::Type.newfile(:path => path, :ensure => :present)
- file.retrieve
- assert(! file.insync?, "File incorrectly in sync")
+ currentvalues = file.retrieve
+ assert(! file.insync?(currentvalues), "File incorrectly in sync")
# Now make a file
File.open(path, "w") { |f| f.puts "yay" }
- file.retrieve
- assert(file.insync?, "File not in sync")
+ currentvalues = file.retrieve
+ assert(file.insync?(currentvalues), "File not in sync")
# Now make a directory
File.unlink(path)
Dir.mkdir(path)
- file.retrieve
- assert(file.insync?, "Directory not considered 'present'")
+ currentvalues = file.retrieve
+ assert(file.insync?(currentvalues), "Directory not considered 'present'")
Dir.rmdir(path)
@@ -1242,8 +1244,8 @@ class TestFile < Test::Unit::TestCase
otherfile = tempfile()
File.symlink(otherfile, path)
- file.retrieve
- assert(file.insync?, "Symlink not considered 'present'")
+ currentvalues = file.retrieve
+ assert(file.insync?(currentvalues), "Symlink not considered 'present'")
File.unlink(path)
# Now set some content, and make sure it works
@@ -1459,8 +1461,8 @@ class TestFile < Test::Unit::TestCase
property = obj.property(:ensure)
- property.retrieve
- unless property.insync?
+ currentvalue = property.retrieve
+ unless property.insync?(currentvalue)
assert_nothing_raised do
property.sync
end
diff --git a/test/ral/types/file/target.rb b/test/ral/types/file/target.rb
index f016b148a..1e62f07ac 100755
--- a/test/ral/types/file/target.rb
+++ b/test/ral/types/file/target.rb
@@ -222,19 +222,19 @@ class TestFileTarget < Test::Unit::TestCase
prop = obj.send(:property, :target)
prop.send(:instance_variable_set, "@should", [:nochange])
- assert(prop.insync?,
+ assert(prop.insync?(prop.retrieve),
"Property not in sync with should == :nochange")
prop = obj.send(:property, :target)
prop.send(:instance_variable_set, "@should", [:notlink])
- assert(prop.insync?,
+ assert(prop.insync?(prop.retrieve),
"Property not in sync with should == :nochange")
# Lastly, make sure that we don't try to do anything when we're
# recursing, since 'ensure' does the work.
obj[:recurse] = true
prop.should = dest
- assert(prop.insync?,
+ assert(prop.insync?(prop.retrieve),
"Still out of sync during recursion")
end
diff --git a/test/ral/types/filesources.rb b/test/ral/types/filesources.rb
index 60d3214b6..fed5e3f2a 100755
--- a/test/ral/types/filesources.rb
+++ b/test/ral/types/filesources.rb
@@ -143,26 +143,27 @@ class TestFileSources < Test::Unit::TestCase
assert_equal([source], property.should, "munging changed the source")
# First try it with a missing source
+ currentvalue = nil
assert_nothing_raised do
- property.retrieve
+ currentvalue = property.retrieve
end
# And make sure the property considers itself in sync, since there's nothing
# to do
- assert(property.insync?, "source thinks there's work to do with no file or dest")
+ assert(property.insync?(currentvalue), "source thinks there's work to do with no file or dest")
# Now make the dest a directory, and make sure the object sets :ensure
# up to create a directory
Dir.mkdir(source)
assert_nothing_raised do
- property.retrieve
+ currentvalue = property.retrieve
end
assert_equal(:directory, file.should(:ensure),
"Did not set to create directory")
# And make sure the source property won't try to do anything with a
# remote dir
- assert(property.insync?, "Source was out of sync even tho remote is dir")
+ assert(property.insync?(currentvalue), "Source was out of sync even tho remote is dir")
# Now remove the source, and make sure :ensure was not modified
Dir.rmdir(source)
@@ -205,29 +206,29 @@ class TestFileSources < Test::Unit::TestCase
assert(property, "did not get source property")
# Try it with no source at all
- file.retrieve
- assert(property.insync?, "source property not in sync with missing source")
+ currentvalues = file.retrieve
+ assert(property.insync?(currentvalues[property]), "source property not in sync with missing source")
# with a directory
Dir.mkdir(source)
- file.retrieve
- assert(property.insync?, "source property not in sync with directory as source")
+ currentvalues = file.retrieve
+ assert(property.insync?(currentvalues[property]), "source property not in sync with directory as source")
Dir.rmdir(source)
# with a file
File.open(source, "w") { |f| f.puts "yay" }
- file.retrieve
- assert(!property.insync?, "source property was in sync when file was missing")
+ currentvalues = file.retrieve
+ assert(!property.insync?(currentvalues[property]), "source property was in sync when file was missing")
# With a different file
File.open(dest, "w") { |f| f.puts "foo" }
- file.retrieve
- assert(!property.insync?, "source property was in sync with different file")
+ currentvalues = file.retrieve
+ assert(!property.insync?(currentvalues[property]), "source property was in sync with different file")
# with matching files
File.open(dest, "w") { |f| f.puts "yay" }
- file.retrieve
- assert(property.insync?, "source property was not in sync with matching file")
+ currentvalues = file.retrieve
+ assert(property.insync?(currentvalues[property]), "source property was not in sync with matching file")
end
def test_source_sync
@@ -240,8 +241,8 @@ class TestFileSources < Test::Unit::TestCase
File.open(source, "w") { |f| f.puts "yay" }
- file.retrieve
- assert(! property.insync?, "source thinks it's in sync")
+ currentvalues = file.retrieve
+ assert(! property.insync?(currentvalues[property]), "source thinks it's in sync")
event = nil
assert_nothing_raised do
@@ -253,8 +254,8 @@ class TestFileSources < Test::Unit::TestCase
# Now write something different
File.open(source, "w") { |f| f.puts "rah" }
- file.retrieve
- assert(! property.insync?, "source should be out of sync")
+ currentvalues = file.retrieve
+ assert(! property.insync?(currentvalues[property]), "source should be out of sync")
assert_nothing_raised do
event = property.sync
end
@@ -692,12 +693,12 @@ class TestFileSources < Test::Unit::TestCase
)
}
- file.retrieve
+ currentvalue = file.retrieve
- assert(file.is(:checksum), "File does not have a checksum property")
+ assert(currentvalue[file.property(:checksum)],
+ "File does not have a checksum property")
assert_equal(0, file.evaluate.length, "File produced changes")
-
end
def test_sourcepaths
diff --git a/test/ral/types/group.rb b/test/ral/types/group.rb
index 9f091f699..9870d533a 100755
--- a/test/ral/types/group.rb
+++ b/test/ral/types/group.rb
@@ -125,11 +125,13 @@ class TestGroup < Test::Unit::TestCase
# Set a fake gid
gobj.provider.gid = rand(100)
+ current_values = nil
assert_nothing_raised {
- gobj.retrieve
+ current_values = gobj.retrieve
}
- assert(gobj.is(:gid), "Failed to retrieve gid")
+ assert(current_values[gobj.property(:gid)],
+ "Failed to retrieve gid")
}
end
diff --git a/test/ral/types/host.rb b/test/ral/types/host.rb
index f315cbd1f..57d425e7c 100755
--- a/test/ral/types/host.rb
+++ b/test/ral/types/host.rb
@@ -79,20 +79,21 @@ class TestHost < Test::Unit::TestCase
)
}
- host.retrieve
+ current_values = nil
+ assert_nothing_raised { current_values = host.retrieve }
assert_events([:host_created], host)
- assert_nothing_raised { host.retrieve }
+ assert_nothing_raised { current_values = host.retrieve }
- assert_equal(:present, host.is(:ensure))
+ assert_equal(:present, current_values[host.property(:ensure)])
host[:ensure] = :absent
assert_events([:host_removed], host)
- assert_nothing_raised { host.retrieve }
+ assert_nothing_raised { current_values = host.retrieve }
- assert_equal(:absent, host.is(:ensure))
+ assert_equal(:absent, current_values[host.property(:ensure)])
end
def test_moddinghost
@@ -111,18 +112,24 @@ class TestHost < Test::Unit::TestCase
assert_events([:host_created], host)
- host.retrieve
+ current_values = nil
+ assert_nothing_raised {
+ current_values = host.retrieve
+ }
# This was a hard bug to track down.
- assert_instance_of(String, host.is(:ip))
+ assert_instance_of(String, current_values[host.property(:ip)])
host[:alias] = %w{madstop kirby yayness}
assert_events([:host_changed], host)
- host.retrieve
+ assert_nothing_raised {
+ current_values = host.retrieve
+ }
- assert_equal(%w{madstop kirby yayness}, host.is(:alias))
+ assert_equal(%w{madstop kirby yayness},
+ current_values[host.property(:alias)])
host[:ensure] = :absent
assert_events([:host_removed], host)
diff --git a/test/ral/types/mount.rb b/test/ral/types/mount.rb
index 23fee5ac7..4b76b3ec2 100755
--- a/test/ral/types/mount.rb
+++ b/test/ral/types/mount.rb
@@ -178,10 +178,11 @@ class TestMounts < Test::Unit::TestCase
assert_events([:mount_mounted, :triggered], obj)
assert_events([], obj)
- obj.retrieve
- assert_equal(:mounted, obj.is(:ensure))
+ current_values = nil
+ assert_nothing_raised { current_values = obj.retrieve }
+ assert_equal(:mounted, current_values[obj.property(:ensure)])
- obj.retrieve
+ assert_nothing_raised { current_values = obj.retrieve }
assert(obj.provider.mounted?, "Object is not mounted")
end
@@ -200,16 +201,13 @@ class TestMounts < Test::Unit::TestCase
root = list.find { |o| o[:name] == "/" }
assert(root, "Could not find root root filesystem in list results")
-
- assert(root.is(:device), "Device was not set")
- assert(root.property(:device).value, "Device was not returned by value method")
-
+
+ current_values = nil
assert_nothing_raised do
- root.retrieve
+ current_values = root.retrieve
end
- assert(root.is(:device), "Device was not set")
- assert(root.property(:device).value, "Device was not returned by value method")
+ assert(current_values[root.property(:device)], "Device was not set")
end
end
diff --git a/test/ral/types/package.rb b/test/ral/types/package.rb
index f49a36bb6..e45f68d34 100755
--- a/test/ral/types/package.rb
+++ b/test/ral/types/package.rb
@@ -43,11 +43,13 @@ class TestPackages < Test::Unit::TestCase
end
assert(pkg, "did not create package")
+ current_values = nil
assert_nothing_raised do
- pkg.retrieve
+ current_values = pkg.retrieve
end
- assert_equal(:absent, pkg.is(:ensure), "package not considered missing")
+ assert_equal(:absent, current_values[pkg.property(:ensure)],
+ "package not considered missing")
assert_equal(:present, pkg.should(:ensure),
"package did not default to installed")
diff --git a/test/ral/types/property.rb b/test/ral/types/property.rb
index 38a4b2e81..11c31179f 100755
--- a/test/ral/types/property.rb
+++ b/test/ral/types/property.rb
@@ -12,9 +12,13 @@ class TestProperty < Test::Unit::TestCase
unless parent
parent = "fakeparent"
parent.meta_def(:pathbuilder) do [self.to_s] end
+ parent.meta_def(:provider) do nil end
+ parent.meta_def(:fakeproperty) do '' end
end
assert_nothing_raised {
- return property.new(:parent => parent)
+ newinst = property.new(:parent => parent)
+ def newinst.retrieve(); return @fakeprovidervalue; end;
+ return newinst
}
end
@@ -104,13 +108,13 @@ class TestProperty < Test::Unit::TestCase
# These are bogus because they don't define events. :/
assert_nothing_raised {
property.newvalue(:one) do
- @is = 1
+ @fakeprovidervalue = 1
end
}
assert_nothing_raised {
property.newvalue("two") do
- @is = 2
+ @fakeprovidervalue = 2
end
}
@@ -127,7 +131,7 @@ class TestProperty < Test::Unit::TestCase
assert_equal(:one, inst.should)
ret = nil
assert_nothing_raised { inst.set_one }
- assert_equal(1, inst.is)
+ assert_equal(1, inst.retrieve)
assert_nothing_raised {
inst.should = :two
@@ -135,7 +139,7 @@ class TestProperty < Test::Unit::TestCase
assert_equal(:two, inst.should)
assert_nothing_raised { inst.set_two }
- assert_equal(2, inst.is)
+ assert_equal(2, inst.retrieve)
end
def test_newpropertyvaluewithregexes
@@ -143,7 +147,6 @@ class TestProperty < Test::Unit::TestCase
assert_nothing_raised {
property.newvalue(/^\w+$/) do
- @is = self.should.upcase
return :regex_matched
end
}
@@ -160,7 +163,7 @@ class TestProperty < Test::Unit::TestCase
inst.sync
}
- assert_equal("yayness".upcase, inst.is)
+ assert_equal("yayness".upcase, inst.retrieve)
end
def test_newvalue_event_option
@@ -168,10 +171,8 @@ class TestProperty < Test::Unit::TestCase
assert_nothing_raised do
property.newvalue(:myvalue, :event => :fake_valued) do
- @is = :valued
end
property.newvalue(:other, :event => "fake_other") do
- @is = :valued
end
end
inst = newinst(property)
@@ -263,9 +264,15 @@ class TestProperty < Test::Unit::TestCase
end
def test_failure
- s = Struct.new(:line, :file, :path, :pathbuilder)
- p = s.new(1, "yay", "rah", "struct")
- myproperty = Class.new(Puppet::Property)
+ s = Struct.new(:line, :file, :path, :pathbuilder, :name)
+ p = s.new(1, "yay", "rah", "struct", "name")
+
+ myprovider = Class.new(Puppet::Provider)
+
+ def p.provider; nil; end;
+ myproperty = Class.new(Puppet::Property) do
+ @name = 'name'
+ end
myproperty.initvars
myproperty.newvalue :mkfailure do
diff --git a/test/ral/types/resources.rb b/test/ral/types/resources.rb
index bc6c9f6a9..56603c611 100755
--- a/test/ral/types/resources.rb
+++ b/test/ral/types/resources.rb
@@ -212,7 +212,7 @@ class TestResources < Test::Unit::TestCase
assert(! list.empty?, "did not get any users")
bad = list.find_all { |u|
- %w{root bin nobody}.include?(u[:name]) or (u.retrieve and u.is(:uid) < 500)
+ %w{root bin nobody}.include?(u[:name]) or (cv = u.retrieve and cv[u.property(:uid)] < 500)
}
assert(bad.empty?, "incorrectly passed users %s" % bad.collect { |u| u[:name]}.join(", "))
end
diff --git a/test/ral/types/schedule.rb b/test/ral/types/schedule.rb
index e9b3ef8b3..cc565bbfc 100755
--- a/test/ral/types/schedule.rb
+++ b/test/ral/types/schedule.rb
@@ -94,7 +94,7 @@ class TestSchedule < Test::Unit::TestCase
#end
end
- Puppet.err @@times.inspect
+ Puppet.err @@times.inspect
@@times.each { |time|
@now = time
diff --git a/test/ral/types/service.rb b/test/ral/types/service.rb
index 0e2e1e962..e682709ac 100755
--- a/test/ral/types/service.rb
+++ b/test/ral/types/service.rb
@@ -23,9 +23,8 @@ class TestServiceType < Test::Unit::TestCase
def test_refresh_normally
service = Puppet::Type.type(:service).create :name => "testing",
- :ensure => :running, :provider => :base
+ :ensure => :running, :provider => :base, :status => "cat /dev/null"
- service.is = [:ensure, :running]
service.provider.expects(:restart)
assert_nothing_raised do
diff --git a/test/ral/types/tidy.rb b/test/ral/types/tidy.rb
index 5e6720bb3..b8d576b9a 100755
--- a/test/ral/types/tidy.rb
+++ b/test/ral/types/tidy.rb
@@ -151,14 +151,10 @@ class TestTidy < Test::Unit::TestCase
age = tidy.property(:age)
# Set it to something that should be fine
- age.is = Time.now.to_i - 5
-
- assert(age.insync?, "Tried to tidy a low age")
+ assert(age.insync?(Time.now.to_i - 5), "Tried to tidy a low age")
# Now to something that should fail
- age.is = Time.now.to_i - 120
-
- assert(! age.insync?, "Incorrectly skipped tidy")
+ assert(! age.insync?(Time.now.to_i - 120), "Incorrectly skipped tidy")
end
def test_sizetest
@@ -167,14 +163,10 @@ class TestTidy < Test::Unit::TestCase
size = tidy.property(:size)
# Set it to something that should be fine
- size.is = 50
-
- assert(size.insync?, "Tried to tidy a low size")
+ assert(size.insync?(50), "Tried to tidy a low size")
# Now to something that should fail
- size.is = 2048
-
- assert(! size.insync?, "Incorrectly skipped tidy")
+ assert(! size.insync?(2048), "Incorrectly skipped tidy")
end
# Make sure we can remove different types of files
@@ -197,7 +189,6 @@ class TestTidy < Test::Unit::TestCase
# And a directory
Dir.mkdir(path)
- tidy.is = [:ensure, [Time.now - 1024, 1]]
tidy[:rmdirs] = true
assert_events([:file_tidied], tidy)
assert(! FileTest.exists?(path), "File was not removed")
@@ -218,7 +209,7 @@ class TestTidy < Test::Unit::TestCase
File.open(path, "w") { |f| 10.times { f.puts "yayness " } }
tidy = Puppet::Type.type(:tidy).create :path => path, :age => "5s"
- tidy.property(:age).is = "0s"
+
assert_apply(tidy)
assert(! FileTest.exists?(path), "file did not get tidied")
end
diff --git a/test/ral/types/user.rb b/test/ral/types/user.rb
index be1dd6f78..ef113ee84 100755
--- a/test/ral/types/user.rb
+++ b/test/ral/types/user.rb
@@ -305,11 +305,11 @@ class TestUser < Test::Unit::TestCase
assert(user.provider.groups.is_a?(String),
"Incorrectly passed an array to groups")
- user.retrieve
+ currentvalue = user.retrieve
- assert(user.property(:groups).is, "Did not retrieve group list")
+ assert(currentvalue[user.property(:groups)], "Did not retrieve group list")
- list = user.property(:groups).is
+ list = currentvalue[user.property(:groups)]
assert_equal(extra.sort, list.sort, "Group list is not equal")
# Now set to our main list of groups
@@ -319,45 +319,45 @@ class TestUser < Test::Unit::TestCase
assert_equal((main + extra).sort, user.property(:groups).should.split(",").sort)
+ currentvalue = nil
assert_nothing_raised {
- user.retrieve
+ currentvalue = user.retrieve
}
- assert(!user.insync?, "User is incorrectly in sync")
+ assert(!user.insync?(currentvalue), "User is incorrectly in sync")
assert_apply(user)
assert_nothing_raised {
- user.retrieve
+ currentvalue = user.retrieve
}
# We're not managing inclusively, so it should keep the old group
# memberships and add the new ones
- list = user.property(:groups).is
+ list = currentvalue[user.property(:groups)]
assert_equal((main + extra).sort, list.sort, "Group list is not equal")
assert_nothing_raised {
user[:membership] = :inclusive
}
assert_nothing_raised {
- user.retrieve
+ currentvalue = user.retrieve
}
- assert(!user.insync?, "User is incorrectly in sync")
+ assert(!user.insync?(currentvalue), "User is incorrectly in sync")
assert_events([:user_changed], user)
assert_nothing_raised {
- user.retrieve
+ currentvalue = user.retrieve
}
- list = user.property(:groups).is
+ list = currentvalue[user.property(:groups)]
assert_equal(main.sort, list.sort, "Group list is not equal")
# Set the values a bit differently.
user.property(:groups).should = list.sort { |a,b| b <=> a }
- user.property(:groups).is = list.sort
- assert(user.property(:groups).insync?, "Groups property did not sort groups")
+ assert(user.property(:groups).insync?(list.sort), "Groups property did not sort groups")
user.delete(:groups)
end
@@ -460,7 +460,7 @@ class TestUser < Test::Unit::TestCase
user.evaluate
end
- assert(user.send(:property, :groups).insync?,
+ assert(user.send(:property, :groups).insync?(nil),
"Groups state considered out of sync with no :should value")
end
diff --git a/test/ral/types/yumrepo.rb b/test/ral/types/yumrepo.rb
index 2f8be32c6..e1c948e33 100755
--- a/test/ral/types/yumrepo.rb
+++ b/test/ral/types/yumrepo.rb
@@ -23,10 +23,10 @@ class TestYumRepo < Test::Unit::TestCase
def test_modify
copy_datafiles
devel = make_repo("development", { :descr => "New description" })
- devel.retrieve
+ current_values = devel.retrieve
assert_equal("development", devel[:name])
assert_equal('Fedora Core $releasever - Development Tree',
- devel.property(:descr).is)
+ current_values[devel.property(:descr)])
assert_equal('New description',
devel.property(:descr).should)
assert_apply(devel)
diff --git a/test/ral/types/zone.rb b/test/ral/types/zone.rb
index c1724b93a..abb042a04 100755
--- a/test/ral/types/zone.rb
+++ b/test/ral/types/zone.rb
@@ -1,3 +1,4 @@
+
#!/usr/bin/env ruby
$:.unshift("../../lib") if __FILE__ =~ /\.rb$/
@@ -114,7 +115,6 @@ class TestZone < Test::Unit::TestCase
assert(property.up?, "Property incorrectly thinks it is not moving up")
- zone.is = [:ensure, :configured]
zone[:ensure] = :installed
assert(property.up?, "Property incorrectly thinks it is not moving up")
zone[:ensure] = :absent
@@ -161,10 +161,10 @@ class TestZone < Test::Unit::TestCase
assert_equal("add inherit-pkg-dir\nset dir=/usr\nend", property.configtext,
"Got incorrect config text")
- property.is = "/usr"
-
- assert_equal("", property.configtext,
- "Got incorrect config text")
+# property.is = "/usr"
+#
+# assert_equal("", property.configtext,
+# "Got incorrect config text")
# Now we want multiple directories
property.should = %w{/usr /sbin /lib}
@@ -180,13 +180,13 @@ end"
assert_equal(text, property.configtext,
"Got incorrect config text")
- property.is = %w{/usr /sbin /lib}
- property.should = %w{/usr /sbin}
+ # property.is = %w{/usr /sbin /lib}
+ # property.should = %w{/usr /sbin}
- text = "remove inherit-pkg-dir dir=/lib"
+# text = "remove inherit-pkg-dir dir=/lib"
- assert_equal(text, property.configtext,
- "Got incorrect config text")
+# assert_equal(text, property.configtext,
+# "Got incorrect config text")
end
if Puppet::Util::SUIDManager.uid == 0
@@ -254,13 +254,13 @@ end
# And make sure it gets set correctly.
assert_equal(%w{/sbin /usr /opt/csw /lib /platform}.sort,
- zone.is(:inherit).sort, "Inherited dirs did not get collected correctly."
+ zone.property(:inherit).retrieve.sort, "Inherited dirs did not get collected correctly."
)
assert_equal(["#{interface}:#{ip}"], zone.is(:ip),
"IP addresses did not get collected correctly.")
- assert_equal(:true, zone.is(:autoboot),
+ assert_equal(:true, zone.property(:autoboot).retrieve,
"Autoboot did not get collected correctly.")
end
@@ -361,9 +361,10 @@ end
assert_apply(zone)
- zone.retrieve
+ currentvalues = zone.retrieve
- assert_equal(:absent, zone.is(:ensure), "Zone is not absent")
+ assert_equal(:absent, currentvalues[zone.property(:ensure)],
+ "Zone is not absent")
end
# Just go through each method linearly and make sure it works.
@@ -390,10 +391,11 @@ end
assert_nothing_raised {
zone.provider.send(method)
}
+ current_values = nil
assert_nothing_raised {
- zone.retrieve
+ current_values = zone.retrieve
}
- assert_equal(property, zone.is(:ensure),
+ assert_equal(property, current_values[zone.property(:ensure)],
"Method %s did not correctly set property %s" %
[method, property])
end
@@ -426,9 +428,10 @@ end
assert(zone.insync?, "Zone is incorrectly out of sync")
end
- zone.retrieve
+ currentvalues = zone.retrieve
- assert_equal(:absent, zone.is(:ensure), "Zone is not absent")
+ assert_equal(:absent, currentvalues[zone.property(:ensure)],
+ "Zone is not absent")
end
end
end