Skip to content

Commit

Permalink
Remove usage of internal proto in configgrpc tests
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Jun 14, 2021
1 parent cda019f commit 1468ff7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import (
"go.opentelemetry.io/collector/config/configauth"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/consumer/pdata"
otelcol "go.opentelemetry.io/collector/internal/data/protogen/collector/trace/v1"
"go.opentelemetry.io/collector/internal/pdatagrpc"
)

func TestDefaultGrpcClientSettings(t *testing.T) {
Expand Down Expand Up @@ -452,7 +454,7 @@ func TestHttpReception(t *testing.T) {
opts, err := gss.ToServerOption(map[config.ComponentID]component.Extension{})
assert.NoError(t, err)
s := grpc.NewServer(opts...)
otelcol.RegisterTraceServiceServer(s, &grpcTraceServer{})
pdatagrpc.RegisterTracesServer(s, &grpcTraceServer{})

go func() {
_ = s.Serve(ln)
Expand All @@ -466,9 +468,9 @@ func TestHttpReception(t *testing.T) {
assert.NoError(t, errClient)
grpcClientConn, errDial := grpc.Dial(gcs.Endpoint, clientOpts...)
assert.NoError(t, errDial)
client := otelcol.NewTraceServiceClient(grpcClientConn)
client := pdatagrpc.NewTracesClient(grpcClientConn)
ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)
resp, errResp := client.Export(ctx, &otelcol.ExportTraceServiceRequest{}, grpc.WaitForReady(true))
resp, errResp := client.Export(ctx, pdata.NewTraces(), grpc.WaitForReady(true))
if tt.hasError {
assert.Error(t, errResp)
} else {
Expand Down Expand Up @@ -497,7 +499,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {
opts, err := gss.ToServerOption(map[config.ComponentID]component.Extension{})
assert.NoError(t, err)
s := grpc.NewServer(opts...)
otelcol.RegisterTraceServiceServer(s, &grpcTraceServer{})
pdatagrpc.RegisterTracesServer(s, &grpcTraceServer{})

go func() {
_ = s.Serve(ln)
Expand All @@ -513,9 +515,9 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {
assert.NoError(t, errClient)
grpcClientConn, errDial := grpc.Dial(gcs.Endpoint, clientOpts...)
assert.NoError(t, errDial)
client := otelcol.NewTraceServiceClient(grpcClientConn)
client := pdatagrpc.NewTracesClient(grpcClientConn)
ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)
resp, errResp := client.Export(ctx, &otelcol.ExportTraceServiceRequest{}, grpc.WaitForReady(true))
resp, errResp := client.Export(ctx, pdata.NewTraces(), grpc.WaitForReady(true))
assert.NoError(t, errResp)
assert.NotNil(t, resp)
cancelFunc()
Expand All @@ -524,7 +526,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {

type grpcTraceServer struct{}

func (gts *grpcTraceServer) Export(context.Context, *otelcol.ExportTraceServiceRequest) (*otelcol.ExportTraceServiceResponse, error) {
func (gts *grpcTraceServer) Export(context.Context, pdata.Traces) (interface{}, error) {
return &otelcol.ExportTraceServiceResponse{}, nil
}

Expand Down

0 comments on commit 1468ff7

Please sign in to comment.