-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathattribs_test.go
39 lines (32 loc) · 863 Bytes
/
attribs_test.go
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
// Copyright 2020-present Kuei-chun Chen. All rights reserved.
// attribs_test.go
package ftdc
import (
"os"
"testing"
"github.com/simagix/mongo-ftdc/decoder"
)
func TestGetServerStatusDataPoints(t *testing.T) {
var err error
var buffer []byte
if buffer, err = os.ReadFile(DiagnosticDataFilename); err != nil {
t.Fatal(err)
}
metrics := decoder.NewMetrics()
metrics.ReadAllMetrics(&buffer)
attrib := NewAttribs(&metrics.Data[0].DataPointsMap)
v := attrib.GetServerStatusDataPoints(0)
t.Log(v)
}
func TestGetSystemMetricsDataPoints(t *testing.T) {
var err error
var buffer []byte
if buffer, err = os.ReadFile(DiagnosticDataFilename); err != nil {
t.Fatal(err)
}
metrics := decoder.NewMetrics()
metrics.ReadAllMetrics(&buffer)
attrib := NewAttribs(&metrics.Data[0].DataPointsMap)
v := attrib.GetSystemMetricsDataPoints(0)
t.Log(v)
}