Skip to content

Commit 5bb53db

Browse files
mmorel-35atoulme
authored andcommitted
[chore]: fix testifylint rules (processor) (open-telemetry#39174)
#### Description This fixes testifylint issues in processor folder discovered after golangci-lint@v2 upgrade Signed-off-by: Matthieu MOREL <[email protected]> Co-authored-by: Antoine Toulme <[email protected]>
1 parent 648475d commit 5bb53db

File tree

28 files changed

+112
-112
lines changed

28 files changed

+112
-112
lines changed

processor/attributesprocessor/attributes_log_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestLogProcessor_NilEmptyData(t *testing.T) {
8888
for _, tt := range testCases {
8989
t.Run(tt.name, func(t *testing.T) {
9090
assert.NoError(t, tp.ConsumeLogs(context.Background(), tt.input))
91-
assert.EqualValues(t, tt.output, tt.input)
91+
assert.Equal(t, tt.output, tt.input)
9292
})
9393
}
9494
}

processor/attributesprocessor/attributes_metric_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestMetricProcessor_NilEmptyData(t *testing.T) {
9696
tc := metricTestCases[i]
9797
t.Run(tc.name, func(t *testing.T) {
9898
assert.NoError(t, mp.ConsumeMetrics(context.Background(), tc.input))
99-
assert.EqualValues(t, tc.output, tc.input)
99+
assert.Equal(t, tc.output, tc.input)
100100
})
101101
}
102102
}

processor/attributesprocessor/attributes_trace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestSpanProcessor_NilEmptyData(t *testing.T) {
9797
for _, tt := range testCases {
9898
t.Run(tt.name, func(t *testing.T) {
9999
assert.NoError(t, tp.ConsumeTraces(context.Background(), tt.input))
100-
assert.EqualValues(t, tt.output, tt.input)
100+
assert.Equal(t, tt.output, tt.input)
101101
})
102102
}
103103
}

processor/datadogsemanticsprocessor/processor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func TestBasicTranslation(t *testing.T) {
336336
require.Equal(t, "specified-error-stack", ddErrorStack.AsString())
337337

338338
ddHost, _ := rs.Resource().Attributes().Get("datadog.host.name")
339-
require.Equal(t, "", ddHost.AsString())
339+
require.Empty(t, ddHost.AsString())
340340
},
341341
},
342342
}

processor/groupbyattrsprocessor/attribute_groups_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,23 @@ func TestInstrumentationLibraryMatching(t *testing.T) {
127127
ill1 := matchingScopeLogs(rl, il1)
128128
ils1 := matchingScopeSpans(rs, il1)
129129
ilm1 := matchingScopeMetrics(rm, il1)
130-
assert.EqualValues(t, il1, ill1.Scope())
131-
assert.EqualValues(t, il1, ils1.Scope())
132-
assert.EqualValues(t, il1, ilm1.Scope())
130+
assert.Equal(t, il1, ill1.Scope())
131+
assert.Equal(t, il1, ils1.Scope())
132+
assert.Equal(t, il1, ilm1.Scope())
133133

134134
ill2 := matchingScopeLogs(rl, il2)
135135
ils2 := matchingScopeSpans(rs, il2)
136136
ilm2 := matchingScopeMetrics(rm, il2)
137-
assert.EqualValues(t, il2, ill2.Scope())
138-
assert.EqualValues(t, il2, ils2.Scope())
139-
assert.EqualValues(t, il2, ilm2.Scope())
137+
assert.Equal(t, il2, ill2.Scope())
138+
assert.Equal(t, il2, ils2.Scope())
139+
assert.Equal(t, il2, ilm2.Scope())
140140

141141
ill1 = matchingScopeLogs(rl, il1)
142142
ils1 = matchingScopeSpans(rs, il1)
143143
ilm1 = matchingScopeMetrics(rm, il1)
144-
assert.EqualValues(t, il1, ill1.Scope())
145-
assert.EqualValues(t, il1, ils1.Scope())
146-
assert.EqualValues(t, il1, ilm1.Scope())
144+
assert.Equal(t, il1, ill1.Scope())
145+
assert.Equal(t, il1, ils1.Scope())
146+
assert.Equal(t, il1, ilm1.Scope())
147147
}
148148

