Skip to content

Add mocking to test network/cache behavior #450

Open
@phillip-stephens

Description

@phillip-stephens

Our current mocking for unit tests is at the highest level of abstraction (DoSingleDstServerLookup) which avoids testing a lot of inner logic. After seeing #449, I think we need a way to ensure that some guarantees about how ZDNS is supposed to operate hold true.

For example:

  • TCP/TLS/HTTPS sessions should be re-used
    • ./zdns A google.com yahoo.com microsoft.com apple.com eBay.com zdns-testing.com Cloudflare.com--threads=2 --tcp-only should result in only 2 TCP handshakes taking place
  • GTLD servers should only be queried once from the roots per-gTLD
    • google.com and yahoo.com both have the same gTLD. In ./zdns A google.com yahoo.com --threads=1 --iterative, ZDNS should only make 1 query to the set of root IP addresses
    • This can be extended to include 2 sub-domains of google.com, and we should only query the .com name servers once for google.com's nameservers

Talked with @zakird and thinking the best approach is to introduce some sort of mocking for reliable tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions