From 6fc88992900a97cff3242708865345bddff7d61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Thu, 24 Aug 2017 15:09:11 +0200 Subject: [PATCH] test: yum: add test cases for state=latest (#28575) * test: yum: add test with state=latest * test: yum: extend test cases with check mode --- test/integration/targets/yum/tasks/yum.yml | 84 +++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml index b5db19aa656..180a4696c7d 100644 --- a/test/integration/targets/yum/tasks/yum.yml +++ b/test/integration/targets/yum/tasks/yum.yml @@ -15,6 +15,16 @@ - "rpm_result.rc == 1" # UNINSTALL AGAIN +- name: uninstall sos again in check mode + yum: name=sos state=removed + check_mode: true + register: yum_result + +- name: verify no change on re-uninstall in check mdoe + assert: + that: + - "not yum_result.changed" + - name: uninstall sos again yum: name=sos state=removed register: yum_result @@ -25,6 +35,16 @@ - "not yum_result.changed" # INSTALL +- name: install sos in check mode + yum: name=sos state=present + check_mode: true + register: yum_result + +- name: verify installation of sos in check mode + assert: + that: + - "yum_result.changed" + - name: install sos yum: name=sos state=present register: yum_result @@ -50,15 +70,75 @@ - "'results' in yum_result" # INSTALL AGAIN +- name: install sos again in check mode + yum: name=sos state=present + check_mode: true + register: yum_result +- name: verify no change on second install in check mode + assert: + that: + - "not yum_result.changed" + - name: install sos again yum: name=sos state=present register: yum_result - - name: verify no change on second install assert: that: - "not yum_result.changed" +# INSTALL AGAIN WITH LATEST +- name: install sos again with state latest in check mode + yum: name=sos state=latest + check_mode: true + register: yum_result +- name: verify install sos again with state latest in check mode + assert: + that: + - "not yum_result.changed" + +- name: install sos again with state latest idempotence + yum: name=sos state=latest + register: yum_result +- name: verify install sos again with state latest idempotence + assert: + that: + - "not yum_result.changed" + +# INSTALL WITH LATEST +- name: uninstall sos + yum: name=sos state=removed + register: yum_result +- name: verify uninstall sos + assert: + that: + - "yum_result|success" + +- name: install sos with state latest in check mode + yum: name=sos state=latest + check_mode: true + register: yum_result +- name: verify install sos with state latest in check mode + assert: + that: + - "yum_result.changed" + +- name: install sos with state latest + yum: name=sos state=latest + register: yum_result +- name: verify install sos with state latest + assert: + that: + - "yum_result.changed" + +- name: install sos with state latest idempotence + yum: name=sos state=latest + register: yum_result +- name: verify install sos with state latest idempotence + assert: + that: + - "not yum_result.changed" + # Multiple packages - name: uninstall sos and bc yum: name=sos,bc state=removed @@ -163,7 +243,7 @@ - name: uninstall sos and bc yum: name=sos,bc state=removed -- name: install non-existent rpm +- name: install non-existent rpm yum: name="{{ item }}" with_items: - does-not-exist