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

proxy: Rewrite mock controller to accept a stream of dst updates #808

Merged
merged 4 commits into from
Apr 19, 2018

Conversation

olix0r
Copy link
Member

@olix0r olix0r commented Apr 19, 2018

Currently, the mock controller, which is used in tests, takes all of its
updates a priori, which makes it hard to control when an update occurs within a
test.

Now, the controller exposes a DstSender, which wraps an unbounded channel of
destination updates. This allows tests to trigger updates at a specific point
in the test.

In order to accomplish this, the controller's hand-rolled gRPC server
implementation has been discarded in favor of a real gRPC destination service.
This requires that the controller-grpc project now builds both clients
and servers for the destination service. Additionally, we now build a tap
client as well (assuming that we'll want to write tests against our tap
server).


This change is necessary in order to test an upcoming change to telemetry labeling.

Currently, the mock controller, which is used in tests, takes all of its
updates a priori, which makes it hard to control when an update occurs within a
test.

Now, the controller exposes a `DstSender`, which wraps an unbounded channel of
destination updates. This allows tests to trigger updates at a specific point
in the test.

In order to accomplish this, the controller's hand-rolled gRPC server
implementation has been discarded in favor of a real gRPC destination service.
This requires that the `controller-grpc` project now builds both clients
and servers for the destination service. Additionally, we now build a tap
client as well (assuming that we'll want to write tests against our tap
server).
@olix0r olix0r added area/proxy priority/P0 Release Blocker labels Apr 19, 2018
@olix0r olix0r added this to the 0.4.1 milestone Apr 19, 2018
@olix0r olix0r self-assigned this Apr 19, 2018
@olix0r olix0r requested review from seanmonstar and hawkw April 19, 2018 14:46
@olix0r olix0r added the review label Apr 19, 2018
@seanmonstar
Copy link
Contributor

Um, yes please! :praisethesun:

Copy link
Contributor

@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 is excellent --- I had wanted to see a change like this for a while, thanks for actually implementing it!

I believe that these changes will fix the flakiness of the outbound_dst_labels tests, so we can remove the ignore attribute from them and (provided that passes CI) close #751.

@@ -519,19 +514,17 @@ mod outbound_dst_labels {
fn controller_updates_addr_labels() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the changes on this branch should make this test no longer flaky, so we can remove the ignore attribute.

Copy link
Member Author

@olix0r olix0r Apr 19, 2018

Choose a reason for hiding this comment

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

I don't think that's the case.

This test does the following:

  1. publishes a dst
  2. routes a request
  3. publishes an updated dst
  4. routes a request

at (2), we must get a dst to complete the routing. at (4), however, i don't think that we can be guaranteed that the router has observed the update, since it can just route on the old data. Typically, it will; but no guarantees about cross-thread visibility/ordering.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I think you're right, nevermind. Oh well.

@@ -576,11 +577,15 @@ mod outbound_dst_labels {
fn controller_updates_set_labels() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Once again, this test is probably no longer flaky.

@@ -488,15 +476,22 @@ mod outbound_dst_labels {
// map ordering.
assert_contains!(metrics.get("/metrics"), "dst_set_label1=\"foo\"");
assert_contains!(metrics.get("/metrics"), "dst_set_label2=\"bar\"");
drop(dst_tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this not be dropped implicitly when exiting the test function?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, yeah, this was for debugging

use conduit_proxy_controller_grpc as pb;
use self::bytes::BufMut;
use self::prost::Message;
//use conduit_proxy_controller_grpc as pb;
Copy link
Contributor

Choose a reason for hiding this comment

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

rm commented-out import?

@hawkw
Copy link
Contributor

hawkw commented Apr 19, 2018

Looks like 1fdcb49 broke the build but it's somewhat unclear to me how that change caused an unused import in the generated code...

@olix0r
Copy link
Member Author

olix0r commented Apr 19, 2018

@hawkw that's just a warning -- the failure was an instance of #777

@olix0r olix0r merged commit 491fae7 into master Apr 19, 2018
@olix0r olix0r deleted the ver/proxy-tests-controllable-dst branch April 19, 2018 18:01
@olix0r olix0r removed the review label Apr 19, 2018
khappucino pushed a commit to Nordstrom/linkerd2 that referenced this pull request Mar 5, 2019
…kerd#808)

Currently, the mock controller, which is used in tests, takes all of its
updates a priori, which makes it hard to control when an update occurs within a
test.

Now, the controller exposes a `DstSender`, which wraps an unbounded channel of
destination updates. This allows tests to trigger updates at a specific point
in the test.

In order to accomplish this, the controller's hand-rolled gRPC server
implementation has been discarded in favor of a real gRPC destination service.
This requires that the `controller-grpc` project now builds both clients
and servers for the destination service. Additionally, we now build a tap
client as well (assuming that we'll want to write tests against our tap
server).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants