summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/other/tc_state.rb36
1 files changed, 34 insertions, 2 deletions
diff --git a/test/other/tc_state.rb b/test/other/tc_state.rb
index 3720f6286..f295a0061 100644
--- a/test/other/tc_state.rb
+++ b/test/other/tc_state.rb
@@ -9,12 +9,20 @@ require 'test/unit'
# $Id$
+class StorageTestingClass
+end
+
class TestStorage < Test::Unit::TestCase
def setup
Puppet[:loglevel] = :debug if __FILE__ == $0
Puppet[:statefile] = "/var/tmp/puppetteststate"
end
+ def teardown
+ system("rm -f %s" % Puppet[:statefile])
+ Puppet::Storage.clear
+ end
+
def test_simple
state = nil
assert_nothing_raised {
@@ -28,6 +36,12 @@ class TestStorage < Test::Unit::TestCase
assert_nothing_raised {
Puppet::Storage.store
}
+
+ # clear the memory, so we're sure we're hitting the state file
+ assert_nothing_raised {
+ Puppet::Storage.clear
+ Puppet::Storage.init
+ }
assert_nothing_raised {
Puppet::Storage.load
}
@@ -54,7 +68,25 @@ class TestStorage < Test::Unit::TestCase
assert(state)
end
- def teardown
- system("rm -f %s" % Puppet[:statefile])
+ def test_update
+ state = Puppet::Storage.state(StorageTestingClass)
+ state["testing"] = "yayness"
+ Puppet::Storage.store
+ assert(FileTest.exists?(Puppet[:statefile]))
+ end
+
+ def test_hashstorage
+ state = Puppet::Storage.state(StorageTestingClass)
+ hash = {
+ :yay => "boo",
+ :rah => "foo"
+ }
+ state["testing"] = hash
+ Puppet::Storage.store
+ Puppet::Storage.clear
+ Puppet::Storage.init
+ Puppet::Storage.load
+ state = Puppet::Storage.state(StorageTestingClass)
+ assert_equal(hash, state["testing"])
end
end