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

cdsbalancer: test cleanup part 1/N #6546

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

easwars
Copy link
Contributor

@easwars easwars commented Aug 11, 2023

This PR is the first in a set of test cleanups for the tests in the cds balancer. This is a pre-requisite for switching the cds balancer to use the generic xdsClient watch API.

Summary of changes:

  • Cleanup of tests in cdsbalancer_test.go to use a real management server and rely on behavior instead of internal implementation details
  • Add support for LRS config in the e2e package
    • Switch some usages of handcrafting the Cluster resource to use the utilities provided by the e2e package
  • Add an UpdateStateCallback to the manual resolver

RELEASE NOTES: none

@easwars easwars requested a review from zasweq August 11, 2023 23:10
@easwars easwars added this to the 1.58 Release milestone Aug 11, 2023
@easwars easwars force-pushed the cdsbalancer_test_cleanup_part_1 branch from 4401e12 to 9b6c48f Compare August 14, 2023 17:46
Copy link
Contributor

@zasweq zasweq left a comment

Choose a reason for hiding this comment

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

Some comments.

xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
xds/internal/balancer/cdsbalancer/cdsbalancer_test.go Outdated Show resolved Hide resolved
@zasweq zasweq assigned easwars and unassigned zasweq Aug 15, 2023
@easwars easwars assigned zasweq and unassigned easwars Aug 16, 2023
@easwars
Copy link
Contributor Author

easwars commented Aug 16, 2023

Thanks for the review.

Copy link
Contributor

@zasweq zasweq left a comment

Choose a reason for hiding this comment

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

Changes look great. Thanks for addressing all my comments. LGTM!

Comment on lines +829 to +832
// Tests a single success scenario where the cds LB policy receives a cluster
// resource from the management server with LRS enabled. Verifies that the load
// balancing configuration pushed to the child is as expected.
func (s) TestClusterUpdate_SuccessWithLRS(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure there's a reason, but why is this not merged in with the t test directly above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to merge them but it made the other test way more complicated than it had to. The reason is that the lrs config in the resource from the management server simply has a config source which says "self". But this has to be translated into the server config from the bootstrap. This means that the server URI (in the wantConfig) has to depend on the actual address of the management server. This means that I can't statically define wantConfig in the test table in the previous test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm ok. I think you could argue you could have a conditional and write an extra field to the static configuration. I.e. if test name {test.wantChildConfig.DiscoveryMechanism.LoardReportingServer = want}. But this isn't too many lines of code so seems fine :).

t.Fatalf("EmptyCall() failed: %v", err)
}

// Retrieve the cds LB policy policy and call ExitIdle() on it.
Copy link
Contributor

Choose a reason for hiding this comment

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

One more policy policy :).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@zasweq zasweq assigned easwars and unassigned zasweq Aug 17, 2023
@easwars easwars merged commit b07bf5d into grpc:master Aug 17, 2023
1 check passed
@easwars easwars deleted the cdsbalancer_test_cleanup_part_1 branch August 17, 2023 17:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants