summaryrefslogtreecommitdiff
path: root/test/integration/targets/cron
diff options
context:
space:
mode:
authorEmmanuel MICKIEWICZ <emickiewicz@users.noreply.github.com>2020-02-15 15:52:36 +0100
committerGitHub <noreply@github.com>2020-02-15 14:52:36 +0000
commit8647d0a8733b3250673eecc6eb55c94917ce8c9e (patch)
tree11b28ac5a80cdf669027d86333104081ef55dcd3 /test/integration/targets/cron
parentfe6848baddaf5a5e872e91b428cdec3f9b1bc1cb (diff)
downloadansible-8647d0a8733b3250673eecc6eb55c94917ce8c9e.tar.gz
Removing a cron file when the 'name' parameter is specified is now allowed (#57471). Added integration tests to validate new behavior. (#65640)
Also added user input validation to return a clear error when deleting an environment variables without specifying a name.
Diffstat (limited to 'test/integration/targets/cron')
-rw-r--r--test/integration/targets/cron/tasks/main.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/integration/targets/cron/tasks/main.yml b/test/integration/targets/cron/tasks/main.yml
index cc892c8e06..155fc2d580 100644
--- a/test/integration/targets/cron/tasks/main.yml
+++ b/test/integration/targets/cron/tasks/main.yml
@@ -99,3 +99,26 @@
- assert:
that: remove_cron_file is not changed
+
+- name: Removing a cron file when the name is specified is allowed (#57471)
+ block:
+ - name: Cron file creation
+ cron:
+ cron_file: cron_filename
+ name: "integration test cron"
+ job: 'ls'
+ user: root
+
+ - name: Cron file deletion
+ cron:
+ cron_file: cron_filename
+ name: "integration test cron"
+ state: absent
+
+ - name: Check file succesfull deletion
+ stat:
+ path: /etc/cron.d/cron_filename
+ register: cron_file_stats
+
+ - assert:
+ that: not cron_file_stats.stat.exists