summaryrefslogtreecommitdiff
path: root/test/integration/targets/cs_sshkeypair
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2017-05-26 12:19:47 +0200
committerGitHub <noreply@github.com>2017-05-26 12:19:47 +0200
commitd5b04aa1f16bfef43799a89c57d3bcfa8bcfbd40 (patch)
tree83b1600c7e609e903417bcd1df3f4df7e647637e /test/integration/targets/cs_sshkeypair
parent2af5556901f0847d835af60f58769a8dd94c4415 (diff)
downloadansible-d5b04aa1f16bfef43799a89c57d3bcfa8bcfbd40.tar.gz
cloudstack: add check mode tests (#24908)
* cloudstack: test: cs_network_acl: add check_mode tests * cloudstack: test: cs_pod: add check_mode tests * cloudstack: test: cs_user: add check_mode tests * cloudstack: test: cs_sshkeypair: add check_mode tests * cloudstack: test: cs_project: add check_mode tests * cloudstack: test: cs_vpc: add check_mode tests * cloudstack: test: cs_vpn_gateway: add check_mode tests * cloudstack: test: cs_volume: add check_mode tests * cloudstack: test: cs_vmsnapshot: add check_mode tests * cloudstack: test: cs_account: add check_mode tests * cloudstack: test: cs_affinitygroup: add check_mode tests * cloudstack: test: cs_cluster: add check_mode tests * cloudstack: test: cs_domain: add check_mode tests * cloudstack: test: cs_instancegroup: add check_mode tests * cloudstack: test: cs_iso: add check_mode tests * cloudstack: test: cs_loadbalancer_rule: add check_mode tests * cloudstack: test: cs_portforward: add check_mode tests * cloudstack: test: cs_resourcelimit: add check_mode tests * cloudstack: test: cs_securitygroup: add check_mode tests * cloudstack: test: cs_securitygroup_rule: add check_mode tests * cloudstack: test: cs_configuration: add check_mode tests * cloudstack: test: cs_firewall: add check_mode tests * cloudstack: test: cs_instance: add check_mode tests * cloudstack: query current tags from API Fixes unexpected tags returned in check mode.
Diffstat (limited to 'test/integration/targets/cs_sshkeypair')
-rw-r--r--test/integration/targets/cs_sshkeypair/tasks/main.yml40
1 files changed, 39 insertions, 1 deletions
diff --git a/test/integration/targets/cs_sshkeypair/tasks/main.yml b/test/integration/targets/cs_sshkeypair/tasks/main.yml
index f3d7d5296e..8fc18f2f8a 100644
--- a/test/integration/targets/cs_sshkeypair/tasks/main.yml
+++ b/test/integration/targets/cs_sshkeypair/tasks/main.yml
@@ -5,7 +5,6 @@
- name: setup cleanup
cs_sshkeypair: name=second-sshkey state=absent
-
- name: test fail on missing name
action: cs_sshkeypair
ignore_errors: true
@@ -16,6 +15,17 @@
- sshkey|failed
- "sshkey.msg == 'missing required arguments: name'"
+- name: test ssh key creation in check mode
+ cs_sshkeypair:
+ name: "first-sshkey"
+ register: sshkey
+ check_mode: true
+- name: verify results of ssh key creation in check mode
+ assert:
+ that:
+ - sshkey|success
+ - sshkey|changed
+
- name: test ssh key creation
cs_sshkeypair:
name: "first-sshkey"
@@ -42,6 +52,21 @@
- sshkey2.private_key is not defined
- sshkey2.name == "first-sshkey"
+- name: test replace ssh public key in check mode
+ cs_sshkeypair:
+ name: "first-sshkey"
+ public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
+ register: sshkey2
+ check_mode: true
+- name: verify results of replace ssh public key in check mode
+ assert:
+ that:
+ - sshkey2|success
+ - sshkey2|changed
+ - sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint
+ - sshkey2.private_key is not defined
+ - sshkey2.name == "first-sshkey"
+
- name: test replace ssh public key
cs_sshkeypair:
name: "first-sshkey"
@@ -88,6 +113,19 @@
- sshkey.private_key is not defined
- sshkey.name == "second-sshkey"
+- name: test ssh key absent in check mode
+ cs_sshkeypair: name=second-sshkey state=absent
+ register: sshkey5
+ check_mode: true
+- name: verify result of key absent in check mode
+ assert:
+ that:
+ - sshkey5|success
+ - sshkey5|changed
+ - sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint
+ - sshkey5.private_key is not defined
+ - sshkey5.name == "second-sshkey"
+
- name: test ssh key absent
cs_sshkeypair: name=second-sshkey state=absent
register: sshkey5