-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_test.go
More file actions
executable file
·46 lines (38 loc) · 796 Bytes
/
main_test.go
File metadata and controls
executable file
·46 lines (38 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"context"
"testing"
"github.com/parMaster/rpid/config"
"github.com/stretchr/testify/assert"
)
func Test_SystemReporter(t *testing.T) {
r, err := LoadSystemReporter(config.System{Enabled: true}, nil, true)
assert.NoError(t, err)
ctx := context.Background()
err = r.Collect(ctx)
assert.NoError(t, err)
res, err := r.Report()
assert.NoError(t, err)
expected := Response{
TimeInState: map[string]int{
"1000": 2349,
"1100": 1911,
"1200": 1970,
"1300": 1799,
"1400": 1547,
"1500": 1143,
"1600": 795,
"1700": 746,
"1800": 2726,
"600": 200116,
"700": 35684,
"800": 6126,
"900": 4051,
},
LoadAvg: map[string][]ShortFloat{
"1m": {0.12},
"5m": {0.24},
"15m": {0.3},
}}
assert.Equal(t, expected, res)
}