mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 07:47:44 -02:30
Rewrite tests to use the new modules
This commit is contained in:
3
Makefile
3
Makefile
@@ -371,6 +371,7 @@ prepare_collection_venv:
|
|||||||
$(VENV_BASE)/awx/bin/pip install --target=$(COLLECTION_VENV) git+https://github.com/ansible/tower-cli.git
|
$(VENV_BASE)/awx/bin/pip install --target=$(COLLECTION_VENV) git+https://github.com/ansible/tower-cli.git
|
||||||
|
|
||||||
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
|
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
|
||||||
|
COLLECTION_TEST_TARGET ?=
|
||||||
COLLECTION_PACKAGE ?= awx
|
COLLECTION_PACKAGE ?= awx
|
||||||
COLLECTION_NAMESPACE ?= awx
|
COLLECTION_NAMESPACE ?= awx
|
||||||
COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE)
|
COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE)
|
||||||
@@ -405,7 +406,7 @@ test_collection_sanity: install_collection
|
|||||||
cd $(COLLECTION_INSTALL) && ansible-test sanity
|
cd $(COLLECTION_INSTALL) && ansible-test sanity
|
||||||
|
|
||||||
test_collection_integration: install_collection
|
test_collection_integration: install_collection
|
||||||
cd $(COLLECTION_INSTALL) && ansible-test integration
|
cd $(COLLECTION_INSTALL) && ansible-test integration $(COLLECTION_TEST_TARGET)
|
||||||
|
|
||||||
test_unit:
|
test_unit:
|
||||||
@if [ "$(VENV_BASE)" ]; then \
|
@if [ "$(VENV_BASE)" ]; then \
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: Generate names
|
- name: Generate names
|
||||||
set_fact:
|
set_fact:
|
||||||
scm_cred_name: "AWX-Collection-tests-tower_workflow_template-scm-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
scm_cred_name: "AWX-Collection-tests-tower_workflow_job_template-scm-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
demo_project_name: "AWX-Collection-tests-tower_workflow_template-proj-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
demo_project_name: "AWX-Collection-tests-tower_workflow_job_template-proj-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
jt1_name: "AWX-Collection-tests-tower_workflow_template-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
jt1_name: "AWX-Collection-tests-tower_workflow_job_template-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
jt2_name: "AWX-Collection-tests-tower_workflow_template-jt2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
jt2_name: "AWX-Collection-tests-tower_workflow_job_template-jt2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
wfjt_name: "AWX-Collection-tests-tower_workflow_template-wfjt-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
wfjt_name: "AWX-Collection-tests-tower_workflow_job_template-wfjt-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
|
||||||
|
|
||||||
- name: Create an SCM Credential
|
- name: Create an SCM Credential
|
||||||
tower_credential:
|
tower_credential:
|
||||||
@@ -80,9 +80,8 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Create a workflow job template
|
- name: Create a workflow job template
|
||||||
tower_workflow_template:
|
tower_workflow_job_template:
|
||||||
name: "{{ wfjt_name }}"
|
name: "{{ wfjt_name }}"
|
||||||
schema: [{"success": [{"job_template": "{{ jt1_name }}"}], "job_template": "{{ jt2_name }}"}]
|
|
||||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
@@ -90,8 +89,22 @@
|
|||||||
that:
|
that:
|
||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
|
# Node actions do what this schema command used to do
|
||||||
|
# schema: [{"success": [{"job_template": "{{ jt1_name }}"}], "job_template": "{{ jt2_name }}"}]
|
||||||
|
- name: Create leaf node
|
||||||
|
tower_workflow_job_template_node:
|
||||||
|
identifier: leaf
|
||||||
|
unified_job_template: "{{ jt2_name }}"
|
||||||
|
workflow: "{{ wfjt_name }}"
|
||||||
|
|
||||||
|
- name: Create root node
|
||||||
|
tower_workflow_job_template_node:
|
||||||
|
identifier: root
|
||||||
|
unified_job_template: "{{ jt1_name }}"
|
||||||
|
workflow: "{{ wfjt_name }}"
|
||||||
|
|
||||||
- name: Delete a workflow job template
|
- name: Delete a workflow job template
|
||||||
tower_workflow_template:
|
tower_workflow_job_template:
|
||||||
name: "{{ wfjt_name }}"
|
name: "{{ wfjt_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
@@ -101,16 +114,15 @@
|
|||||||
- "result is changed"
|
- "result is changed"
|
||||||
|
|
||||||
- name: Check module fails with correct msg
|
- name: Check module fails with correct msg
|
||||||
tower_workflow_template:
|
tower_workflow_job_template:
|
||||||
name: "{{ wfjt_name }}"
|
name: "{{ wfjt_name }}"
|
||||||
organization: Non Existing Organization
|
organization: Non Existing Organization
|
||||||
schema: [{"success": [{"job_template": "{{ jt1_name }}"}], "job_template": "{{ jt2_name }}"}]
|
|
||||||
register: result
|
register: result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.msg =='Failed to update organization source,organization not found: The requested object could not be found.'"
|
- "'The organizations Non Existing Organization was not found' in result.msg"
|
||||||
|
|
||||||
- name: Delete the Job Template
|
- name: Delete the Job Template
|
||||||
tower_job_template:
|
tower_job_template:
|
||||||
|
|||||||
Reference in New Issue
Block a user