diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-21 19:05:30 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-21 19:05:30 +0000 |
| commit | 039abd6d792dd99bf5c1ad272c4f841f80ea5642 (patch) | |
| tree | ce8d374a9c1d948bee74d747ee24e7f918f7c8ae /test | |
| parent | 2091eddc4e53cb2e16646081b3bb64e1342858f8 (diff) | |
Fixing #176. You can now do duplicate UIDs (or GIDs on most platforms) with :allowdupe.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1416 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/types/group.rb | 30 | ||||
| -rwxr-xr-x | test/types/user.rb | 25 |
2 files changed, 55 insertions, 0 deletions
diff --git a/test/types/group.rb b/test/types/group.rb index 61edeb771..cb9b988ed 100755 --- a/test/types/group.rb +++ b/test/types/group.rb @@ -28,6 +28,16 @@ class TestGroup < Test::Unit::TestCase super end + def mkgroup(name, hash = {}) + group = nil + hash[:name] = name + assert_nothing_raised { + group = Puppet.type(:group).create(hash) + } + + return group + end + case Facter["operatingsystem"].value when "Darwin": def missing?(group) @@ -287,6 +297,26 @@ class TestGroup < Test::Unit::TestCase assert(missing?(name), "Group %s is still present" % name) end + + # groupadd -o is broken in FreeBSD. + unless Facter["operatingsystem"].value == "FreeBSD" + def test_duplicateIDs + group1 = mkgroup("group1", :gid => 125) + group2 = mkgroup("group2", :gid => 125) + + assert_apply(group1) + + # Not all OSes fail here, so we can't test that it doesn't work with + # it off, only that it does work with it on. + assert_nothing_raised { + group2[:allowdupe] = true + } + assert_apply(group2) + group2.retrieve + assert_equal(:present, group2.state(:ensure).is, + "Group did not get created") + end + end else $stderr.puts "Not running as root; skipping group creation tests." end diff --git a/test/types/user.rb b/test/types/user.rb index 6f34da76f..84a5b577b 100755 --- a/test/types/user.rb +++ b/test/types/user.rb @@ -531,6 +531,31 @@ class TestUser < Test::Unit::TestCase user[:ensure] = :absent assert_apply(user) end + + def test_duplicateIDs + user1 = mkuser("user1") + user1[:uid] = 125 + user2 = mkuser("user2") + user2[:uid] = 125 + + cleanup do + user1[:ensure] = :absent + user2[:ensure] = :absent + assert_apply(user1, user2) + end + + assert_apply(user1) + + # Not all OSes fail here, so we can't test that it doesn't work with + # it off, only that it does work with it on. + assert_nothing_raised { + user2[:allowdupe] = true + } + assert_apply(user2) + user2.retrieve + assert_equal(:present, user2.state(:ensure).is, + "User did not get created") + end else $stderr.puts "Not root; skipping user creation/modification tests" end |
