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

test: Add an integration test for DNS requests #307

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

vadorovsky
Copy link
Member

Add test cases for DNS requests which use dns-mock-server[0], look for the related network events and try to parse them.

Move parse_dns function out of mod pulsar, so it can be used in tests.

Comment on lines 734 to 735
&& (a.data == "A(Record(127.0.0.1))"
|| a.data == "AAAA(Record(::1))")
Copy link
Member

Choose a reason for hiding this comment

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

the record here is hardcoded, the test only works for localhost

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I added the "example.io -> localhost" (both v4 and v6 representation of localhost) entry to the mock DNS and I'm asserting that exact event only. So I don't really see the problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

But I can add more domains and addresses if that's what you mean.

Copy link
Member

Choose a reason for hiding this comment

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

what I mean is that run_dns creates a mock with the argument records but instead the check is hardcoded. if you pass something different than localhost (ipv4 or ipv6) it fails. it's more like "run_dns_localhost" because of the implicit check

Copy link
Member Author

Choose a reason for hiding this comment

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

Gotcha. Should be resolved now.

Add test cases for DNS requests which use dns-mock-server[0], look for
the related network events and try to parse them.

Move `parse_dns` function out of `mod pulsar`, so it can be used in
tests.
Don't hard code the record addresses.
@vadorovsky vadorovsky force-pushed the vadorovsky/fix-network-monitor-tests branch from 3532f04 to d7c7d3e Compare July 8, 2024 09:09
@vadorovsky vadorovsky merged commit 8d28f85 into main Jul 17, 2024
21 checks passed
@vadorovsky vadorovsky deleted the vadorovsky/fix-network-monitor-tests branch July 17, 2024 22:25
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.

2 participants