@@ -12,26 +12,26 @@ import (
12
12
)
13
13
14
14
const (
15
- dirty_data = "1.5G"
16
- bypassed = "4.7T"
17
- cache_bypass_hits = "146155333"
18
- cache_bypass_misses = "0"
19
- cache_hit_ratio = "90"
20
- cache_hits = "511469583"
21
- cache_miss_collisions = "157567"
22
- cache_misses = "50616331"
23
- cache_readaheads = "2"
15
+ dirtyData = "1.5G"
16
+ bypassed = "4.7T"
17
+ cacheBypassHits = "146155333"
18
+ cacheBypassMisses = "0"
19
+ cacheHitRatio = "90"
20
+ cacheHits = "511469583"
21
+ cacheMissCollisions = "157567"
22
+ cacheMisses = "50616331"
23
+ cacheReadaheads = "2"
24
24
)
25
25
26
26
var (
27
27
testBcachePath = os .TempDir () + "/telegraf/sys/fs/bcache"
28
- testBcacheUuidPath = testBcachePath + "/663955a3-765a-4737-a9fd-8250a7a78411"
28
+ testBcacheUUIDPath = testBcachePath + "/663955a3-765a-4737-a9fd-8250a7a78411"
29
29
testBcacheDevPath = os .TempDir () + "/telegraf/sys/devices/virtual/block/bcache0"
30
30
testBcacheBackingDevPath = os .TempDir () + "/telegraf/sys/devices/virtual/block/md10"
31
31
)
32
32
33
33
func TestBcacheGeneratesMetrics (t * testing.T ) {
34
- err := os .MkdirAll (testBcacheUuidPath , 0755 )
34
+ err := os .MkdirAll (testBcacheUUIDPath , 0755 )
35
35
require .NoError (t , err )
36
36
37
37
err = os .MkdirAll (testBcacheDevPath , 0755 )
@@ -40,49 +40,49 @@ func TestBcacheGeneratesMetrics(t *testing.T) {
40
40
err = os .MkdirAll (testBcacheBackingDevPath + "/bcache" , 0755 )
41
41
require .NoError (t , err )
42
42
43
- err = os .Symlink (testBcacheBackingDevPath + "/bcache" , testBcacheUuidPath + "/bdev0" )
43
+ err = os .Symlink (testBcacheBackingDevPath + "/bcache" , testBcacheUUIDPath + "/bdev0" )
44
44
require .NoError (t , err )
45
45
46
- err = os .Symlink (testBcacheDevPath , testBcacheUuidPath + "/bdev0/dev" )
46
+ err = os .Symlink (testBcacheDevPath , testBcacheUUIDPath + "/bdev0/dev" )
47
47
require .NoError (t , err )
48
48
49
- err = os .MkdirAll (testBcacheUuidPath + "/bdev0/stats_total" , 0755 )
49
+ err = os .MkdirAll (testBcacheUUIDPath + "/bdev0/stats_total" , 0755 )
50
50
require .NoError (t , err )
51
51
52
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/dirty_data" ,
53
- []byte (dirty_data ), 0644 )
52
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/dirty_data" ,
53
+ []byte (dirtyData ), 0644 )
54
54
require .NoError (t , err )
55
55
56
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/bypassed" ,
56
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/bypassed" ,
57
57
[]byte (bypassed ), 0644 )
58
58
require .NoError (t , err )
59
59
60
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_bypass_hits" ,
61
- []byte (cache_bypass_hits ), 0644 )
60
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_bypass_hits" ,
61
+ []byte (cacheBypassHits ), 0644 )
62
62
require .NoError (t , err )
63
63
64
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_bypass_misses" ,
65
- []byte (cache_bypass_misses ), 0644 )
64
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_bypass_misses" ,
65
+ []byte (cacheBypassMisses ), 0644 )
66
66
require .NoError (t , err )
67
67
68
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_hit_ratio" ,
69
- []byte (cache_hit_ratio ), 0644 )
68
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_hit_ratio" ,
69
+ []byte (cacheHitRatio ), 0644 )
70
70
require .NoError (t , err )
71
71
72
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_hits" ,
73
- []byte (cache_hits ), 0644 )
72
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_hits" ,
73
+ []byte (cacheHits ), 0644 )
74
74
require .NoError (t , err )
75
75
76
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_miss_collisions" ,
77
- []byte (cache_miss_collisions ), 0644 )
76
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_miss_collisions" ,
77
+ []byte (cacheMissCollisions ), 0644 )
78
78
require .NoError (t , err )
79
79
80
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_misses" ,
81
- []byte (cache_misses ), 0644 )
80
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_misses" ,
81
+ []byte (cacheMisses ), 0644 )
82
82
require .NoError (t , err )
83
83
84
- err = ioutil .WriteFile (testBcacheUuidPath + "/bdev0/stats_total/cache_readaheads" ,
85
- []byte (cache_readaheads ), 0644 )
84
+ err = ioutil .WriteFile (testBcacheUUIDPath + "/bdev0/stats_total/cache_readaheads" ,
85
+ []byte (cacheReadaheads ), 0644 )
86
86
require .NoError (t , err )
87
87
88
88
fields := map [string ]interface {}{
0 commit comments