test: fix openetelemtry test (#11573)
This commit is contained in:
parent
e2578462a5
commit
272a0a3355
|
|
@ -2,14 +2,14 @@ package opentelemetry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.opentelemetry.io/collector/pdata/pcommon"
|
"go.opentelemetry.io/collector/pdata/pcommon"
|
||||||
"go.opentelemetry.io/collector/pdata/pmetric"
|
"go.opentelemetry.io/collector/pdata/pmetric"
|
||||||
"go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp"
|
"go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"net"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/influxdata/influxdb-observability/common"
|
"github.com/influxdata/influxdb-observability/common"
|
||||||
"github.com/influxdata/influxdb-observability/influx2otel"
|
"github.com/influxdata/influxdb-observability/influx2otel"
|
||||||
|
|
@ -66,13 +66,7 @@ func TestOpenTelemetry(t *testing.T) {
|
||||||
time.Unix(0, 1622848686000000000))
|
time.Unix(0, 1622848686000000000))
|
||||||
|
|
||||||
err = plugin.Write([]telegraf.Metric{input})
|
err = plugin.Write([]telegraf.Metric{input})
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
// TODO not sure why the service returns this error, but the data arrives as required by the test
|
|
||||||
// rpc error: code = Internal desc = grpc: error while marshaling: proto: Marshal called with nil
|
|
||||||
if !strings.Contains(err.Error(), "proto: Marshal called with nil") {
|
|
||||||
assert.NoError(t, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
got := m.GotMetrics()
|
got := m.GotMetrics()
|
||||||
|
|
||||||
|
|
@ -139,5 +133,5 @@ func (m *mockOtelService) Export(ctx context.Context, request pmetricotlp.Reques
|
||||||
ctxMetadata, ok := metadata.FromIncomingContext(ctx)
|
ctxMetadata, ok := metadata.FromIncomingContext(ctx)
|
||||||
assert.Equal(m.t, []string{"header1"}, ctxMetadata.Get("test"))
|
assert.Equal(m.t, []string{"header1"}, ctxMetadata.Get("test"))
|
||||||
assert.True(m.t, ok)
|
assert.True(m.t, ok)
|
||||||
return pmetricotlp.Response{}, nil
|
return pmetricotlp.NewResponse(), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue