Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where unrelated jobs were linked as dependencies #15610

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

AlanCoding
Copy link
Member

SUMMARY

This used a wrong variable in a loop, where dependencies was a cumulative list for every task seen in the loop, but job_deps were the dependencies for the one task being looked at. The point was to simply save the job's dependencies, but using the global variable, we kind of saved every dependency seen by that single run as a dependency of the job. This was seen adding an inventory update as a dependency of itself... logically because a prior task in the loop had the inventory update as a dependency, and the inventory update, itself, later in the loop, produced a project update dependency. So it added the 2 dependencies, the inventory update, a dependency for some other random job, and the project update, to the dependency list of the inventory update.

Test failure without code change:

  File "/home/alancoding/repos/awx/awx/main/tests/functional/task_management/test_scheduler.py", line 425, in test_dependency_isolation
    assert (inv_update.dependent_jobs.count(), job.dependent_jobs.count()) == (1, 1)
AssertionError: assert (1, 2) == (1, 1)
  
  At index 1 diff: 2 != 1
  Use -v to get more diff

Important to note the 1st entry, 1, which means the first task to be processed got the correct dependencies linked.

It is only the later items in the loop, the 2nd item here, which gets linked to its own deps and erroneous deps of prior tasks processed. Giving 2, having added its own dep to the 1 before. This is not good, both examples in the test are simple cases, totally isolated from each other, that only produce 1 dependency.

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API

Copy link

sonarcloud bot commented Nov 1, 2024

Copy link
Member

@fosterseth fosterseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants