/
metrics_service.go
60 lines (47 loc) · 2.15 KB
/
metrics_service.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package mock
import (
"github.com/LNOpenMetrics/lnmetrics.server/graph/model"
"github.com/stretchr/testify/mock"
)
type MockMetricsServices struct {
mock.Mock
}
func (instance *MockMetricsServices) InitMetricOne(nodeID string, payload *string, signature string) (*model.MetricOne, error) {
args := instance.Called(nodeID, *payload, signature)
return args.Get(0).(*model.MetricOne), nil
}
func (instance *MockMetricsServices) UpdateMetricOne(nodeID string, payload *string, signature string) error {
_ = instance.Called(nodeID, payload, signature)
return nil
}
// Return all the node information that are pushing the data.
func (instance *MockMetricsServices) GetNodes(network string) ([]*model.NodeMetadata, error) {
args := instance.Called(network)
return args.Get(0).([]*model.NodeMetadata), nil
}
func (instance *MockMetricsServices) GetNode(network string, nodeID string) (*model.NodeMetadata, error) {
args := instance.Called(network)
return args.Get(0).(*model.NodeMetadata), nil
}
// Get the metric one of one node and add a filtering option by period
func (instance *MockMetricsServices) GetMetricOne(network string, nodeID string, startPeriod int, endPeriod int) (*model.MetricOne, error) {
args := instance.Called(network, nodeID, startPeriod, endPeriod)
return args.Get(0).(*model.MetricOne), nil
}
// Get the metric one of one node and add a filtering option by period
func (instance *MockMetricsServices) GetFullMetricOne(network string, nodeID string) (*model.MetricOne, error) {
args := instance.Called(network, nodeID)
return args.Get(0).(*model.MetricOne), nil
}
func (instance *MockMetricsServices) GetMetricOneOutput(network string, nodeID string) (*model.MetricOneOutput, error) {
args := instance.Called(network, nodeID)
return args.Get(0).(*model.MetricOneOutput), nil
}
// FIXME: implementing integration test
func (instance *MockMetricsServices) AddNodeMetrics(nodeID string, payload *string) (*model.MetricOne, error) {
return nil, nil
}
// FIXME: implementing integration test
func (instance *MockMetricsServices) GetMetricOnePaginator(network string, nodeID string, first int, last *int) (*model.MetricOneInfo, error) {
return nil, nil
}