-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Move EDS Clusters initialization after ADS #2760
Changes from 11 commits
729849f
b43995b
a3c34f6
a8df465
7df1172
7accd9f
efc3998
eba9558
495abca
7212a65
bf4c215
97918e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,7 @@ class AdsIntegrationTest : public HttpIntegrationTest, public Grpc::GrpcClientIn | |
TestEnvironment::runfilesPath("test/config/integration/certs/upstreamcacert.pem")); | ||
} | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: superfluous whitespace change. |
||
setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); | ||
HttpIntegrationTest::initialize(); | ||
ads_connection_ = fake_upstreams_[1]->waitForHttpConnection(*dispatcher_); | ||
|
@@ -434,5 +435,58 @@ TEST_P(AdsFailIntegrationTest, ConnectDisconnect) { | |
ads_stream_->finishGrpcStream(Grpc::Status::Internal); | ||
} | ||
|
||
class AdsConfigIntegrationTest : public HttpIntegrationTest, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if this could have been also done as a server unit test, i.e. just verifying the config loads. I think it's fine to do this here, but I'd also try and minify the amount of stuff we have; all we want to do is verify initialization with an ADS configuration. We don't care about setting up an ADS server or actually serving up ADS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree. I thought about it being a unit test. I added it here so that we could add ADS related config tests that ensure ADS connection works with config changes in future if needed. |
||
public Grpc::GrpcClientIntegrationParamTest { | ||
public: | ||
AdsConfigIntegrationTest() | ||
: HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), config) {} | ||
|
||
void TearDown() override { | ||
test_server_.reset(); | ||
fake_upstreams_.clear(); | ||
} | ||
|
||
void createUpstreams() override { | ||
HttpIntegrationTest::createUpstreams(); | ||
fake_upstreams_.emplace_back(new FakeUpstream(0, FakeHttpConnection::Type::HTTP2, version_)); | ||
} | ||
|
||
void initialize() override { | ||
config_helper_.addConfigModifier([this](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { | ||
auto* grpc_service = | ||
bootstrap.mutable_dynamic_resources()->mutable_ads_config()->add_grpc_services(); | ||
setGrpcService(*grpc_service, "ads_cluster", fake_upstreams_.back()->localAddress()); | ||
auto* ads_cluster = bootstrap.mutable_static_resources()->add_clusters(); | ||
ads_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); | ||
ads_cluster->set_name("ads_cluster"); | ||
|
||
// Add EDS Cluster that uses ADS as config Source. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: s/Add EDS/Add EDS static/ |
||
auto* ads_eds_cluster = bootstrap.mutable_static_resources()->add_clusters(); | ||
ads_eds_cluster->set_name("ads_eds_cluster"); | ||
ads_eds_cluster->set_type(envoy::api::v2::Cluster::EDS); | ||
auto* eds_cluster_config = ads_eds_cluster->mutable_eds_cluster_config(); | ||
auto* eds_config = eds_cluster_config->mutable_eds_config(); | ||
eds_config->mutable_ads()->InitAsDefaultInstance(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you can just write |
||
}); | ||
setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); | ||
HttpIntegrationTest::initialize(); | ||
} | ||
|
||
FakeHttpConnectionPtr ads_connection_; | ||
FakeStreamPtr ads_stream_; | ||
}; | ||
|
||
INSTANTIATE_TEST_CASE_P(IpVersionsClientType, AdsConfigIntegrationTest, | ||
GRPC_CLIENT_INTEGRATION_PARAMS); | ||
|
||
// Validate that we don't crash on EDS Cluster that uses ADS as ConfigSource. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More nits: don't crash on EDS static cluster... This is a regression test for . |
||
TEST_P(AdsConfigIntegrationTest, EdsClusterWithAdsConfigSource) { | ||
initialize(); | ||
ads_connection_ = fake_upstreams_[1]->waitForHttpConnection(*dispatcher_); | ||
ads_stream_ = ads_connection_->waitForNewStream(*dispatcher_); | ||
ads_stream_->startGrpcStream(); | ||
ads_stream_->finishGrpcStream(Grpc::Status::Ok); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need all of this just to verify initialization? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with out this, some ipv6 tests are failing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems surprising. If you reduce it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried reducing it to waitForHttpConnection then ipv6 test failed. If I reduce to initialise the test is passes with old code also. That’s why added these additional steps |
||
} | ||
|
||
} // namespace | ||
} // namespace Envoy |
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 comment was there to point out that ADS init must happen after the above
tls_->set
. We need TLS to be able to initialize gRPC async client manager bits. I'm surprised the tests pass without this (specificallyads_integration_test
with Envoy gRPC).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.
Actually, I think the need for this went away when I fixed the stats scope to be created on the main thread. Feel free to ignore this comment, if an issue arises I can go and fix it, since this is
Grpc::AsyncClient
implementation stuff.