From 7d53957a709d23498a5138ada1ef4c40bcaa620b Mon Sep 17 00:00:00 2001 From: Arjan Singh Bal <46515553+arjan-bal@users.noreply.github.com> Date: Wed, 20 Nov 2024 23:29:40 +0530 Subject: [PATCH] pickfirst: Ensure pickfirst_test.go runs against both new and old policies --- balancer/pickfirst/pickfirst_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/balancer/pickfirst/pickfirst_test.go b/balancer/pickfirst/pickfirst_test.go index 43d8b20df3e7..0b360c3b31ed 100644 --- a/balancer/pickfirst/pickfirst_test.go +++ b/balancer/pickfirst/pickfirst_test.go @@ -48,14 +48,14 @@ func Test(t *testing.T) { grpctest.RunSubTests(t, s{}) } -// TestPickFirstLeaf_InitialResolverError sends a resolver error to the balancer +// TestPickFirst_InitialResolverError sends a resolver error to the balancer // before a valid resolver update. It verifies that the clientconn state is // updated to TRANSIENT_FAILURE. -func (s) TestPickFirstLeaf_InitialResolverError(t *testing.T) { +func (s) TestPickFirst_InitialResolverError(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() cc := testutils.NewBalancerClientConn(t) - bal := pickfirstBuilder{}.Build(cc, balancer.BuildOptions{}) + bal := balancer.Get(Name).Build(cc, balancer.BuildOptions{}) defer bal.Close() bal.ResolverError(errors.New("resolution failed: test error")) @@ -81,14 +81,14 @@ func (s) TestPickFirstLeaf_InitialResolverError(t *testing.T) { } } -// TestPickFirstLeaf_ResolverErrorinTF sends a resolver error to the balancer +// TestPickFirst_ResolverErrorinTF sends a resolver error to the balancer // before when it's attempting to connect to a SubConn TRANSIENT_FAILURE. It // verifies that the picker is updated and the SubConn is not closed. -func (s) TestPickFirstLeaf_ResolverErrorinTF(t *testing.T) { +func (s) TestPickFirst_ResolverErrorinTF(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() cc := testutils.NewBalancerClientConn(t) - bal := pickfirstBuilder{}.Build(cc, balancer.BuildOptions{}) + bal := balancer.Get(Name).Build(cc, balancer.BuildOptions{}) defer bal.Close() // After sending a valid update, the LB policy should report CONNECTING.