upstream: fix duplicate clusters#4012
Merged
mattklein123 merged 2 commits intoenvoyproxy:masterfrom Aug 2, 2018
Merged
Conversation
Signed-off-by: Rama <rama.rao@salesforce.com>
mattklein123
reviewed
Aug 1, 2018
Member
mattklein123
left a comment
There was a problem hiding this comment.
Awesome, thanks for fixing this. A couple of comments.
| std::unordered_set<std::string> cluster_names; | ||
| for (const auto& cluster : resources) { | ||
| if (!cluster_names.insert(cluster.name()).second) { | ||
| throw EnvoyException("duplicate clusters found"); |
Member
There was a problem hiding this comment.
Can you say which cluster is duplicated?
Contributor
Author
There was a problem hiding this comment.
I can, if we have multiple need to maintain the list and combine all of them as single string display? -NBD, I can do that.
Member
There was a problem hiding this comment.
I would just keep it simple and fail on the first one you find and print the cluster...
| auto* cluster_2 = clusters.Add(); | ||
| cluster_2->set_name("duplicate_cluster"); | ||
|
|
||
| EXPECT_THROW(dynamic_cast<CdsApiImpl*>(cds_.get())->onConfigUpdate(clusters, ""), EnvoyException); |
Contributor
Author
There was a problem hiding this comment.
will change...
Signed-off-by: Rama <rama.rao@salesforce.com>
Contributor
Author
|
@mattklein123 addressed comments. PTAL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Rama rama.rao@salesforce.com
Description: Fixes envoy crash with duplicate clusters in cds response.
Risk Level: Low
Testing: Added Automated tests
Docs Changes: N/A
Release Notes: N/A
Fixes #3987