@@ -19,7 +19,7 @@ func TestGraphitePublisher(t *testing.T) {
19
19
So (err , ShouldBeNil )
20
20
21
21
sec , err := setting .Cfg .NewSection ("metrics.graphite" )
22
- sec .NewKey ("prefix" , "service .grafana.%(instance_name)s." )
22
+ sec .NewKey ("prefix" , "prod .grafana.%(instance_name)s." )
23
23
sec .NewKey ("address" , "localhost:2001" )
24
24
25
25
So (err , ShouldBeNil )
@@ -30,27 +30,47 @@ func TestGraphitePublisher(t *testing.T) {
30
30
So (err , ShouldBeNil )
31
31
So (publisher , ShouldNotBeNil )
32
32
33
- So (publisher .prefix , ShouldEqual , "service .grafana.hostname_with_dots_com." )
33
+ So (publisher .prefix , ShouldEqual , "prod .grafana.hostname_with_dots_com." )
34
34
So (publisher .address , ShouldEqual , "localhost:2001" )
35
35
})
36
36
37
- Convey ("Test graphite publisher default values " , t , func () {
37
+ Convey ("Test graphite publisher default prefix " , t , func () {
38
38
var err error
39
39
err = setting .NewConfigContext (& setting.CommandLineArgs {
40
40
HomePath : "../../" ,
41
41
})
42
42
43
43
So (err , ShouldBeNil )
44
44
45
- _ , err = setting .Cfg .NewSection ("metrics.graphite" )
45
+ sec , err := setting .Cfg .NewSection ("metrics.graphite" )
46
+ sec .NewKey ("address" , "localhost:2001" )
47
+
48
+ So (err , ShouldBeNil )
46
49
47
50
setting .InstanceName = "hostname.with.dots.com"
48
51
publisher , err := CreateGraphitePublisher ()
49
52
50
53
So (err , ShouldBeNil )
51
54
So (publisher , ShouldNotBeNil )
52
55
53
- So (publisher .prefix , ShouldEqual , "service.grafana.hostname_with_dots_com." )
54
- So (publisher .address , ShouldEqual , "localhost:2003" )
56
+ So (publisher .prefix , ShouldEqual , "prod.grafana.hostname_with_dots_com." )
57
+ So (publisher .address , ShouldEqual , "localhost:2001" )
58
+ })
59
+
60
+ Convey ("Test graphite publisher default values" , t , func () {
61
+ var err error
62
+ err = setting .NewConfigContext (& setting.CommandLineArgs {
63
+ HomePath : "../../" ,
64
+ })
65
+
66
+ So (err , ShouldBeNil )
67
+
68
+ _ , err = setting .Cfg .NewSection ("metrics.graphite" )
69
+
70
+ setting .InstanceName = "hostname.with.dots.com"
71
+ publisher , err := CreateGraphitePublisher ()
72
+
73
+ So (err , ShouldBeNil )
74
+ So (publisher , ShouldBeNil )
55
75
})
56
76
}
0 commit comments