@@ -14,22 +14,24 @@ func TestDogstatsdProvider(t *testing.T) {
14
14
d := dogstatsd .New (prefix , log .NewNopLogger ())
15
15
provider := & DogstatsdProvider {D : d }
16
16
for _ , tst := range []struct {
17
- name string
18
- labels []string
19
- values []string
20
- prefix string
21
- countval float64
22
- gaugeval float64
23
- histoval float64
17
+ name string
18
+ labels []string
19
+ values []string
20
+ expected_values []string
21
+ prefix string
22
+ countval float64
23
+ gaugeval float64
24
+ histoval float64
24
25
}{
25
26
{
26
- name : "simpleTest" ,
27
- labels : []string {"service" , "host" , "path" , "target" , "other" },
28
- values : []string {"service" , "foo" , "host" , "bar" , "path" , "/asdf" , "target" , "http://jkl.org:1234" , "other" , "trailer" },
29
- prefix : "tst" ,
30
- countval : 20 ,
31
- gaugeval : 30 ,
32
- histoval : (time .Microsecond * 50 ).Seconds (),
27
+ name : "simpleTest" ,
28
+ labels : []string {"service" , "host" , "path" , "target" , "other" },
29
+ values : []string {"service" , "foo" , "host" , "bar" , "path" , "/asdf" , "target" , "http://jkl.org:1234" , "other" , "trailer" },
30
+ expected_values : []string {"fabio-service" , "foo" , "fabio-host" , "bar" , "path" , "/asdf" , "target" , "http://jkl.org:1234" , "other" , "trailer" },
31
+ prefix : "tst" ,
32
+ countval : 20 ,
33
+ gaugeval : 30 ,
34
+ histoval : (time .Microsecond * 50 ).Seconds (),
33
35
},
34
36
} {
35
37
t .Run (tst .name , func (t * testing.T ) {
@@ -59,7 +61,7 @@ func TestDogstatsdProvider(t *testing.T) {
59
61
if se .value != v .v {
60
62
t .Errorf ("%s failed: expected: %.02f, got %02f" , v .n , v .v , se .value )
61
63
}
62
- if len (tst .values ) > 0 && ! reflect .DeepEqual (se .tags , tst .values ) {
64
+ if len (tst .expected_values ) > 0 && ! reflect .DeepEqual (se .tags , tst .expected_values ) {
63
65
t .Errorf ("tags did not survive round trip parsing" )
64
66
}
65
67
} else {
0 commit comments