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

class KeyError 'validity_tests' when running tests #134

Closed
ArmansPing opened this issue Oct 15, 2024 · 4 comments · Fixed by #135
Closed

class KeyError 'validity_tests' when running tests #134

ArmansPing opened this issue Oct 15, 2024 · 4 comments · Fixed by #135

Comments

@ArmansPing
Copy link

Validity Version

3.0.4

NetBox Version

4.1.3

Python Version

3.12.3

Steps to Reproduce

An error occured when "Run Tests"

<class 'KeyError'>

'validity_tests'

Python Version: 3.12.3
NetBox Version: 4.1.3
Plugins:
netbox_napalm_plugin: 0.3.0
validity: 3.0.4

Traceback

No response

@amyasnikov
Copy link
Owner

Hey @ArmansPing, please provide the following info:

  1. Traceback of the error. You can find it in the terminal (depending on your installation you can use something like docker logs or journalctl -u)
  2. Detailed sequence of the steps to reproduce the error on a clean netbox/validity setup.

Without both of these points I can't reproduce (and fix) the error.

@amyasnikov
Copy link
Owner

Unfortunately, there is still no traceback, please try to find it.
Python traceback usually looks like this:

Traceback (most recent call last):
  File "/path/to/project/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/path/to/project/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 204, in _get_response
    response = response.render()
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/response.py", line 81, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/response.py", line 63, in resolve_template
    return select_template(template_name_list)
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/loader.py", line 47, in select_template
    return engine.get_template(template_name)
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/backends/django.py", line 34, in get_template
    return Template(self.engine.get_template(template_name))
  File "/path/to/project/venv/lib/python3.9/site-packages/django/template/engine.py", line 143, in get_template
    template = self._cached_templates[template_name]
KeyError: 'non_existent_template.html'

@ArmansPing
Copy link
Author

ArmansPing commented Oct 17, 2024

Hi, I enabled the debug mode of netbox, belows are the traceback:

netbox-1  | Internal Server Error: /plugins/validity/tests/run/
netbox-1  | Traceback (most recent call last):
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
netbox-1  |     response = get_response(request)
netbox-1  |                ^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
netbox-1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
netbox-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 97, in view
netbox-1  |     self = cls(**initkwargs)
netbox-1  |            ^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/dimi/di.py", line 102, in sync_wrapper
netbox-1  |     kwargs |= {kw.name: kw.getattrs(self._deps.resolve(kw.func)) for kw in extra_kwargs}
netbox-1  |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/dimi/_storage.py", line 70, in resolve
netbox-1  |     return self._resolve_sync(key)()
netbox-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/dimi/dependency.py", line 54, in __call__
netbox-1  |     return self.scope(**self.resolved)
netbox-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/dimi/scopes.py", line 93, in _call
netbox-1  |     return super()._call(*args, **kwargs)
netbox-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/dimi/scopes.py", line 55, in _call
netbox-1  |     result = self.func(*args, **kwargs)
netbox-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/validity/dependencies.py", line 55, in runtests_launcher
netbox-1  |     rq_queue=django_rq.get_queue(vsettings.runtests_queue),
netbox-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1  |   File "/opt/netbox/venv/lib/python3.12/site-packages/django_rq/queues.py", line 172, in get_queue
netbox-1  |     is_async = QUEUES[name].get('ASYNC', True)
netbox-1  |                ~~~~~~^^^^^^
netbox-1  | KeyError: 'validity_tests'

@amyasnikov
Copy link
Owner

@ArmansPing the error was caused by custom queue name for running tests (validity_tests), which did not exist. You can either wait for the next release to get this fixed or just use an existing queue name (e.g. default or high) as a workaround

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

Successfully merging a pull request may close this issue.

2 participants