149149
func BenchmarkAttrGrouping(b *testing.B) {

processor/groupbyattrsprocessor/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ func TestDuplicateKeys(t *testing.T) {
5252
gbap, err := createGroupByAttrsProcessor(processortest.NewNopSettings(metadata.Type), []string{"foo", "foo", ""})
5353
require.NoError(t, err)
5454
assert.NotNil(t, gbap)
55-
assert.EqualValues(t, []string{"foo"}, gbap.groupByKeys)
55+
assert.Equal(t, []string{"foo"}, gbap.groupByKeys)
5656
}

processor/groupbyattrsprocessor/processor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func TestComplexAttributeGrouping(t *testing.T) {
315315
for j := 0; j < rl.ScopeLogs().Len(); j++ {
316316
logs := rl.ScopeLogs().At(j).LogRecords()
317317
for k := 0; k < logs.Len(); k++ {
318-
assert.EqualValues(t, outputRecordAttrs, logs.At(k).Attributes())
318+
assert.Equal(t, outputRecordAttrs, logs.At(k).Attributes())
319319
}
320320
}
321321
}
@@ -332,7 +332,7 @@ func TestComplexAttributeGrouping(t *testing.T) {
332332
for j := 0; j < rs.ScopeSpans().Len(); j++ {
333333
spans := rs.ScopeSpans().At(j).Spans()
334334
for k := 0; k < spans.Len(); k++ {
335-
assert.EqualValues(t, outputRecordAttrs, spans.At(k).Attributes())
335+
assert.Equal(t, outputRecordAttrs, spans.At(k).Attributes())
336336
}
337337
}
338338
}
@@ -351,7 +351,7 @@ func TestComplexAttributeGrouping(t *testing.T) {
351351
for k := 0; k < metrics.Len(); k++ {
352352
metric := metrics.At(k)
353353
for l := 0; l < metric.Gauge().DataPoints().Len(); l++ {
354-
assert.EqualValues(t, outputRecordAttrs, metric.Gauge().DataPoints().At(l).Attributes())
354+
assert.Equal(t, outputRecordAttrs, metric.Gauge().DataPoints().At(l).Attributes())
355355
}
356356
}
357357
}
@@ -372,7 +372,7 @@ func TestComplexAttributeGrouping(t *testing.T) {
372372
metric := metrics.At(k)
373373
assert.Equal(t, pmetric.AggregationTemporalityCumulative, metric.Histogram().AggregationTemporality())
374374
for l := 0; l < metric.Histogram().DataPoints().Len(); l++ {
375-
assert.EqualValues(t, outputRecordAttrs, metric.Histogram().DataPoints().At(l).Attributes())
375+
assert.Equal(t, outputRecordAttrs, metric.Histogram().DataPoints().At(l).Attributes())
376376
}
377377
}
378378
}

