Skip to content

Commit 7e58100

Browse files
authored
[chore] exclude unkeyed literal initialization for pprofiletest structs (#43787)
This is needed to upgrade checkapi v0.28.1, which now picks up on structs in APIs.
1 parent f75427b commit 7e58100

File tree

2 files changed

+65
-39
lines changed

2 files changed

+65
-39
lines changed

pkg/pdatatest/pprofiletest/profiles_test.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ func basicProfiles() Profiles {
2121
ResourceProfiles: []ResourceProfile{
2222
{
2323
Resource: Resource{
24-
Attributes: []Attribute{{"key1", "value1"}},
24+
Attributes: []Attribute{{Key: "key1", Value: "value1"}},
2525
},
2626
ScopeProfiles: []ScopeProfile{
2727
{
2828
Profile: []Profile{
2929
{
30-
Attributes: []Attribute{{"scope-attr1", "value1"}},
30+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
3131
ProfileID: pprofile.NewProfileIDEmpty(),
3232
},
3333
},
@@ -63,12 +63,12 @@ func TestCompareProfiles(t *testing.T) {
6363
name: "attribute value string is not bool",
6464
expected: func() pprofile.Profiles {
6565
p := basicProfiles()
66-
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{"key1", "true"}
66+
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{Key: "key1", Value: "true"}
6767
return p.Transform()
6868
}(),
6969
actual: func() pprofile.Profiles {
7070
p := basicProfiles()
71-
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{"key1", true}
71+
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{Key: "key1", Value: true}
7272
return p.Transform()
7373
}(),
7474
withoutOptions: errors.New(`missing expected resource: map[key1:true]; unexpected resource: map[key1:true]`),
@@ -79,13 +79,13 @@ func TestCompareProfiles(t *testing.T) {
7979
p := basicProfiles()
8080
p.ResourceProfiles = append(p.ResourceProfiles, ResourceProfile{
8181
Resource: Resource{
82-
Attributes: []Attribute{{"key2", "value2"}},
82+
Attributes: []Attribute{{Key: "key2", Value: "value2"}},
8383
},
8484
ScopeProfiles: []ScopeProfile{
8585
{
8686
Profile: []Profile{
8787
{
88-
Attributes: []Attribute{{"scope-attr2", "value2"}},
88+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
8989
},
9090
},
9191
},
@@ -95,17 +95,17 @@ func TestCompareProfiles(t *testing.T) {
9595
}(),
9696
actual: func() pprofile.Profiles {
9797
p := basicProfiles()
98-
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{"key2", "value2"}
99-
p.ResourceProfiles[0].ScopeProfiles[0].Profile[0].Attributes[0] = Attribute{"scope-attr2", "value2"}
98+
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{Key: "key2", Value: "value2"}
99+
p.ResourceProfiles[0].ScopeProfiles[0].Profile[0].Attributes[0] = Attribute{Key: "scope-attr2", Value: "value2"}
100100
p.ResourceProfiles = append(p.ResourceProfiles, ResourceProfile{
101101
Resource: Resource{
102-
Attributes: []Attribute{{"key1", "value1"}},
102+
Attributes: []Attribute{{Key: "key1", Value: "value1"}},
103103
},
104104
ScopeProfiles: []ScopeProfile{
105105
{
106106
Profile: []Profile{
107107
{
108-
Attributes: []Attribute{{"scope-attr1", "value1"}},
108+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
109109
},
110110
},
111111
},
@@ -145,13 +145,13 @@ func TestCompareProfiles(t *testing.T) {
145145
{
146146
Scope: Scope{
147147
Name: "scope1",
148-
Attributes: []Attribute{{"scope-attr1", "value1"}},
148+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
149149
},
150150
},
151151
{
152152
Scope: Scope{
153153
Name: "scope2",
154-
Attributes: []Attribute{{"scope-attr2", "value2"}},
154+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
155155
},
156156
},
157157
}
@@ -163,13 +163,13 @@ func TestCompareProfiles(t *testing.T) {
163163
{
164164
Scope: Scope{
165165
Name: "scope2",
166-
Attributes: []Attribute{{"scope-attr2", "value2"}},
166+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
167167
},
168168
},
169169
{
170170
Scope: Scope{
171171
Name: "scope1",
172-
Attributes: []Attribute{{"scope-attr1", "value1"}},
172+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
173173
},
174174
},
175175
}
@@ -188,13 +188,13 @@ func TestCompareProfiles(t *testing.T) {
188188
{
189189
Scope: Scope{
190190
Name: "scope1",
191-
Attributes: []Attribute{{"scope-attr1", "value1"}},
191+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
192192
},
193193
},
194194
{
195195
Scope: Scope{
196196
Name: "scope2",
197-
Attributes: []Attribute{{"scope-attr2", "value2"}},
197+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
198198
},
199199
},
200200
}
@@ -206,13 +206,13 @@ func TestCompareProfiles(t *testing.T) {
206206
{
207207
Scope: Scope{
208208
Name: "scope1",
209-
Attributes: []Attribute{{"scope-attr1", "value12"}},
209+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value12"}},
210210
},
211211
},
212212
{
213213
Scope: Scope{
214214
Name: "scope2",
215-
Attributes: []Attribute{{"scope-attr2", "value22"}},
215+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value22"}},
216216
},
217217
},
218218
}
@@ -232,11 +232,11 @@ func TestCompareProfiles(t *testing.T) {
232232
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
233233
{
234234
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
235-
Attributes: []Attribute{{"container-attr1", "value1"}},
235+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
236236
},
237237
{
238238
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
239-
Attributes: []Attribute{{"container-attr2", "value2"}},
239+
Attributes: []Attribute{{Key: "container-attr2", Value: "value2"}},
240240
},
241241
}
242242
return p.Transform()
@@ -247,11 +247,11 @@ func TestCompareProfiles(t *testing.T) {
247247
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
248248
{
249249
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
250-
Attributes: []Attribute{{"container-attr2", "value2"}},
250+
Attributes: []Attribute{{Key: "container-attr2", Value: "value2"}},
251251
},
252252
{
253253
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
254-
Attributes: []Attribute{{"container-attr1", "value1"}},
254+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
255255
},
256256
}
257257
return p.Transform()
@@ -269,11 +269,11 @@ func TestCompareProfiles(t *testing.T) {
269269
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
270270
{
271271
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
272-
Attributes: []Attribute{{"container-attr1", "value1"}},
272+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
273273
},
274274
{
275275
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
276-
Attributes: []Attribute{{"container-attr2", "value2"}},
276+
Attributes: []Attribute{{Key: "container-attr2", Value: "value2"}},
277277
},
278278
}
279279
return p.Transform()
@@ -284,11 +284,11 @@ func TestCompareProfiles(t *testing.T) {
284284
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
285285
{
286286
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
287-
Attributes: []Attribute{{"container-attr1", "value3"}},
287+
Attributes: []Attribute{{Key: "container-attr1", Value: "value3"}},
288288
},
289289
{
290290
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
291-
Attributes: []Attribute{{"container-attr2", "value4"}},
291+
Attributes: []Attribute{{Key: "container-attr2", Value: "value4"}},
292292
},
293293
}
294294
return p.Transform()
@@ -307,7 +307,7 @@ func TestCompareProfiles(t *testing.T) {
307307
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
308308
{
309309
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
310-
Attributes: []Attribute{{"container-attr1", "value1"}},
310+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
311311
TimeNanos: pcommon.NewTimestampFromTime(timestamp1),
312312
DurationNanos: pcommon.NewTimestampFromTime(timestamp2),
313313
},
@@ -320,7 +320,7 @@ func TestCompareProfiles(t *testing.T) {
320320
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
321321
{
322322
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
323-
Attributes: []Attribute{{"container-attr1", "value1"}},
323+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
324324
TimeNanos: pcommon.NewTimestampFromTime(timestamp2),
325325
DurationNanos: pcommon.NewTimestampFromTime(timestamp2),
326326
},
@@ -340,7 +340,7 @@ func TestCompareProfiles(t *testing.T) {
340340
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
341341
{
342342
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
343-
Attributes: []Attribute{{"container-attr1", "value1"}},
343+
Attributes: []Attribute{{Key: "container-attr1", Value: "value1"}},
344344
TimeNanos: pcommon.NewTimestampFromTime(timestamp1),
345345
DurationNanos: pcommon.NewTimestampFromTime(timestamp1.Add(5 * time.Second)),
346346
},
@@ -350,11 +350,11 @@ func TestCompareProfiles(t *testing.T) {
350350
actual: func() pprofile.Profiles {
351351
p := basicProfiles()
352352
p.ResourceProfiles[0].ScopeProfiles[0].Scope.Name = "scope1"
353-
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{"key1", "value2"}
353+
p.ResourceProfiles[0].Resource.Attributes[0] = Attribute{Key: "key1", Value: "value2"}
354354
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
355355
{
356356
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
357-
Attributes: []Attribute{{"container-attr1", "value2"}},
357+
Attributes: []Attribute{{Key: "container-attr1", Value: "value2"}},
358358
TimeNanos: pcommon.NewTimestampFromTime(timestamp2),
359359
DurationNanos: pcommon.NewTimestampFromTime(timestamp2.Add(5 * time.Second)),
360360
},
@@ -583,11 +583,11 @@ func TestCompareScopeProfiles(t *testing.T) {
583583
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
584584
{
585585
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
586-
Attributes: []Attribute{{"scope-attr1", "value1"}},
586+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
587587
},
588588
{
589589
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
590-
Attributes: []Attribute{{"scope-attr2", "value2"}},
590+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
591591
},
592592
}
593593
tr := p.Transform()
@@ -598,11 +598,11 @@ func TestCompareScopeProfiles(t *testing.T) {
598598
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
599599
{
600600
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
601-
Attributes: []Attribute{{"scope-attr2", "value2"}},
601+
Attributes: []Attribute{{Key: "scope-attr2", Value: "value2"}},
602602
},
603603
{
604604
ProfileID: pprofile.ProfileID([]byte("profileid1111112")),
605-
Attributes: []Attribute{{"scope-attr1", "value1"}},
605+
Attributes: []Attribute{{Key: "scope-attr1", Value: "value1"}},
606606
},
607607
}
608608
tr := p.Transform()
@@ -651,7 +651,7 @@ func TestCompareProfile(t *testing.T) {
651651
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
652652
{
653653
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
654-
Attributes: []Attribute{{"key", "val"}},
654+
Attributes: []Attribute{{Key: "key", Value: "val"}},
655655
DroppedAttributesCount: 2,
656656
DefaultSampleType: ValueType{
657657
Typ: "samples",
@@ -677,7 +677,7 @@ func TestCompareProfile(t *testing.T) {
677677
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
678678
{
679679
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
680-
Attributes: []Attribute{{"key", "val"}},
680+
Attributes: []Attribute{{Key: "key", Value: "val"}},
681681
DroppedAttributesCount: 2,
682682
DefaultSampleType: ValueType{
683683
Typ: "samples",
@@ -706,7 +706,7 @@ func TestCompareProfile(t *testing.T) {
706706
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
707707
{
708708
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
709-
Attributes: []Attribute{{"key", "val"}},
709+
Attributes: []Attribute{{Key: "key", Value: "val"}},
710710
DroppedAttributesCount: 2,
711711
DefaultSampleType: ValueType{
712712
Typ: "samples",
@@ -732,7 +732,7 @@ func TestCompareProfile(t *testing.T) {
732732
p.ResourceProfiles[0].ScopeProfiles[0].Profile = []Profile{
733733
{
734734
ProfileID: pprofile.ProfileID([]byte("profileid1111111")),
735-
Attributes: []Attribute{{"key1", "val1"}},
735+
Attributes: []Attribute{{Key: "key1", Value: "val1"}},
736736
DroppedAttributesCount: 2,
737737
DefaultSampleType: ValueType{
738738
Typ: "samples1",

0 commit comments

Comments
 (0)