-
Notifications
You must be signed in to change notification settings - Fork 51
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 netemx tests for webconnectivitylte #1185
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…to add handler after environment creation
… webconnectivitylte fields
This was referenced Aug 23, 2023
bassosimone
added a commit
that referenced
this pull request
Aug 23, 2023
This diff has been extracted from #1185 and modifies netxlite/filtering to export the DNSComposeResponse function. The reference issue is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
bassosimone
reviewed
Aug 24, 2023
internal/netemx/qaenv.go
Outdated
ipAddr := net.ParseIP(addr) | ||
runtimex.Assert(ipAddr != nil, "invalid IP addr") | ||
handler := factory.NewHandler(stack) | ||
closables = env.serverListen(stack, handler, addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here we should append to the closables rather than assigning.
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
This diff factors the function used for listening out of the loop where we create all the servers stacks. The same diff is part of the original PR that introduced these changes: #1185. The intent of pushing this commit is to make sure the diff we're merging next is easier to understand because there's no refactoring noise. Reference issue: ooni/probe#2461.
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
This diff factors the function used for listening out of the loop where we create all the servers stacks. The same diff is part of the original PR that introduced these changes: #1185. The intent of pushing this commit is to make sure the diff we're merging next is easier to understand because there's no refactoring noise. Reference issue: ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
The oohelperd `http.Handler` constructor needs a reference to a `model.UnderlyingNetwork` that will be used for fetching websites and verifying that they're accessible. This diff changes how `netemx` works such that we can construct an `http.Handler` that depends on a `model.UnderlyingNetwork`, thus enabling this use case. This diff has been adapted from #1185. The reference issue is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
This diff implements the subset of the OONI API required for testing Web Connectivity LTE using netemx. Diff adapted from: #1185. Reference issue: ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
This diff extends netemx to add support for simulating the oohelperd using netem. We extracted this diff from #1185. The reference issue is ooni/probe#2461. We're now well positioned to write netemx-based tests for Web Connectivity 🥳 🥳 🥳 🥳 ! --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
bassosimone
added a commit
that referenced
this pull request
Aug 24, 2023
This diff introduces code to emulate a large-scale scenario with several servers. This scenario is suitable for writing Web Connectivity integration tests because it includes a test helper, the OONI API, a GeoIP service, etc. This work derives from #1185 and is part of ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
I have split this PR in several smaller PRs and integrated the code in master. |
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff has been extracted from ooni#1185 and modifies netxlite/filtering to export the DNSComposeResponse function. The reference issue is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
Code in netxlite is currently tightly coupled with the tproxy singleton (i.e., with a `model.UnderlyingNetwork`). Unfortunately, to write netemx tests for Web Connectivity v0.5, we need to break this coupling. In fact, we need the test helper's code to use a different underlying network that uses a different IP address and is not censored, unlike the network used by the probe. To this end, in this diff we're introducing a nil-safe provider for a tproxy. When the provider struct pointer is nil or the tproxy field is nil, the code behaves as before and uses the tproxy singleton. Otherwise, the code will use the given tproxy. Then we modify fundamental types to explicitly depend on this nil-safe provider rather than implicitly depending on the tproxy singleton. We're soon going to take advantage of this diff and introduce support for constructing common netxlite types using a custom tproxy that is not a singleton but rather is a field of a concrete "net" structure. This work has been extracted and adapted from ooni#1185. The reference issue for this pull request is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
) This diff introduces the netxlite.Netx type. This type depends on a model.UnderlyingNetwork. When the underlying network is nil, using this type is equivalent to using netxlite toplevel functions directly. To simplify testing this diff, let's move the netem->netxlite UnderlyingNetworkAdapter from netemx and let's use netem to write tests, so we can have confidence specifically about the most common use case of overriding the underlying network. Originally part of ooni#1185. The reference issue is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
The ooni#1185 PR originally defined this server in the `internal/netemx` package, but I chose to move this functionality into the much-lower-level `testingx` package. The rationale for moving this functionality is that a DNS-over-HTTPS server is useful in several test cases, so it should be as general as possible. This work is part of ooni/probe#2461 --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff implements the Ubuntu GeoIP resolver service inside of the testingx package. Original code: ooni#1185. Reference issue: ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff factors the function used for listening out of the loop where we create all the servers stacks. The same diff is part of the original PR that introduced these changes: ooni#1185. The intent of pushing this commit is to make sure the diff we're merging next is easier to understand because there's no refactoring noise. Reference issue: ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
The oohelperd `http.Handler` constructor needs a reference to a `model.UnderlyingNetwork` that will be used for fetching websites and verifying that they're accessible. This diff changes how `netemx` works such that we can construct an `http.Handler` that depends on a `model.UnderlyingNetwork`, thus enabling this use case. This diff has been adapted from ooni#1185. The reference issue is ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff implements the subset of the OONI API required for testing Web Connectivity LTE using netemx. Diff adapted from: ooni#1185. Reference issue: ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff extends netemx to add support for simulating the oohelperd using netem. We extracted this diff from ooni#1185. The reference issue is ooni/probe#2461. We're now well positioned to write netemx-based tests for Web Connectivity 🥳 🥳 🥳 🥳 ! --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
This diff introduces code to emulate a large-scale scenario with several servers. This scenario is suitable for writing Web Connectivity integration tests because it includes a test helper, the OONI API, a GeoIP service, etc. This work derives from ooni#1185 and is part of ooni/probe#2461. --------- Co-authored-by: kelmenhorst <k.elmenhorst@mailbox.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Description
This diff implements netemx testing for webconnectivitylte by doing the following high-level things:
QAEnv
)model.UnderlyingNetwork
that, if set, is used instead oftproxySingleton()
Net
which wraps anUnderlyingNetwork
. Its methods are constructors that mimic constructors in netxlite, e.g.NewDialerWithResolver
. These constructor methods return dialers/resolvers/handshakers which use thisNet
'sUnderlyingNetwork
.