mirror of
https://github.com/ansible/awx.git
synced 2026-11-22 16:26:10 -03:30
Previously a job template would always block another job template launch regardless of the details of the job template. We now restrict that blocking logic to only block in the case that the job template was launched with the same inventory. We keep the exclusion where if the launch type is 'callback' and the limits differ then they won't be blocked
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from awx.main.models import Job
|
|
|
|
import pytest
|
|
|
|
@pytest.mark.django_db
|
|
def test_job_blocking(get, post, job_template, inventory, inventory_factory):
|
|
j1 = Job.objects.create(job_template=job_template,
|
|
inventory=inventory)
|
|
j2 = Job.objects.create(job_template=job_template,
|
|
inventory=inventory)
|
|
assert j1.is_blocked_by(j2)
|
|
j2.inventory = inventory_factory(name='test-different-inventory')
|
|
assert not j1.is_blocked_by(j2)
|
|
j_callback_1 = Job.objects.create(job_template=job_template,
|
|
inventory=inventory,
|
|
launch_type='callback',
|
|
limit='a')
|
|
j_callback_2 = Job.objects.create(job_template=job_template,
|
|
inventory=inventory,
|
|
launch_type='callback',
|
|
limit='a')
|
|
assert j_callback_1.is_blocked_by(j_callback_2)
|
|
j_callback_2.limit = 'b'
|
|
assert not j_callback_1.is_blocked_by(j_callback_2)
|