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

Add tests for router sending trap from other ip #2510

Merged

Conversation

johannaengland
Copy link
Contributor

Closes #2500

@github-actions
Copy link

github-actions bot commented Nov 22, 2022

Test results

     12 files       12 suites   11m 19s ⏱️
3 214 tests 3 118 ✔️   96 💤 0
9 117 runs  8 829 ✔️ 288 💤 0

Results for commit d871352.

♻️ This comment has been updated with latest results.

@johannaengland johannaengland force-pushed the tests/snmptrapd-different-ip branch from 5fbf4cb to d6adb40 Compare November 22, 2022 15:05
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

It is clear from the failing tests that this does not work as expected.

Working with legacy database connections is tricky, since you cannot disable the transactional framework in the same way you can when using the Django ORM.

Putting setup/teardown into the test code like this is not a good idea. There is no guarantee that the teardown will actually run - in fact, it is guaranteed that it won't run if the test fails - and then you have left data in the database that will interfere with the remaining tests in the suite.

As a minimum, you should create pytest fixtures for the data you depend on, so you ensure a proper setup/teardown (and making your actual test much shorter/readable in the process).

@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Merging #2510 (ead4ee9) into master (69634cc) will not change coverage.
The diff coverage is n/a.

❗ Current head ead4ee9 differs from pull request most recent head d871352. Consider uploading reports for the commit d871352 to get more accurate results

@@           Coverage Diff           @@
##           master    #2510   +/-   ##
=======================================
  Coverage   53.71%   53.71%           
=======================================
  Files         558      558           
  Lines       40587    40587           
=======================================
  Hits        21800    21800           
  Misses      18787    18787           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

👍

@johannaengland johannaengland force-pushed the tests/snmptrapd-different-ip branch from ead4ee9 to d871352 Compare February 16, 2023 09:20
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@johannaengland johannaengland merged commit a7767f5 into Uninett:master Feb 16, 2023
@johannaengland johannaengland deleted the tests/snmptrapd-different-ip branch February 16, 2023 09:32
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 this pull request may close these issues.

Add test to ensure SNMPTrap._lookup_agent does properly look up netboxes by their router addresses
2 participants