Skip to content

Commit 6601282

Browse files
authored
Merge pull request #2012 from immanuwell/fix/unkeyed-samplepair-struct-literals
fix: use keyed fields in SamplePair struct literals in api_test.go
2 parents 443f1ce + b65f296 commit 6601282

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

api/prometheus/v1/api_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,63 +1619,63 @@ func TestSamplesJSONSerialization(t *testing.T) {
16191619
expected string
16201620
}{
16211621
{
1622-
point: model.SamplePair{0, 0},
1622+
point: model.SamplePair{Timestamp: 0, Value: 0},
16231623
expected: `[0,"0"]`,
16241624
},
16251625
{
1626-
point: model.SamplePair{1, 20},
1626+
point: model.SamplePair{Timestamp: 1, Value: 20},
16271627
expected: `[0.001,"20"]`,
16281628
},
16291629
{
1630-
point: model.SamplePair{10, 20},
1630+
point: model.SamplePair{Timestamp: 10, Value: 20},
16311631
expected: `[0.010,"20"]`,
16321632
},
16331633
{
1634-
point: model.SamplePair{100, 20},
1634+
point: model.SamplePair{Timestamp: 100, Value: 20},
16351635
expected: `[0.100,"20"]`,
16361636
},
16371637
{
1638-
point: model.SamplePair{1001, 20},
1638+
point: model.SamplePair{Timestamp: 1001, Value: 20},
16391639
expected: `[1.001,"20"]`,
16401640
},
16411641
{
1642-
point: model.SamplePair{1010, 20},
1642+
point: model.SamplePair{Timestamp: 1010, Value: 20},
16431643
expected: `[1.010,"20"]`,
16441644
},
16451645
{
1646-
point: model.SamplePair{1100, 20},
1646+
point: model.SamplePair{Timestamp: 1100, Value: 20},
16471647
expected: `[1.100,"20"]`,
16481648
},
16491649
{
1650-
point: model.SamplePair{12345678123456555, 20},
1650+
point: model.SamplePair{Timestamp: 12345678123456555, Value: 20},
16511651
expected: `[12345678123456.555,"20"]`,
16521652
},
16531653
{
1654-
point: model.SamplePair{-1, 20},
1654+
point: model.SamplePair{Timestamp: -1, Value: 20},
16551655
expected: `[-0.001,"20"]`,
16561656
},
16571657
{
1658-
point: model.SamplePair{0, model.SampleValue(math.NaN())},
1658+
point: model.SamplePair{Timestamp: 0, Value: model.SampleValue(math.NaN())},
16591659
expected: `[0,"NaN"]`,
16601660
},
16611661
{
1662-
point: model.SamplePair{0, model.SampleValue(math.Inf(1))},
1662+
point: model.SamplePair{Timestamp: 0, Value: model.SampleValue(math.Inf(1))},
16631663
expected: `[0,"+Inf"]`,
16641664
},
16651665
{
1666-
point: model.SamplePair{0, model.SampleValue(math.Inf(-1))},
1666+
point: model.SamplePair{Timestamp: 0, Value: model.SampleValue(math.Inf(-1))},
16671667
expected: `[0,"-Inf"]`,
16681668
},
16691669
{
1670-
point: model.SamplePair{0, model.SampleValue(1.2345678e6)},
1670+
point: model.SamplePair{Timestamp: 0, Value: model.SampleValue(1.2345678e6)},
16711671
expected: `[0,"1234567.8"]`,
16721672
},
16731673
{
1674-
point: model.SamplePair{0, 1.2345678e-6},
1674+
point: model.SamplePair{Timestamp: 0, Value: 1.2345678e-6},
16751675
expected: `[0,"0.0000012345678"]`,
16761676
},
16771677
{
1678-
point: model.SamplePair{0, 1.2345678e-67},
1678+
point: model.SamplePair{Timestamp: 0, Value: 1.2345678e-67},
16791679
expected: `[0,"1.2345678e-67"]`,
16801680
},
16811681
}

0 commit comments

Comments
 (0)