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

feat: internal and external DSL for writing nettests #7

Merged
merged 26 commits into from
Jul 3, 2023
Merged

Conversation

bassosimone
Copy link
Contributor

@bassosimone bassosimone commented Jun 30, 2023

This diff improves the DSL for writing nettests introduced in #5 such that we a single homoiconic representation of the DSL. The internal DSL, written in pure Go, could either perform a measurement directly or could be exported to a JSON-based AST. The external DSL derives from the JSON-serialized AST and runs the same operations as the internal one, except that type checking happens at runtime.

Because the internal DSL is in pure Go, we don't need to write custom code for type checking. At the same time, we have now lost the possibility of having a polymorphic HTTP step and we need to cast a TCP, TLS, or QUIC connection to become an HTTP connection by using the proper operation.

All the other functionality should be compatible with #5. Obviously, I needed to change the JSON representation to accommodate for minor changes, so the previously serialized JSONs should not be working anymore. This is fine, since we're still in the experimentation stage.

To be more confident that dynamic type checking works, this PR added comprehensive netem based QA tests that exercise the most common type conversions happening on success or error.

In terms of terminology, I also chose to replace "func" with "stage" (or "stage_name") since it seems more selective to deal with the composition of pipeline stages than with the composition of functions. (The pipeline stages are functions but, by calling them pipeline stages, we further clarify what we're dealing with.)

This work is part of ooni/probe#2494 and ooni/ooni.org#1296. The latter issue is related to this PR because we also included support for throttling to the DSL.

@bassosimone bassosimone changed the title feat: richer input with homoiconicity and Go-based type checking feat: improve DSL for writing nettests Jul 3, 2023
@bassosimone bassosimone changed the title feat: improve DSL for writing nettests feat: internal and external DSL for writing nettests Jul 3, 2023
@bassosimone bassosimone marked this pull request as ready for review July 3, 2023 17:35
@bassosimone bassosimone merged commit 65c4d2f into main Jul 3, 2023
@bassosimone bassosimone deleted the tutorial branch July 3, 2023 17:39
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.

1 participant