From fd5066d6711fb86152bb5798c976b7e40a5ea140 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 23 Oct 2018 15:34:18 +0100 Subject: [PATCH] tests: teach various tests to cleanup /tmp when they're done. --- tests/ansible/integration/action/copy.yml | 17 +++++++++++++++++ .../integration/action/fixup_perms2__copy.yml | 13 +++++++++++++ .../ansible/integration/action/synchronize.yml | 10 ++++++++++ 3 files changed, 40 insertions(+) diff --git a/tests/ansible/integration/action/copy.yml b/tests/ansible/integration/action/copy.yml index e3fca87f..d799be90 100644 --- a/tests/ansible/integration/action/copy.yml +++ b/tests/ansible/integration/action/copy.yml @@ -64,3 +64,20 @@ - stat.results[2].stat.checksum == "b26dd6444595e2bdb342aa0a91721b57478b5029" - stat.results[3].stat.checksum == "d675f47e467eae19e49032a2cc39118e12a6ee72" + - file: + state: absent + path: "{{item}}" + with_items: + - /tmp/copy-tiny-file + - /tmp/copy-tiny-file.out + - /tmp/copy-no-mode + - /tmp/copy-no-mode.out + - /tmp/copy-with-mode + - /tmp/copy-with-mode.out + - /tmp/copy-large-file + - /tmp/copy-large-file.out + - /tmp/copy-tiny-inline-file.out + - /tmp/copy-large-inline-file + - /tmp/copy-large-inline-file.out + + # end of cleaning out files (again) diff --git a/tests/ansible/integration/action/fixup_perms2__copy.yml b/tests/ansible/integration/action/fixup_perms2__copy.yml index 7e6ef522..c92b158e 100644 --- a/tests/ansible/integration/action/fixup_perms2__copy.yml +++ b/tests/ansible/integration/action/fixup_perms2__copy.yml @@ -102,3 +102,16 @@ - assert: that: - out.stat.mode == "1461" + + - file: + state: absent + path: "{{item}}" + with_items: + - /tmp/weird-mode + - /tmp/weird-mode.out + - /tmp/copy-no-mode + - /tmp/copy-no-mode.out + - /tmp/copy-with-mode + - /tmp/copy-with-mode.out + + # end of cleaning out files diff --git a/tests/ansible/integration/action/synchronize.yml b/tests/ansible/integration/action/synchronize.yml index 2672b08e..25649fbf 100644 --- a/tests/ansible/integration/action/synchronize.yml +++ b/tests/ansible/integration/action/synchronize.yml @@ -32,6 +32,7 @@ - file: path: /tmp/sync-test.out state: absent + become: true - synchronize: private_key: /tmp/synchronize-action-key @@ -46,3 +47,12 @@ - assert: that: outout == "item!" + + - file: + path: "{{item}}" + state: absent + become: true + with_items: + - /tmp/synchronize-action-key + - /tmp/sync-test + - /tmp/sync-test.out