-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmocks.go
80 lines (63 loc) · 1.79 KB
/
mocks.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package pool
import (
"github.com/stretchr/testify/mock"
"github.com/qa-dev/jsonwire-grid/pool/capabilities"
)
type StorageMock struct {
mock.Mock
}
func (s *StorageMock) Add(node Node, limit int) error {
args := s.Called(node, limit)
return args.Error(0)
}
func (s *StorageMock) ReserveAvailable(nodeList []Node) (Node, error) {
args := s.Called(nodeList)
return args.Get(0).(Node), args.Error(1)
}
func (s *StorageMock) SetBusy(node Node, sessionID string) error {
args := s.Called(node, sessionID)
return args.Error(0)
}
func (s *StorageMock) SetAvailable(node Node) error {
args := s.Called(node)
return args.Error(0)
}
func (s *StorageMock) GetCountWithStatus(nodeStatus *NodeStatus) (int, error) {
args := s.Called(nodeStatus)
return args.Int(0), args.Error(1)
}
func (s *StorageMock) GetBySession(sessionID string) (Node, error) {
args := s.Called(sessionID)
return args.Get(0).(Node), args.Error(1)
}
func (s *StorageMock) GetByAddress(address string) (Node, error) {
args := s.Called(address)
return args.Get(0).(Node), args.Error(1)
}
func (s *StorageMock) GetAll() ([]Node, error) {
args := s.Called()
return args.Get(0).([]Node), args.Error(1)
}
func (s *StorageMock) Remove(node Node) error {
args := s.Called(node)
return args.Error(0)
}
type StrategyListMock struct {
mock.Mock
}
func (s *StrategyListMock) Reserve(caps capabilities.Capabilities) (Node, error) {
args := s.Called(caps)
return args.Get(0).(Node), args.Error(1)
}
func (s *StrategyListMock) CleanUp(node Node) error {
args := s.Called(node)
return args.Error(0)
}
func (s *StrategyListMock) FixNodeStatus(node Node) error {
args := s.Called(node)
return args.Error(0)
}
func (s *StorageMock) UpdateAddress(node Node, newAddress string) error {
args := s.Called(node, newAddress)
return args.Error(0)
}