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

Minor cleanup in the config tests #188

Merged
merged 2 commits into from
Feb 26, 2019
Merged

Minor cleanup in the config tests #188

merged 2 commits into from
Feb 26, 2019

Conversation

adleong
Copy link
Member

@adleong adleong commented Feb 8, 2019

No description provided.

@adleong adleong self-assigned this Feb 8, 2019
@adleong adleong requested a review from olix0r February 8, 2019 00:58
Copy link
Member

@hawkw hawkw left a 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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIOLI:

Suggested change
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.

Copy link
Member Author

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.

Copy link
Member

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...

Copy link
Member

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(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above,

Suggested change
proxy_id: String::new(),
..Default::default()

Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
@adleong adleong merged commit 1ea7559 into master Feb 26, 2019
@adleong adleong deleted the alex/183-followup branch February 26, 2019 05:28
ihcsim pushed a commit to linkerd/linkerd2 that referenced this pull request Feb 27, 2019
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>
ihcsim pushed a commit to linkerd/linkerd2 that referenced this pull request Feb 27, 2019
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>
ihcsim added a commit to linkerd/linkerd2 that referenced this pull request Feb 27, 2019
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>
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.

3 participants