-
Notifications
You must be signed in to change notification settings - Fork 268
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
Minor cleanup in the config tests #188
Conversation
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 LGTM, one minor suggestion.
@@ -62,7 +62,7 @@ impl Controller { | |||
let dst = pb::GetDestination { | |||
scheme: "k8s".into(), | |||
path, | |||
proxy_id: "foo.deployment.default.linkerd-managed.linkerd.svc.cluster.local".into(), | |||
proxy_id: String::new(), |
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.
TIOLI:
proxy_id: String::new(), | |
..Default::default() |
to use the default initializer for all other fields. This means the code will still compile if the proto adds fields later.
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'd be inclined to leave it. I'm not yet familiar with rust style or idioms but String::new()
feels more explicit to me than Default::default()
. And I feel like compilation failing when we add proto fields is a good thing as it forces us to decide what we want to do about those fields.
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.
That's fair. String::new
is definitely more idiomatic in general, I've just been bitten in the past by proto changes breaking a bunch of tests when those fields aren't actually required by the test...
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 the default
approach is fine for protobuf structs, especially in tests. but i don't feel strongly.
@@ -98,7 +98,7 @@ impl Controller { | |||
let dst = pb::GetDestination { | |||
scheme: "k8s".into(), | |||
path, | |||
proxy_id: "foo.deployment.default.linkerd-managed.linkerd.svc.cluster.local".into(), | |||
proxy_id: String::new(), |
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.
Same as above,
proxy_id: String::new(), | |
..Default::default() |
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
9c41a9e
to
797eda7
Compare
This picks up the following commits: * 0fe8063 replace with (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
This picks up the following commits: * 0fe8063 replace `Error::cause` with `Error::source` (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
This picks up the following commits: * 0fe8063 replace `Error::cause` with `Error::source` (#2370) (linkerd/linkerd2-proxy#201) * 1ea7559 Minor cleanup in the config tests (linkerd/linkerd2-proxy#188) * d0ef56b Update *ring* to 0.14.6 (linkerd/linkerd2-proxy#197) * c54377f fs-watch: Use a properly sized buffer for inotify events (linkerd/linkerd2-proxy#195) * 23e02a6 Update Router to wait for inner poll_ready before calling inner call * 2de8e9b Update metrics quickcheck to 0.8, and hyper to 0.12.24 * d1bbd4b make: Optionally include debug symbols with builds (linkerd/linkerd2-proxy#193) * 738a541 Fix compilation warnings in fs-watch (linkerd/linkerd2-proxy#192) * 6cc7558 Apply rustfmt (linkerd/linkerd2-proxy#191) Signed-off-by: Ivan Sim <ivan@buoyant.io>
No description provided.