-
Notifications
You must be signed in to change notification settings - Fork 54
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(dnscheck): implement richer input #1618
Conversation
This diff completes the set of preliminary richer input diffs. We build the TargetLoader using the ExperimentBuilder, which in turn uses a registry.Factory under the hood. This means that we can load targets for each experiment. Part of ooni/probe#2607
@@ -114,7 +114,7 @@ func (m *Measurer) ExperimentVersion() string { | |||
// errors are in addition to any other errors returned by the low level packages | |||
// that are used by this experiment to implement its functionality. | |||
var ( | |||
ErrInputRequired = errors.New("this experiment needs input") | |||
ErrInputRequired = targetloading.ErrInputRequired |
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.
Note: this change breaks the ABI in terms of the exact error string that we emit in such a case. Because we do not have an API/ABI strict stability guarantee and because it makes sense to avoid having so many duplicate errors, I think it makes sense to apply this change in the interested of reducing unnecessary duplication a bit.
model.NewOOAPIURLInfoWithDefaultCategoryAndCountry("b"), | ||
model.NewOOAPIURLInfoWithDefaultCategoryAndCountry("c"), | ||
} | ||
return results, nil |
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.
This fixes a test that I broke previously. Now that we have a loader, we need to return "a", "b", "c" here rather than using the Inputs fields above. With this change we're back at 100% coverage.
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.
The changes look good to me. I left some comments which I think should make the diff good to go.
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.
LGTM!
This diff:
./internal/registry
and itsdnscheck.go
file such thatdnscheck
has its own private target loader;./internal/targetloading
to allow reusing the code to read static input from CLI and from files;./internal/model
to pass optional richer input to experiments;./internal/engine
to pass richer input to experiments;./internal/experiment/dnscheck
to read and use the richer input it is passed;./internal/experiment/dnscheck
returning some static entries;./internal/oonirun
to make sure richer-input experiments honor their options by moving option loading before the loading of targets.Once this diff is merged,
miniooni
andooniprobe
will rundnscheck
with richer input. Obviously, we are still lacking an API to fetch richer input, so for now this is static richer input, suitable as a starting point to land more diffs.Part of ooni/probe#2607.