Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHelmuth committed Dec 17, 2024
1 parent 6d24583 commit 374ed85
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 123 deletions.
9 changes: 0 additions & 9 deletions pkg/ottl/contexts/internal/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ func TestResourcePathGetSetter(t *testing.T) {
newVal any
modified func(resource pcommon.Resource)
}{
{
name: "resource",
path: nil,
orig: refResource,
newVal: pcommon.NewResource(),
modified: func(resource pcommon.Resource) {
pcommon.NewResource().CopyTo(resource)
},
},
{
name: "resource schema_url",
path: &TestPath[*resourceContext]{
Expand Down
9 changes: 0 additions & 9 deletions pkg/ottl/contexts/internal/scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ func TestScopePathGetSetter(t *testing.T) {
newVal any
modified func(is pcommon.InstrumentationScope)
}{
{
name: "instrumentation_scope",
path: nil,
orig: refIS,
newVal: pcommon.NewInstrumentationScope(),
modified: func(is pcommon.InstrumentationScope) {
pcommon.NewInstrumentationScope().CopyTo(is)
},
},
{
name: "instrumentation_scope name",
path: &TestPath[*instrumentationScopeContext]{
Expand Down
13 changes: 0 additions & 13 deletions pkg/ottl/contexts/ottldatapoint/datapoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1923,8 +1923,6 @@ func createAttributeTelemetry(attributes pcommon.Map) {
}

func Test_newPathGetSetter_Metric(t *testing.T) {
refMetric := createMetricTelemetry()

newMetric := pmetric.NewMetric()
newMetric.SetName("new name")

Expand All @@ -1935,17 +1933,6 @@ func Test_newPathGetSetter_Metric(t *testing.T) {
newVal any
modified func(metric pmetric.Metric)
}{
{
name: "metric",
path: &internal.TestPath[TransformContext]{
N: "metric",
},
orig: refMetric,
newVal: newMetric,
modified: func(metric pmetric.Metric) {
newMetric.CopyTo(metric)
},
},
{
name: "metric name",
path: &internal.TestPath[TransformContext]{
Expand Down
24 changes: 1 addition & 23 deletions pkg/ottl/contexts/ottllog/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
)

func Test_newPathGetSetter(t *testing.T) {
refLog, refIS, refResource := createTelemetry("string")
refLog, _, _ := createTelemetry("string")

newAttrs := pcommon.NewMap()
newAttrs.PutStr("hello", "world")
Expand Down Expand Up @@ -596,28 +596,6 @@ func Test_newPathGetSetter(t *testing.T) {
log.SetDroppedAttributesCount(20)
},
},
{
name: "instrumentation_scope",
path: &internal.TestPath[TransformContext]{
N: "instrumentation_scope",
},
orig: refIS,
newVal: pcommon.NewInstrumentationScope(),
modified: func(_ plog.LogRecord, il pcommon.InstrumentationScope, _ pcommon.Resource, _ pcommon.Map) {
pcommon.NewInstrumentationScope().CopyTo(il)
},
},
{
name: "resource",
path: &internal.TestPath[TransformContext]{
N: "resource",
},
orig: refResource,
newVal: pcommon.NewResource(),
modified: func(_ plog.LogRecord, _ pcommon.InstrumentationScope, resource pcommon.Resource, _ pcommon.Map) {
pcommon.NewResource().CopyTo(resource)
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
13 changes: 1 addition & 12 deletions pkg/ottl/contexts/ottlscope/scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func Test_newPathGetSetter(t *testing.T) {
refIS, refResource := createTelemetry()
refIS, _ := createTelemetry()

newAttrs := pcommon.NewMap()
newAttrs.PutStr("hello", "world")
Expand Down Expand Up @@ -382,17 +382,6 @@ func Test_newPathGetSetter(t *testing.T) {
is.SetVersion("next")
},
},
{
name: "resource",
path: &internal.TestPath[TransformContext]{
N: "resource",
},
orig: refResource,
newVal: pcommon.NewResource(),
modified: func(_ pcommon.InstrumentationScope, resource pcommon.Resource, _ pcommon.Map) {
pcommon.NewResource().CopyTo(resource)
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
24 changes: 1 addition & 23 deletions pkg/ottl/contexts/ottlspan/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
)

func Test_newPathGetSetter(t *testing.T) {
refSpan, refIS, refResource := createTelemetry()
refSpan, _, _ := createTelemetry()

newAttrs := pcommon.NewMap()
newAttrs.PutStr("hello", "world")
Expand Down Expand Up @@ -649,28 +649,6 @@ func Test_newPathGetSetter(t *testing.T) {
span.Status().SetMessage("bad span")
},
},
{
name: "instrumentation_scope",
path: &internal.TestPath[TransformContext]{
N: "instrumentation_scope",
},
orig: refIS,
newVal: pcommon.NewInstrumentationScope(),
modified: func(_ ptrace.Span, il pcommon.InstrumentationScope, _ pcommon.Resource, _ pcommon.Map) {
pcommon.NewInstrumentationScope().CopyTo(il)
},
},
{
name: "resource",
path: &internal.TestPath[TransformContext]{
N: "resource",
},
orig: refResource,
newVal: pcommon.NewResource(),
modified: func(_ ptrace.Span, _ pcommon.InstrumentationScope, resource pcommon.Resource, _ pcommon.Map) {
pcommon.NewResource().CopyTo(resource)
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
35 changes: 1 addition & 34 deletions pkg/ottl/contexts/ottlspanevent/span_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
var spanID2 = [8]byte{8, 7, 6, 5, 4, 3, 2, 1}

func Test_newPathGetSetter(t *testing.T) {
refSpanEvent, refSpan, refIS, refResource := createTelemetry()
refSpanEvent, _, _, _ := createTelemetry()

newAttrs := pcommon.NewMap()
newAttrs.PutStr("hello", "world")
Expand Down Expand Up @@ -405,39 +405,6 @@ func Test_newPathGetSetter(t *testing.T) {
spanEvent.SetDroppedAttributesCount(20)
},
},
{
name: "instrumentation_scope",
path: &internal.TestPath[TransformContext]{
N: "instrumentation_scope",
},
orig: refIS,
newVal: pcommon.NewInstrumentationScope(),
modified: func(_ ptrace.SpanEvent, _ ptrace.Span, il pcommon.InstrumentationScope, _ pcommon.Resource, _ pcommon.Map) {
pcommon.NewInstrumentationScope().CopyTo(il)
},
},
{
name: "resource",
path: &internal.TestPath[TransformContext]{
N: "resource",
},
orig: refResource,
newVal: pcommon.NewResource(),
modified: func(_ ptrace.SpanEvent, _ ptrace.Span, _ pcommon.InstrumentationScope, resource pcommon.Resource, _ pcommon.Map) {
pcommon.NewResource().CopyTo(resource)
},
},
{
name: "span",
path: &internal.TestPath[TransformContext]{
N: "span",
},
orig: refSpan,
newVal: ptrace.NewSpan(),
modified: func(_ ptrace.SpanEvent, span ptrace.Span, _ pcommon.InstrumentationScope, _ pcommon.Resource, _ pcommon.Map) {
ptrace.NewSpan().CopyTo(span)
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 374ed85

Please sign in to comment.