processor/k8sattributesprocessor/internal/kube/client_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func podAddAndUpdateTest(t *testing.T, c *WatchClient, handler func(obj any)) {
6464
got := c.Pods[newPodIdentifier("connection", "k8s.pod.ip", "1.1.1.1")]
6565
assert.Equal(t, "1.1.1.1", got.Address)
6666
assert.Equal(t, "podA", got.Name)
67-
assert.Equal(t, "", got.PodUID)
67+
assert.Empty(t, got.PodUID)
6868

6969
pod = &api_v1.Pod{}
7070
pod.Name = "podB"
@@ -74,7 +74,7 @@ func podAddAndUpdateTest(t *testing.T, c *WatchClient, handler func(obj any)) {
7474
got = c.Pods[newPodIdentifier("connection", "k8s.pod.ip", "1.1.1.1")]
7575
assert.Equal(t, "1.1.1.1", got.Address)
7676
assert.Equal(t, "podB", got.Name)
77-
assert.Equal(t, "", got.PodUID)
77+
assert.Empty(t, got.PodUID)
7878

7979
pod = &api_v1.Pod{}
8080
pod.Name = "podC"
@@ -105,7 +105,7 @@ func namespaceAddAndUpdateTest(t *testing.T, c *WatchClient, handler func(obj an
105105
assert.Len(t, c.Namespaces, 1)
106106
got := c.Namespaces["namespaceA"]
107107
assert.Equal(t, "namespaceA", got.Name)
108-
assert.Equal(t, "", got.NamespaceUID)
108+
assert.Empty(t, got.NamespaceUID)
109109

110110
namespace = &api_v1.Namespace{}
111111
namespace.Name = "namespaceB"
@@ -131,7 +131,7 @@ func nodeAddAndUpdateTest(t *testing.T, c *WatchClient, handler func(obj any)) {
131131
got, ok := c.GetNode("nodeA")
132132
assert.True(t, ok)
133133
assert.Equal(t, "nodeA", got.Name)
134-
assert.Equal(t, "", got.NodeUID)
134+
assert.Empty(t, got.NodeUID)
135135

136136
node = &api_v1.Node{}
137137
node.Name = "nodeB"
@@ -319,7 +319,7 @@ func TestPodCreate(t *testing.T) {
319319
c.handlePodAdd(pod)
320320
assert.Len(t, c.Pods, 1)
321321
got := c.Pods[newPodIdentifier("resource_attribute", "k8s.pod.uid", "11111111-2222-3333-4444-555555555555")]
322-
assert.Equal(t, "", got.Address)
322+
assert.Empty(t, got.Address)
323323
assert.Equal(t, "podD", got.Name)
324324
assert.Equal(t, "11111111-2222-3333-4444-555555555555", got.PodUID)
325325

@@ -330,7 +330,7 @@ func TestPodCreate(t *testing.T) {
330330
c.handlePodUpdate(&api_v1.Pod{}, pod)
331331
assert.Len(t, c.Pods, 1)
332332
got = c.Pods[newPodIdentifier("resource_attribute", "k8s.pod.uid", "11111111-2222-3333-4444-555555555555")]
333-
assert.Equal(t, "", got.Address)
333+
assert.Empty(t, got.Address)
334334
assert.Equal(t, "podD", got.Name)
335335
assert.Equal(t, "11111111-2222-3333-4444-555555555555", got.PodUID)
336336

@@ -976,7 +976,7 @@ func TestExtractionRules(t *testing.T) {
976976
p, ok := c.GetPod(newPodIdentifier("connection", "", pod.Status.PodIP))
977977
require.True(t, ok)
978978

979-
assert.Equal(t, len(tc.attributes), len(p.Attributes))
979+
assert.Len(t, p.Attributes, len(tc.attributes))
980980
for k, v := range tc.attributes {
981981
got, ok := p.Attributes[k]
982982
assert.True(t, ok)
@@ -1132,7 +1132,7 @@ func TestReplicaSetExtractionRules(t *testing.T) {
11321132
p, ok := c.GetPod(newPodIdentifier("connection", "", pod.Status.PodIP))
11331133
require.True(t, ok)
11341134

1135-
assert.Equal(t, len(tc.attributes), len(p.Attributes))
1135+
assert.Len(t, p.Attributes, len(tc.attributes))
11361136
for k, v := range tc.attributes {
11371137
got, ok := p.Attributes[k]
11381138
assert.True(t, ok)
@@ -1228,7 +1228,7 @@ func TestNamespaceExtractionRules(t *testing.T) {
12281228
p, ok := c.GetNamespace(namespace.Name)
12291229
require.True(t, ok)
12301230

1231-
assert.Equal(t, len(tc.attributes), len(p.Attributes))
1231+
assert.Len(t, p.Attributes, len(tc.attributes))
12321232
for k, v := range tc.attributes {
12331233
got, ok := p.Attributes[k]
12341234
assert.True(t, ok)
@@ -1324,7 +1324,7 @@ func TestNodeExtractionRules(t *testing.T) {
13241324
n, ok := c.GetNode(node.Name)
13251325
require.True(t, ok)
13261326

1327-
assert.Equal(t, len(tc.attributes), len(n.Attributes))
1327+
assert.Len(t, n.Attributes, len(tc.attributes))
13281328
for k, v := range tc.attributes {
13291329
got, ok := n.Attributes[k]
13301330
assert.True(t, ok)

processor/k8sattributesprocessor/options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestWithFilterNode(t *testing.T) {
4141

4242
p = &kubernetesprocessor{}
4343
assert.NoError(t, withFilterNode("testnode", "NODE_NAME")(p))
44-
assert.Equal(t, "", p.filters.Node)
44+
assert.Empty(t, p.filters.Node)
4545

4646
t.Setenv("NODE_NAME", "nodefromenv")
4747
p = &kubernetesprocessor{}

processor/k8sattributesprocessor/processor_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,18 +1637,18 @@ func TestStartStop(t *testing.T) {
16371637
func assertResourceHasStringAttribute(t *testing.T, r pcommon.Resource, k, v string) {
16381638
got, ok := r.Attributes().Get(k)
16391639
require.Truef(t, ok, "resource does not contain attribute %s", k)
1640-
assert.EqualValues(t, pcommon.ValueTypeStr, got.Type(), "attribute %s is not of type string", k)
1641-
assert.EqualValues(t, v, got.Str(), "attribute %s is not equal to %s", k, v)
1640+
assert.Equal(t, pcommon.ValueTypeStr, got.Type(), "attribute %s is not of type string", k)
1641+
assert.Equal(t, v, got.Str(), "attribute %s is not equal to %s", k, v)
16421642
}
16431643

16441644
func assertResourceHasStringSlice(t *testing.T, r pcommon.Resource, k string, v []string) {
16451645
got, ok := r.Attributes().Get(k)
16461646
require.Truef(t, ok, "resource does not contain attribute %s", k)
1647-
assert.EqualValues(t, pcommon.ValueTypeSlice, got.Type(), "attribute %s is not of type slice", k)
1647+
assert.Equal(t, pcommon.ValueTypeSlice, got.Type(), "attribute %s is not of type slice", k)
16481648
slice := got.Slice()
16491649
for i := 0; i < slice.Len(); i++ {
1650-
assert.EqualValues(t, pcommon.ValueTypeStr, slice.At(i).Type())
1651-
assert.EqualValues(t, v[i], slice.At(i).AsString(), "attribute %s[%d] is not equal to %s", k, i, v[i])
1650+
assert.Equal(t, pcommon.ValueTypeStr, slice.At(i).Type())
1651+
assert.Equal(t, v[i], slice.At(i).AsString(), "attribute %s[%d] is not equal to %s", k, i, v[i])
16521652
}
16531653
}
16541654

0 commit comments

Comments
 (0)