mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
tsdb: Tidy up some test code
Use simpler utility function to create Labels objects, making fewer assumptions about the data structure. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
3543257d93
commit
89bf6e1df9
|
@ -379,23 +379,15 @@ func TestOOOHeadChunkReader_LabelValues(t *testing.T) {
|
|||
app := head.Appender(context.Background())
|
||||
|
||||
// Add in-order samples
|
||||
_, err := app.Append(0, labels.Labels{
|
||||
{Name: "foo", Value: "bar1"},
|
||||
}, 100, 1)
|
||||
_, err := app.Append(0, labels.FromStrings("foo", "bar1"), 100, 1)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.Labels{
|
||||
{Name: "foo", Value: "bar2"},
|
||||
}, 100, 2)
|
||||
_, err = app.Append(0, labels.FromStrings("foo", "bar2"), 100, 2)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Add ooo samples for those series
|
||||
_, err = app.Append(0, labels.Labels{
|
||||
{Name: "foo", Value: "bar1"},
|
||||
}, 90, 1)
|
||||
_, err = app.Append(0, labels.FromStrings("foo", "bar1"), 90, 1)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.Labels{
|
||||
{Name: "foo", Value: "bar2"},
|
||||
}, 90, 2)
|
||||
_, err = app.Append(0, labels.FromStrings("foo", "bar2"), 90, 2)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NoError(t, app.Commit())
|
||||
|
|
|
@ -2160,7 +2160,7 @@ func TestBlockBaseSeriesSet(t *testing.T) {
|
|||
{
|
||||
series: []refdSeries{
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "a", Value: "a"}}...),
|
||||
lset: labels.FromStrings("a", "a"),
|
||||
chunks: []chunks.Meta{
|
||||
{Ref: 29},
|
||||
{Ref: 45},
|
||||
|
@ -2173,19 +2173,19 @@ func TestBlockBaseSeriesSet(t *testing.T) {
|
|||
ref: 12,
|
||||
},
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "a", Value: "a"}, {Name: "b", Value: "b"}}...),
|
||||
lset: labels.FromStrings("a", "a", "b", "b"),
|
||||
chunks: []chunks.Meta{
|
||||
{Ref: 82}, {Ref: 23}, {Ref: 234}, {Ref: 65}, {Ref: 26},
|
||||
},
|
||||
ref: 10,
|
||||
},
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "b", Value: "c"}}...),
|
||||
lset: labels.FromStrings("b", "c"),
|
||||
chunks: []chunks.Meta{{Ref: 8282}},
|
||||
ref: 1,
|
||||
},
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "b", Value: "b"}}...),
|
||||
lset: labels.FromStrings("b", "b"),
|
||||
chunks: []chunks.Meta{
|
||||
{Ref: 829}, {Ref: 239}, {Ref: 2349}, {Ref: 659}, {Ref: 269},
|
||||
},
|
||||
|
@ -2198,14 +2198,14 @@ func TestBlockBaseSeriesSet(t *testing.T) {
|
|||
{
|
||||
series: []refdSeries{
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "a", Value: "a"}, {Name: "b", Value: "b"}}...),
|
||||
lset: labels.FromStrings("a", "a", "b", "b"),
|
||||
chunks: []chunks.Meta{
|
||||
{Ref: 82}, {Ref: 23}, {Ref: 234}, {Ref: 65}, {Ref: 26},
|
||||
},
|
||||
ref: 10,
|
||||
},
|
||||
{
|
||||
lset: labels.New([]labels.Label{{Name: "b", Value: "c"}}...),
|
||||
lset: labels.FromStrings("b", "c"),
|
||||
chunks: []chunks.Meta{{Ref: 8282}},
|
||||
ref: 3,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue