summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2015-07-10 13:57:15 -0400
committerBrian Coca <bcoca@ansible.com>2015-07-10 13:57:15 -0400
commitc6dde19a5e2847d685c3b350b47690f0d0ea380a (patch)
treed0f058d9ca652c597a0da3cd3efdadca13009a66
parent4608897c27c2f86c4582c733e15f93e7d56aab07 (diff)
parent32685f96483da3b36bdddb7f9b412d69e9460e7b (diff)
downloadansible-c6dde19a5e2847d685c3b350b47690f0d0ea380a.tar.gz
Merge pull request #11537 from chrismeyersfsu/azure-test
assert password or ssh key provided on new image creation
-rw-r--r--test/integration/credentials.template4
-rw-r--r--test/integration/roles/test_azure/tasks/main.yml36
2 files changed, 36 insertions, 4 deletions
diff --git a/test/integration/credentials.template b/test/integration/credentials.template
index 78594aca97..fb052a42c2 100644
--- a/test/integration/credentials.template
+++ b/test/integration/credentials.template
@@ -14,8 +14,8 @@ pem_file:
project_id:
# Azure Credentials
-azure_subscription_id:
-azure_cert_path:
+azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
+azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
# GITHUB SSH private key - a path to a SSH private key for use with github.com
github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa"
diff --git a/test/integration/roles/test_azure/tasks/main.yml b/test/integration/roles/test_azure/tasks/main.yml
index cba93e3d65..a4d5d7ef59 100644
--- a/test/integration/roles/test_azure/tasks/main.yml
+++ b/test/integration/roles/test_azure/tasks/main.yml
@@ -6,6 +6,9 @@
azure:
register: result
ignore_errors: true
+ environment:
+ AZURE_SUBSCRIPTION_ID: ""
+ AZURE_CERT_PATH: ""
- name: assert failure when called with no credentials
assert:
@@ -14,6 +17,7 @@
- 'result.msg == "No subscription_id provided. Please set ''AZURE_SUBSCRIPTION_ID'' or use the ''subscription_id'' parameter"'
# ============================================================
+
- name: test credentials
azure:
subscription_id: "{{ subscription_id }}"
@@ -28,6 +32,27 @@
- 'result.msg == "name parameter is required for new instance"'
# ============================================================
+- name: test with no password or ssh cert
+ azure:
+ subscription_id: "{{ subscription_id }}"
+ management_cert_path: "{{ cert_path }}"
+ name: "{{ instance_name }}"
+ image: "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_4-LTS-amd64-server-20140514-en-us-30GB"
+ storage_account: "{{ storage_account }}"
+ user: "{{ user }}"
+ role_size: "{{ role_size }}"
+ location: "{{ location }}"
+ state: present
+ register: result
+ ignore_errors: true
+
+- name: assert failure when called with no password or ssh cert
+ assert:
+ that:
+ - 'result.failed'
+ - 'result.msg == "password or ssh_cert_path parameter is required for new instance"'
+
+# ============================================================
- name: test status=Running (expected changed=true)
azure:
subscription_id: "{{ subscription_id }}"
@@ -41,6 +66,7 @@
location: "{{ location }}"
wait: yes
state: present
+ wait_timeout: 1200
register: result
- name: assert state=Running (expected changed=true)
@@ -56,8 +82,14 @@
subscription_id: "{{ subscription_id }}"
management_cert_path: "{{ cert_path }}"
name: "{{ instance_name }}"
- #storage_account: "{{ storage_account }}"
- #location: "{{ location }}"
wait: yes
state: absent
+ wait_timeout: 1200
register: result
+
+- name: assert named deployment changed (expected changed=true)
+ assert:
+ that:
+ - 'result.changed'
+ - 'result.deployment.name == "{{ instance_name }}"'
+