@@ -30,7 +30,7 @@ func TestScanInterfaceStats(t *testing.T) {
30
30
t .Error (err )
31
31
}
32
32
33
- var netdevstats = []info.InterfaceStats {
33
+ netdevstats : = []info.InterfaceStats {
34
34
{
35
35
Name : "wlp4s0" ,
36
36
RxBytes : 1 ,
@@ -78,7 +78,7 @@ func TestScanUDPStats(t *testing.T) {
78
78
t .Error (err )
79
79
}
80
80
81
- var udpstats = info.UdpStat {
81
+ udpstats : = info.UdpStat {
82
82
Listen : 2 ,
83
83
Dropped : 4 ,
84
84
RxQueued : 10 ,
@@ -168,11 +168,10 @@ func TestSetProcessesStats(t *testing.T) {
168
168
if expected .Processes .ThreadsMax != ret .Processes .ThreadsMax {
169
169
t .Fatalf ("expected max threads: %d == %d" , ret .Processes .ThreadsMax , expected .Processes .ThreadsMax )
170
170
}
171
-
172
171
}
173
172
174
173
func TestParseLimitsFile (t * testing.T ) {
175
- var testData = []struct {
174
+ testData : = []struct {
176
175
limitLine string
177
176
expected []info.UlimitSpec
178
177
}{
@@ -211,7 +210,7 @@ func TestParseLimitsFile(t *testing.T) {
211
210
}
212
211
213
212
func TestReferencedBytesStat (t * testing.T ) {
214
- //overwrite package variables
213
+ // overwrite package variables
215
214
smapsFilePathPattern = "testdata/smaps%d"
216
215
clearRefsFilePathPattern = "testdata/clear_refs%d"
217
216
@@ -223,16 +222,17 @@ func TestReferencedBytesStat(t *testing.T) {
223
222
clearRefsFiles := []string {
224
223
"testdata/clear_refs4" ,
225
224
"testdata/clear_refs6" ,
226
- "testdata/clear_refs8" }
225
+ "testdata/clear_refs8" ,
226
+ }
227
227
228
- //check if clear_refs files have proper values
228
+ // check if clear_refs files have proper values
229
229
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [0 ]))
230
230
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [1 ]))
231
231
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [2 ]))
232
232
}
233
233
234
234
func TestReferencedBytesStatWhenNeverCleared (t * testing.T ) {
235
- //overwrite package variables
235
+ // overwrite package variables
236
236
smapsFilePathPattern = "testdata/smaps%d"
237
237
clearRefsFilePathPattern = "testdata/clear_refs%d"
238
238
@@ -244,16 +244,17 @@ func TestReferencedBytesStatWhenNeverCleared(t *testing.T) {
244
244
clearRefsFiles := []string {
245
245
"testdata/clear_refs4" ,
246
246
"testdata/clear_refs6" ,
247
- "testdata/clear_refs8" }
247
+ "testdata/clear_refs8" ,
248
+ }
248
249
249
- //check if clear_refs files have proper values
250
+ // check if clear_refs files have proper values
250
251
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [0 ]))
251
252
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [1 ]))
252
253
assert .Equal (t , "0\n " , getFileContent (t , clearRefsFiles [2 ]))
253
254
}
254
255
255
256
func TestReferencedBytesStatWhenResetIsNeeded (t * testing.T ) {
256
- //overwrite package variables
257
+ // overwrite package variables
257
258
smapsFilePathPattern = "testdata/smaps%d"
258
259
clearRefsFilePathPattern = "testdata/clear_refs%d"
259
260
@@ -265,9 +266,10 @@ func TestReferencedBytesStatWhenResetIsNeeded(t *testing.T) {
265
266
clearRefsFiles := []string {
266
267
"testdata/clear_refs4" ,
267
268
"testdata/clear_refs6" ,
268
- "testdata/clear_refs8" }
269
+ "testdata/clear_refs8" ,
270
+ }
269
271
270
- //check if clear_refs files have proper values
272
+ // check if clear_refs files have proper values
271
273
assert .Equal (t , "1\n " , getFileContent (t , clearRefsFiles [0 ]))
272
274
assert .Equal (t , "1\n " , getFileContent (t , clearRefsFiles [1 ]))
273
275
assert .Equal (t , "1\n " , getFileContent (t , clearRefsFiles [2 ]))
@@ -276,7 +278,7 @@ func TestReferencedBytesStatWhenResetIsNeeded(t *testing.T) {
276
278
}
277
279
278
280
func TestGetReferencedKBytesWhenSmapsMissing (t * testing.T ) {
279
- //overwrite package variable
281
+ // overwrite package variable
280
282
smapsFilePathPattern = "testdata/smaps%d"
281
283
282
284
pids := []int {10 }
@@ -286,7 +288,7 @@ func TestGetReferencedKBytesWhenSmapsMissing(t *testing.T) {
286
288
}
287
289
288
290
func TestClearReferencedBytesWhenClearRefsMissing (t * testing.T ) {
289
- //overwrite package variable
291
+ // overwrite package variable
290
292
clearRefsFilePathPattern = "testdata/clear_refs%d"
291
293
292
294
pids := []int {10 }
0 commit comments