summaryrefslogtreecommitdiff
path: root/kitchen-tests
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-07-21 16:03:10 -0700
committerTim Smith <tsmith84@gmail.com>2020-07-21 16:24:57 -0700
commit0a10e6a135d76aab768ed997d9bb63a1826c2d52 (patch)
treed2a5f7654021b8e34885d1add76b21f7c36e722f /kitchen-tests
parent135d99c2f1daa01982340aa1cf076d16f9a45cdd (diff)
downloadchef-0a10e6a135d76aab768ed997d9bb63a1826c2d52.tar.gz
Add testing of :delete action and fix failures
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'kitchen-tests')
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_macos_userdefaults.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_macos_userdefaults.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_macos_userdefaults.rb
index 9d61ee5df6..3f907c3428 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/_macos_userdefaults.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_macos_userdefaults.rb
@@ -41,7 +41,7 @@ macos_userdefaults "Bogus key with array value" do
domain "/Library/Preferences/ManagedInstalls"
type "array"
key "LogFileArray"
- value [ '/Library/Managed Installs/fake.log', '/Library/Managed Installs/also_fake.log']
+ value [ "/Library/Managed Installs/fake.log", "/Library/Managed Installs/also_fake.log"]
end
# test that we can set a dict
@@ -49,13 +49,27 @@ macos_userdefaults "Bogus key with dict value" do
domain "/Library/Preferences/ManagedInstalls"
type "dict"
key "LogFileDict"
- value "User": '/Library/Managed Installs/way_fake.log'
+ value "User": "/Library/Managed Installs/way_fake.log"
end
# test that we can set a bool
-macos_userdefaults 'Bogus key with boolean value' do
+macos_userdefaults "Bogus key with boolean value" do
domain "/Library/Preferences/ManagedInstalls"
- key 'LoggingIsTheThingToDoRight'
+ key "LoggingIsTheThingToDoRight"
value "yes"
type "bool"
end
+
+# test that we can handle the 2nd client run with :delete
+macos_userdefaults "bogus key" do
+ domain "/Library/Preferences/com.apple.alf"
+ key "globalstatenope"
+ action :delete
+end
+
+# try to delete a key we known is there
+macos_userdefaults "delete a key" do
+ domain "/Library/Preferences/ManagedInstalls"
+ key "LoggingIsTheThingToDoRight"
+ action :delete
+end