Further refine error message and update integration tests

Fix test with spaces

pep8 failure

More test tweaks

Even more test fixes
This commit is contained in:
Alan Rominger
2020-09-09 16:41:59 -04:00
parent a73323f3d6
commit 2e1f5cebb7
11 changed files with 63 additions and 38 deletions

View File

@@ -288,7 +288,7 @@
- name: Create an invalid SSH credential (Organization not found)
tower_credential:
name: SSH Credential
organization: Missing Organization
organization: Missing_Organization
state: present
kind: ssh
username: joe
@@ -298,7 +298,9 @@
- assert:
that:
- "result is failed"
- "'The organizations Missing Organization was not found on the Tower server' in result.msg"
- "result is not changed"
- "'Missing_Organization' in result.msg"
- "result.total_results == 0"
- name: Delete an SSH credential
tower_credential:
@@ -750,5 +752,7 @@
- assert:
that:
- result is failed
- "result.msg =='The organizations test-non-existing-org was not found on the Tower server'"
- "result is failed"
- "result is not changed"
- "'test-non-existing-org' in result.msg"
- "result.total_results == 0"

View File

@@ -51,8 +51,10 @@
- assert:
that:
- "result.msg =='Failed to update the group, inventory not found: The requested object could not be found.' or
result.msg =='The inventories test-non-existing-inventory was not found on the Tower server'"
- "result is failed"
- "result is not changed"
- "'test-non-existing-inventory' in result.msg"
- "result.total_results == 0"
- name: add hosts
tower_host:

View File

@@ -46,5 +46,6 @@
- assert:
that:
- "result.msg =='The inventories test-non-existing-inventory was not found on the Tower server' or
result.msg =='Failed to update host, inventory not found: The requested object could not be found.'"
- "result is failed"
- "'test-non-existing-inventory' in result.msg"
- "result.total_results == 0"

View File

@@ -119,9 +119,11 @@
- assert:
that:
- "result is failed"
- "result is not changed"
- "result.msg =='Failed to update inventory, organization not found: The requested object could not be found.'
or result.msg =='The organizations test-non-existing-org was not found on the Tower server'"
- "'test-non-existing-org' in result.msg"
- "result.total_results == 0"
always:
- name: Delete Inventories
tower_inventory:

View File

@@ -29,16 +29,16 @@
- name: Check module fails with correct msg
tower_job_launch:
job_template: "Non Existing Job Template"
inventory: "Test Inventory"
credential: "Test Credential"
job_template: "Non_Existing_Job_Template"
inventory: "Demo Inventory"
register: result
ignore_errors: true
- assert:
that:
- "result.msg =='Unable to launch job, job_template/Non Existing Job Template was not found: The requested object could not be found.'
or result.msg == 'The inventories Test Inventory was not found on the Tower server'"
- "result is failed"
- "result is not changed"
- "'Non_Existing_Job_Template' in result.msg"
- name: Create a Job Template for testing prompt on launch
tower_job_template:

View File

@@ -12,13 +12,16 @@
- name: Check module fails with correct msg
tower_label:
name: "Test Label"
organization: "Non existing org"
organization: "Non_existing_org"
state: present
register: result
ignore_errors: true
- assert:
that:
- "'Non existing org was not found on the Tower server' in result.msg"
- "result is failed"
- "result is not changed"
- "'Non_existing_org' in result.msg"
- "result.total_results == 0"
# TODO: Deleting labels doesn't seem to work currently

View File

@@ -93,7 +93,7 @@
- name: Check module fails with correct msg when given non-existing org as param
tower_project:
name: "{{ project_name2 }}"
organization: Non Existing Org
organization: Non_Existing_Org
scm_type: git
scm_url: https://github.com/ansible/test-playbooks
scm_credential: "{{ cred_name }}"
@@ -102,8 +102,10 @@
- assert:
that:
- "result.msg == 'The organizations Non Existing Org was not found on the Tower server' or
result.msg == 'Failed to update project, organization not found: Non Existing Org'"
- "result is failed"
- "result is not changed"
- "'Non_Existing_Org' in result.msg"
- "result.total_results == 0"
- name: Check module fails with correct msg when given non-existing credential as param
tower_project:
@@ -111,14 +113,16 @@
organization: "{{ org_name }}"
scm_type: git
scm_url: https://github.com/ansible/test-playbooks
scm_credential: Non Existing Credential
scm_credential: Non_Existing_Credential
register: result
ignore_errors: true
- assert:
that:
- "result.msg =='The credentials Non Existing Credential was not found on the Tower server' or
result.msg =='Failed to update project, credential not found: Non Existing Credential'"
- "result is failed"
- "result is not changed"
- "'Non_Existing_Credential' in result.msg"
- "result.total_results == 0"
- name: Create a git project without credentials without waiting
tower_project:

View File

@@ -6,7 +6,7 @@
- name: Attempt to add a Tower team to a non-existant Organization
tower_team:
name: Test Team
organization: Missing Organization
organization: Missing_Organization
state: present
register: result
ignore_errors: true
@@ -14,9 +14,10 @@
- name: Assert a meaningful error was provided for the failed Tower team creation
assert:
that:
- result is failed
- "result.msg =='Failed to update team, organization not found: The requested object could not be found.' or
result.msg =='The organizations Missing Organization was not found on the Tower server'"
- "result is failed"
- "result is not changed"
- "'Missing_Organization' in result.msg"
- "result.total_results == 0"
- name: Create a Tower team
tower_team:
@@ -42,12 +43,15 @@
- name: Check module fails with correct msg
tower_team:
name: "{{ team_name }}"
organization: Non Existing Org
organization: Non_Existing_Org
state: present
register: result
ignore_errors: true
- assert:
- name: Lookup of the related organization should cause a failure
assert:
that:
- "result.msg =='Failed to update team, organization not found: The requested object could not be found.' or
result.msg =='The organizations Non Existing Org was not found on the Tower server'"
- "result is failed"
- "result is not changed"
- "'Non_Existing_Org' in result.msg"
- "result.total_results == 0"

View File

@@ -207,13 +207,16 @@
- name: Check module fails with correct msg
tower_workflow_job_template:
name: "{{ wfjt_name }}"
organization: Non Existing Organization
organization: Non_Existing_Organization
register: result
ignore_errors: true
- assert:
that:
- "'The organizations Non Existing Organization was not found' in result.msg"
- "result is failed"
- "result is not changed"
- "'Non_Existing_Organization' in result.msg"
- "result.total_results == 0"
- name: Delete the Job Template
tower_job_template: