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

Failed tests running in Dev Container (Webhook and Release Test) #154

Closed
smk4664 opened this issue Mar 16, 2021 · 5 comments · Fixed by #190
Closed

Failed tests running in Dev Container (Webhook and Release Test) #154

smk4664 opened this issue Mar 16, 2021 · 5 comments · Fixed by #190
Labels
type: bug Something isn't working as expected type: housekeeping Changes to the application which do not directly impact the end user
Milestone

Comments

@smk4664
Copy link
Contributor

smk4664 commented Mar 16, 2021

Environment

  • Python version: 3.8.9
  • Nautobot version: 1.0.0b2

Steps to Reproduce

  1. Clone Repo
  2. Open dev container in VSCode
  3. run nautobot-server test

Expected Behavior

All Tests pass

Observed Behavior

Receiver Error and Failed Tests.
ERROR: test_webhooks_worker (nautobot.extras.tests.test_webhooks.WebhookTest)
FAIL: test_change_webhook_enqueued (nautobot.extras.tests.test_context_managers.web_request_contextTestCase)
FAIL: test_enqueue_webhook_create (nautobot.extras.tests.test_webhooks.WebhookTest)
FAIL: test_enqueue_webhook_delete (nautobot.extras.tests.test_webhooks.WebhookTest)
FAIL: test_enqueue_webhook_update (nautobot.extras.tests.test_webhooks.WebhookTest)
FAIL: test_failed_request (nautobot.core.tests.test_releases.GetReleasesTestCase)

@glennmatthews
Copy link
Contributor

Thanks for the report!

The issue with most (all?) of these tests is that they were originally written for NetBox's CI environment, in which there is no worker process running, but in the Nautobot dev environment we do have a worker. These tests place various jobs on the worker queue and expect the jobs to still be on the queue when checking later, but since we have an operational worker process, it is pulling the jobs off the queue and executing them immediately, causing the test to fail when it checks the queue and finds the jobs no longer present.

This is absolutely a bug in the tests and is something we should fix.

@glennmatthews glennmatthews added type: bug Something isn't working as expected type: housekeeping Changes to the application which do not directly impact the end user labels Mar 16, 2021
@jathanism
Copy link
Contributor

A quick way around this in the tests would be to have the test configuration use different Redis database numbers for tasks and caching (like 2 and 3 respectively)? At least when the tests run and publish things, it may prevent them from being picked up by any active workers using the default config values?

@jathanism jathanism added this to the v1.0.0 milestone Mar 23, 2021
@jathanism
Copy link
Contributor

@smk4664 Could you please test that out and see if that works for you? (Hint: nautobot/core/tests/nautobot_config.py) :)

@smk4664
Copy link
Contributor Author

smk4664 commented Mar 24, 2021

I had to modify the nautobot/core/tests/nautobot_config.py as well as the dev.env that the devcontainer uses. I also had to pass this nautobot_config.py to the test command. I will put in a PR in a bit.

@jathanism
Copy link
Contributor

I had to modify the nautobot/core/tests/nautobot_config.py as well as the dev.env that the devcontainer uses. I also had to pass this nautobot_config.py to the test command. I will put in a PR in a bit.

Great! Passing in the test config to run the tests is the correct pattern anyhow! :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected type: housekeeping Changes to the application which do not directly impact the end user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants