Skip to content

Commit 36b9475

Browse files
committed
test it
1 parent 649a210 commit 36b9475

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

config/configgrpc/configgrpc_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"go.uber.org/zap"
1919
"go.uber.org/zap/zaptest/observer"
2020
"google.golang.org/grpc"
21+
"google.golang.org/grpc/balancer"
2122
"google.golang.org/grpc/metadata"
2223
"google.golang.org/grpc/peer"
2324

@@ -35,6 +36,21 @@ import (
3536
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
3637
)
3738

39+
// testBalancerBuilder facilitates testing validateBalancerName().
40+
type testBalancerBuilder struct{}
41+
42+
func (testBalancerBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer {
43+
return nil
44+
}
45+
46+
func (testBalancerBuilder) Name() string {
47+
return "configgrpc_balancer_test"
48+
}
49+
50+
func init() {
51+
balancer.Register(testBalancerBuilder{})
52+
}
53+
3854
func TestDefaultGrpcClientSettings(t *testing.T) {
3955
tt, err := obsreporttest.SetupTelemetry(component.NewID("component"))
4056
require.NoError(t, err)
@@ -137,7 +153,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
137153
ReadBufferSize: 1024,
138154
WriteBufferSize: 1024,
139155
WaitForReady: true,
140-
BalancerName: "round_robin",
156+
BalancerName: "configgrpc_balancer_test",
141157
Authority: "pseudo-authority",
142158
Auth: &configauth.Authentication{AuthenticatorID: component.NewID("testauth")},
143159
},

0 commit comments

Comments
 (0)