Skip to content

proxy: Allow mocking source of name refinement #2706

@hawkw

Description

@hawkw

Feature Request

What problem are you trying to solve?

Currently, the proxy relies on a DNS query to refine uncanonicalized DNS names to their fully qualified form. This makes testing some service profile features that rely on name canonicalization difficult, since the names used in tests don't actually exist in DNS.

How should the problem be solved?

We should replace the hard-coded dns::Resolver in proxy::canonicalize with a trait defining the name refinement operation. We should implement this trait for dns::Resolver, and make the canonicalization code generic over the source of refined names.

By default, proxies should be constructed using DNS for name refinement. In tests, it could be possible to substitute this with a mocked name refinement source, similarly to how we mock GetOriginalDst in the tests.

Any alternatives you've considered?

Alternatively, we could stand up an entire fake DNS server for the tests. This seems like a bad idea --- it introduces more moving parts to the tests, and could be a lot of work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions