-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
eds/lrs: handle nil when LRS is disabled #4086
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -743,3 +743,33 @@ func (s) TestEDS_LoadReport(t *testing.T) { | |
t.Errorf("store.stats() returned unexpected diff (-want +got):\n%s", diff) | ||
} | ||
} | ||
|
||
// TestEDS_LoadReportDisabled covers the case that LRS is disabled. It makes | ||
// sure the EDS implementation isn't broken (doesn't panic). | ||
func (s) TestEDS_LoadReportDisabled(t *testing.T) { | ||
// We create an xdsClientWrapper with a dummy xdsClientInterface which only | ||
// implements the LoadStore() method to return the underlying load.Store to | ||
// be used. | ||
lsWrapper := &loadStoreWrapper{} | ||
lsWrapper.updateServiceName(testClusterNames[0]) | ||
// Not calling lsWrapper.updateLoadStore(loadStore) because LRS is disabled. | ||
|
||
cc := testutils.NewTestClientConn(t) | ||
edsb := newEDSBalancerImpl(cc, nil, lsWrapper, nil) | ||
edsb.enqueueChildBalancerStateUpdate = edsb.updateState | ||
|
||
// Two localities, each with one backend. | ||
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: 1 locality now |
||
clab1 := testutils.NewClusterLoadAssignmentBuilder(testClusterNames[0], nil) | ||
clab1.AddLocality(testSubZones[0], 1, 0, testEndpointAddrs[:1], nil) | ||
edsb.handleEDSResponse(parseEDSRespProtoForTesting(clab1.Build())) | ||
sc1 := <-cc.NewSubConnCh | ||
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.
|
||
edsb.handleSubConnStateChange(sc1, connectivity.Connecting) | ||
edsb.handleSubConnStateChange(sc1, connectivity.Ready) | ||
|
||
// Test roundrobin with two subconns. | ||
p1 := <-cc.NewPickerCh | ||
// We call picks to make sure they don't panic. | ||
for i := 0; i < 10; i++ { | ||
p1.Pick(balancer.PickInfo{}) | ||
} | ||
} |
This file contains 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
This file contains 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
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.
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 doesn't make 100% sense anymore I think.