mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
Update package model/relabel tests for new labels.Labels type
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
8ad7b64c0f
commit
fe9fe0e1e5
|
@ -28,6 +28,7 @@ func TestRelabel(t *testing.T) {
|
|||
input labels.Labels
|
||||
relabel []*Config
|
||||
output labels.Labels
|
||||
drop bool
|
||||
}{
|
||||
{
|
||||
input: labels.FromMap(map[string]string{
|
||||
|
@ -101,7 +102,7 @@ func TestRelabel(t *testing.T) {
|
|||
Action: Replace,
|
||||
},
|
||||
},
|
||||
output: nil,
|
||||
drop: true,
|
||||
},
|
||||
{
|
||||
input: labels.FromMap(map[string]string{
|
||||
|
@ -115,7 +116,7 @@ func TestRelabel(t *testing.T) {
|
|||
Action: Drop,
|
||||
},
|
||||
},
|
||||
output: nil,
|
||||
drop: true,
|
||||
},
|
||||
{
|
||||
input: labels.FromMap(map[string]string{
|
||||
|
@ -177,7 +178,7 @@ func TestRelabel(t *testing.T) {
|
|||
Action: Keep,
|
||||
},
|
||||
},
|
||||
output: nil,
|
||||
drop: true,
|
||||
},
|
||||
{
|
||||
input: labels.FromMap(map[string]string{
|
||||
|
@ -483,7 +484,7 @@ func TestRelabel(t *testing.T) {
|
|||
TargetLabel: "__port1",
|
||||
},
|
||||
},
|
||||
output: nil,
|
||||
drop: true,
|
||||
},
|
||||
{
|
||||
input: labels.FromMap(map[string]string{
|
||||
|
@ -517,7 +518,7 @@ func TestRelabel(t *testing.T) {
|
|||
TargetLabel: "__port2",
|
||||
},
|
||||
},
|
||||
output: nil,
|
||||
drop: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -538,10 +539,13 @@ func TestRelabel(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
res := Process(test.input, test.relabel...)
|
||||
res, keep := Process(test.input, test.relabel...)
|
||||
require.Equal(t, !test.drop, keep)
|
||||
if keep {
|
||||
require.Equal(t, test.output, res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTargetLabelValidity(t *testing.T) {
|
||||
tests := []struct {
|
||||
|
@ -721,7 +725,7 @@ func BenchmarkRelabel(b *testing.B) {
|
|||
for _, tt := range tests {
|
||||
b.Run(tt.name, func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = Process(tt.lbls, tt.cfgs...)
|
||||
_, _ = Process(tt.lbls, tt.cfgs...)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue