diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-03 16:41:41 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-03 16:41:41 +0000 |
| commit | b9b338432ee0dbad7798685736fcc80ff0164924 (patch) | |
| tree | 97eb13856251a5e2e72dc1307e0c560abc010662 /test | |
| parent | 37330340833ddca9e542804fe64755ab8feb9eeb (diff) | |
This is the initial commit of the changes to sync and retrieve. The
structure itself is now in place, and a few of the types (the most
complicated ones -- file, user, group, plus exec since it was my easy
first test) have been converted.
I'm now going to finish going through all of the types and finish
chnaging them so that they don't produce any warnings.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1546 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/types/file.rb | 14 | ||||
| -rwxr-xr-x | test/types/group.rb | 17 | ||||
| -rw-r--r-- | test/types/package.rb | 2 | ||||
| -rwxr-xr-x | test/types/user.rb | 2 |
4 files changed, 18 insertions, 17 deletions
diff --git a/test/types/file.rb b/test/types/file.rb index 3dc296cc0..194d00958 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -704,8 +704,6 @@ class TestFile < Test::Unit::TestCase assert_events([:file_created], obj) - obj.retrieve - assert(obj.insync?, "Object is not in sync") text = File.read(file) @@ -795,18 +793,17 @@ class TestFile < Test::Unit::TestCase dest = tempfile() file = nil + str = "some content, ok?" assert_nothing_raised { file = Puppet.type(:file).create( :name => dest, :ensure => "file", - :content => "this is some content, yo" + :content => str ) } - file.retrieve - assert_events([:file_created], file) - file.retrieve + assert_equal(str, File.read(dest)) assert_events([], file) assert_events([], file) end @@ -1200,7 +1197,7 @@ class TestFile < Test::Unit::TestCase } # First run through without :force - assert_events([], file) + assert_events([], file, "Link replaced directory without force enabled") assert(FileTest.directory?(link), "Link replaced dir without force") @@ -1376,11 +1373,12 @@ class TestFile < Test::Unit::TestCase lfobj = Puppet::Type.newfile(:path => localfile, :content => "rahtest") + assert(! lfobj.implicit?, "object incorrectly implicit") + destobj = Puppet::Type.newfile(:path => destdir, :source => sourcedir, :recurse => true) - assert_apply(lfobj, destobj) assert(FileTest.exists?(dsourcefile), "File did not get copied") diff --git a/test/types/group.rb b/test/types/group.rb index 508b8436c..2b47f14d4 100755 --- a/test/types/group.rb +++ b/test/types/group.rb @@ -18,6 +18,9 @@ class TestGroup < Test::Unit::TestCase def create @ensure = :present + + # Just set a fake gid + self.gid = 10 end def delete @@ -76,7 +79,7 @@ class TestGroup < Test::Unit::TestCase assert_events([:group_created], comp) assert_equal(:present, group.provider.ensure, "Group is absent") group[:ensure] = :absent - trans = assert_events([:group_removed], comp) + trans = assert_events([:group_deleted], comp) assert_equal(:absent, group.provider.ensure, "Group is present") assert_rollback_events(trans, [:group_created], "group") @@ -86,7 +89,6 @@ class TestGroup < Test::Unit::TestCase # This is a bit odd, since we're not actually doing anything on the machine. # Just make sure we can set the gid and that it will work correctly. def attrtest_gid(group) - # Check the validation. assert_nothing_raised { group[:gid] = "15" @@ -96,7 +98,8 @@ class TestGroup < Test::Unit::TestCase "Did not convert gid to number") comp = newcomp(group) - trans = assert_events([:group_modified], comp, "group") + + trans = assert_events([:group_changed], comp, "group") assert_equal(15, group.provider.gid, "GID was not changed") assert_nothing_raised { @@ -107,12 +110,12 @@ class TestGroup < Test::Unit::TestCase "Did not keep gid as number") # Now switch to 16 - trans = assert_events([:group_modified], comp, "group") + trans = assert_events([:group_changed], comp, "group") assert_equal(16, group.provider.gid, "GID was not changed") # And then rollback - assert_rollback_events(trans, [:group_modified], "group") - assert_equal(15, group.provider.gid, "GID was not changed") + assert_rollback_events(trans, [:group_changed], "group") + assert_equal(15, group.provider.gid, "GID was not reverted") end def test_owngroups @@ -167,7 +170,7 @@ class TestGroup < Test::Unit::TestCase end } - assert_rollback_events(trans, [:group_removed], "group") + assert_rollback_events(trans, [:group_deleted], "group") assert(! gobj.provider.exists?, "Did not delete group") diff --git a/test/types/package.rb b/test/types/package.rb index 779c693fe..9ffd846ef 100644 --- a/test/types/package.rb +++ b/test/types/package.rb @@ -167,7 +167,7 @@ class TestPackages < Test::Unit::TestCase obj[:source] = file assert_raise(Puppet::PackageError, "Successfully installed nonexistent package") { - state.sync + state.sync(state.should) } end diff --git a/test/types/user.rb b/test/types/user.rb index 008f39272..7522a041b 100755 --- a/test/types/user.rb +++ b/test/types/user.rb @@ -19,7 +19,7 @@ class TestUser < Test::Unit::TestCase @ensure = :present @model.eachstate do |state| next if state.name == :ensure - state.sync + state.commit end end |
