add assertion to test on number of queries made (#9)

* add assertions around access to resulting job

there is a problem getting the job w/ the user that launched it

add more assertions to bulk tests (#11)

dig more into the results and assert on results
also, use a fixture that already implemented the "max queries" thing

fix ansible collection sanity tests (#12)
This commit is contained in:
Elijah DeLee
2023-02-23 09:00:54 -05:00
parent 7aad16964c
commit 2becc5dda9
5 changed files with 38 additions and 27 deletions

View File

@@ -68,6 +68,7 @@ Notable releases of the `awx.awx` collection:
- 7.0.0 is intended to be identical to the content prior to the migration, aside from changes necessary to function as a collection.
- 11.0.0 has no non-deprecated modules that depend on the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/).
- 19.2.1 large renaming purged "tower" names (like options and module names), adding redirects for old names
- 21.11.0 "tower" modules deprecated and symlinks removed.
- 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable.
The following notes are changes that may require changes to playbooks:

View File

@@ -29,7 +29,7 @@ options:
description:
- The name to use for the host.
type: str
require: True
required: True
description:
description:
- The description to use for the host.
@@ -70,7 +70,7 @@ import json
def main():
# Any additional arguments that are not fields of the item can be added here
argument_spec = dict(
hosts=dict(required=True, type='list'),
hosts=dict(required=True, type='list', elements='dict'),
inventory=dict(required=True, type='int'),
)
@@ -82,8 +82,8 @@ def main():
hosts = module.params.get('hosts')
for h in hosts:
if 'variables' in h:
h['variables'] = json.dumps(h['variables'])
if 'variables' in h:
h['variables'] = json.dumps(h['variables'])
# Launch the jobs
result = module.post_endpoint("bulk/host_create", data={"inventory": inventory, "hosts": hosts})

View File

@@ -205,7 +205,7 @@ from ..module_utils.controller_api import ControllerAPIModule
def main():
# Any additional arguments that are not fields of the item can be added here
argument_spec = dict(
jobs=dict(required=True, type='list'),
jobs=dict(required=True, type='list', elements='dict'),
name=dict(),
description=dict(),
organization=dict(type='int'),
@@ -217,7 +217,6 @@ def main():
skip_tags=dict(),
wait=dict(required=False, default=True, type='bool'),
interval=dict(required=False, default=2.0, type='float'),
timeout=dict(required=False, default=None, type='int'),
)
# Create a module for ourselves

View File

@@ -6,6 +6,7 @@ import pytest
from awx.main.models import WorkflowJob
@pytest.mark.django_db
def test_bulk_job_launch(run_module, admin_user, job_template):
jobs = [dict(unified_job_template=job_template.id)]
@@ -39,4 +40,4 @@ def test_bulk_host_create(run_module, admin_user, inventory):
)
resp_hosts = inventory.hosts.all().values_list('name', flat=True)
for h in hosts:
assert h['name'] in resp_hosts
assert h['name'] in resp_hosts