summaryrefslogtreecommitdiffstats
path: root/awx_collection/tests
diff options
context:
space:
mode:
authorbeeankha <bstohrer@redhat.com>2020-09-01 17:35:37 +0200
committerbeeankha <bstohrer@redhat.com>2020-09-04 16:19:56 +0200
commit1ce5d7d539af59f50fc38332b533b641ae63f8da (patch)
tree77c475b150a5242330f917888b599b72c21627cc /awx_collection/tests
parentFix linter error (diff)
downloadawx-1ce5d7d539af59f50fc38332b533b641ae63f8da.tar.xz
awx-1ce5d7d539af59f50fc38332b533b641ae63f8da.zip
Add ability to look up inventory sources by org name/ID
Diffstat (limited to 'awx_collection/tests')
-rw-r--r--awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml29
1 files changed, 26 insertions, 3 deletions
diff --git a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml
index 2a5fb76d6b..7207541838 100644
--- a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml
+++ b/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml
@@ -9,13 +9,20 @@
inv_name: "AWX-Collection-tests-tower_inventory_source_update-inv-{{ test_id }}"
inv_source1: "AWX-Collection-tests-tower_inventory_source_update-source1-{{ test_id }}"
inv_source2: "AWX-Collection-tests-tower_inventory_source_update-source2-{{ test_id }}"
+ org_name: "AWX-Collection-tests-tower_inventory_source_update-org-{{ test_id }}"
- block:
+
+ - name: "Create a new organization"
+ tower_organization:
+ name: "{{ org_name }}"
+ register: created_org
+
- name: Create a git project without credentials
tower_project:
name: "{{ project_name }}"
- organization: Default
+ organization: "{{ org_name }}"
scm_type: git
scm_url: https://github.com/ansible/test-playbooks
wait: true
@@ -23,7 +30,14 @@
- name: Create an Inventory
tower_inventory:
name: "{{ inv_name }}"
- organization: Default
+ organization: "{{ org_name }}"
+ state: present
+ register: created_inventory
+
+ - name: Create another inventory w/ same name
+ tower_inventory:
+ name: "{{ inv_name }}"
+ organization: "{{ org_name }}"
state: present
register: created_inventory
@@ -34,21 +48,24 @@
source_project: "{{ project_name }}"
source_path: inventories/inventory.ini
description: Source for Test inventory
+ organization: "{{ created_org.id }}"
inventory: "{{ inv_name }}"
- - name: Create Another Inventory Source
+ - name: Create Another Inventory Source (for testing org-based lookup)
tower_inventory_source:
name: "{{ inv_source2 }}"
source: scm
source_project: "{{ project_name }}"
source_path: inventories/create_10_hosts.ini
description: Source for Test inventory
+ organization: Default
inventory: "{{ inv_name }}"
- name: Test Inventory Source Update
tower_inventory_source_update:
inventory: "{{ inv_name }}"
inventory_source: "{{ inv_source1 }}"
+ organization: Default
register: result
- assert:
@@ -59,6 +76,7 @@
tower_inventory_source_update:
inventory: "{{ inv_name }}"
inventory_source: "{{ item }}"
+ organization: "{{ created_org.id }}"
loop: "{{ query('awx.awx.tower_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, return_ids=True ) }}"
register: result
@@ -78,3 +96,8 @@
name: "{{ project_name }}"
organization: Default
state: absent
+
+ - name: "Remove the organization"
+ tower_organization:
+ name: "{{ org_name }}"
+ state: absent