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

Address the 404 errors in swagger checks #15204

Closed
wants to merge 3 commits into from

Conversation

AlanCoding
Copy link
Member

SUMMARY

Troubleshooting schema failures due to a recent DAB change, the output is swamped by:

2024-05-17T14:13:03.6034850Z Traceback (most recent call last):
2024-05-17T14:13:03.6035405Z   File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/drf_yasg/inspectors/base.py", line 42, in call_view_method
2024-05-17T14:13:03.6035504Z     return view_method()
2024-05-17T14:13:03.6035586Z            ^^^^^^^^^^^^^
2024-05-17T14:13:03.6035791Z   File "/awx_devel/awx/api/generics.py", line 538, in get_queryset
2024-05-17T14:13:03.6035907Z     parent = self.get_parent_object()
2024-05-17T14:13:03.6035997Z              ^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-17T14:13:03.6036225Z   File "/awx_devel/awx/api/generics.py", line 498, in get_parent_object
2024-05-17T14:13:03.6036475Z     self.parent_object = get_object_or_404(self.parent_model, **parent_filter)
2024-05-17T14:13:03.6036612Z                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-17T14:13:03.6037135Z   File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/shortcuts.py", line 87, in get_object_or_404
2024-05-17T14:13:03.6037331Z     raise Http404(
2024-05-17T14:13:03.6037637Z django.http.response.Http404: No WorkflowJobTemplateNode matches the given query.
2024-05-17T14:13:03.6038652Z WARNING  drf_yasg.inspectors.base:base.py:44 view's WorkflowJobNodeInstanceGroupsList raised exception during schema generation; use `getattr(self, 'swagger_fake_view', False)` to detect and short-circuit this
2024-05-17T14:13:03.6038763Z Traceback (most recent call last):
2024-05-17T14:13:03.6039283Z   File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/shortcuts.py", line 85, in get_object_or_404
2024-05-17T14:13:03.6039403Z     return queryset.get(*args, **kwargs)
2024-05-17T14:13:03.6039497Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-17T14:13:03.6039984Z   File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/db/models/query.py", line 637, in get
2024-05-17T14:13:03.6040103Z     raise self.model.DoesNotExist(
2024-05-17T14:13:03.6040522Z awx.main.models.workflow.WorkflowJobNode.DoesNotExist: WorkflowJobNode matching query does not exist.
2024-05-17T14:13:03.6040591Z 

...and other similar output. This is not the actual error. No. @TheRealHaoLiu recently identified this, but in doing so I'm not sure if anyone even looked at the actual problem. This PR isn't addressing that problem. This is only trying to cut through the weeds that blocks our view of the problem.

A sample output from #15202 in the swagger check gives 46,969 lines. There's some noisy setup (which we have other solutions for), but then about 10% of the way in, it's this same error for the entire rest of the output. But this is a suppressed error, given as a warning.

Here is a sample output of the current problem, after accomplishing this fix:

https://gist.github.com/AlanCoding/fb44e008939875b9434117c7632ba4aa

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

What is going on here?

All tests are transactional. I'm aware we have a "piggyback" method to identify URLs in other tests and use them in later schema tests. Problem is that any objects that might have played a role won't exist... because the transactions of the prior tests are over.

Exasperated, I use their hook to identify that the call is only for schema generation to give any available object. This also requires creating an object of every type where the queryset requires looking up a parent object.

This also requires a supporting DAB change which does basically the same thing.

@AlanCoding
Copy link
Member Author

Abandoning for now, in the belief that there must be a better way.

@AlanCoding AlanCoding closed this May 20, 2024
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.

None yet

1 participant