automated integration tests for cloudstack (#20552)

This commit is contained in:
René Moser 2017-05-09 05:32:11 +02:00 committed by Matt Clay
commit aaf4f04574
92 changed files with 1248 additions and 193 deletions

View file

@ -1,6 +1,10 @@
---
- name: setup cleanup
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
cs_sshkeypair: name=first-sshkey state=absent
- name: setup cleanup
cs_sshkeypair: name=second-sshkey state=absent
- name: test fail on missing name
action: cs_sshkeypair
@ -13,7 +17,8 @@
- "sshkey.msg == 'missing required arguments: name'"
- name: test ssh key creation
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
cs_sshkeypair:
name: "first-sshkey"
register: sshkey
- name: verify results of ssh key creation
assert:
@ -22,10 +27,11 @@
- sshkey|changed
- sshkey.fingerprint is defined and sshkey.fingerprint != ""
- sshkey.private_key is defined and sshkey.private_key != ""
- sshkey.name == "{{ cs_resource_prefix }}-sshkey"
- sshkey.name == "first-sshkey"
- name: test ssh key creation idempotence
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey
cs_sshkeypair:
name: "first-sshkey"
register: sshkey2
- name: verify results of ssh key creation idempotence
assert:
@ -34,12 +40,12 @@
- not sshkey2|changed
- sshkey2.fingerprint is defined and sshkey2.fingerprint == sshkey.fingerprint
- sshkey2.private_key is not defined
- sshkey2.name == "{{ cs_resource_prefix }}-sshkey"
- sshkey2.name == "first-sshkey"
- name: test replace ssh public key
cs_sshkeypair: |
name={{ cs_resource_prefix }}-sshkey
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
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: sshkey3
- name: verify results of replace ssh public key
assert:
@ -48,12 +54,12 @@
- sshkey3|changed
- sshkey3.fingerprint is defined and sshkey3.fingerprint != sshkey2.fingerprint
- sshkey3.private_key is not defined
- sshkey3.name == "{{ cs_resource_prefix }}-sshkey"
- sshkey3.name == "first-sshkey"
- name: test replace ssh public key idempotence
cs_sshkeypair: |
name={{ cs_resource_prefix }}-sshkey
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
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: sshkey4
- name: verify results of ssh public key idempotence
assert:
@ -62,10 +68,28 @@
- not sshkey4|changed
- sshkey4.fingerprint is defined and sshkey4.fingerprint == sshkey3.fingerprint
- sshkey4.private_key is not defined
- sshkey4.name == "{{ cs_resource_prefix }}-sshkey"
- sshkey4.name == "first-sshkey"
- name: setup ssh key with name "second-sshke"
cs_sshkeypair:
name: "second-sshkey"
- name: test different but exisitng name but same ssh public key as first-sshkey
cs_sshkeypair:
name: "second-sshkey"
public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsTI7KJZ8tz/CwQIrSol41c6s3vzkGYCMI8o7P9Et48UG9eRoGaMaGYaTvBTj/VQrD7cfurI6Bn0HTT3FLK3OHOweyelm9rIiQ2hjkSl+2lIKWHu992GO58E5Gcy9yYW4sHGgGLNZkPBKrrj0w7lhmiHjPtVnf+2+7Ix1WOO2/HXPcAHhsX/AlyItDewIL4mr/BT83vq0202sPCiM2cFQJl+5WGwS1wYYK8d167cspsmdyX7OyAFCUB0vueuqjE8MFqJvyIJR9y8Lj9Ny71pSV5/QWrXUgELxMYOKSby3gHkxcIXgYBMFLl4DipRTO74OWQlRRaOlqXlOOQbikcY4T rene.moser@swisstxt.ch"
register: sshkey
- name: verify test different but exisitng name but same ssh public key as first-sshkey
assert:
that:
- sshkey|success
- sshkey|changed
- sshkey.fingerprint is defined and sshkey.fingerprint == sshkey4.fingerprint
- sshkey.private_key is not defined
- sshkey.name == "second-sshkey"
- name: test ssh key absent
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
cs_sshkeypair: name=second-sshkey state=absent
register: sshkey5
- name: verify result of key absent
assert:
@ -74,10 +98,10 @@
- sshkey5|changed
- sshkey5.fingerprint is defined and sshkey5.fingerprint == sshkey3.fingerprint
- sshkey5.private_key is not defined
- sshkey5.name == "{{ cs_resource_prefix }}-sshkey"
- sshkey5.name == "second-sshkey"
- name: test ssh key absent idempotence
cs_sshkeypair: name={{ cs_resource_prefix }}-sshkey state=absent
cs_sshkeypair: name=second-sshkey state=absent
register: sshkey6
- name: verify result of ssh key absent idempotence
assert: