-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.go
59 lines (47 loc) · 1.57 KB
/
mock.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
package elasticsearch
import (
"github.com/stretchr/testify/mock"
"github.com/stretchy/stretchy/pkg/configuration"
)
type MockClient struct {
mock.Mock
}
func NewMockClient() *MockClient {
return &MockClient{}
}
func (mc *MockClient) IndexExist(indexName string) (bool, error) {
args := mc.Called(indexName)
return args.Bool(0), args.Error(1)
}
func (mc *MockClient) AliasExist(aliasName string) (bool, error) {
args := mc.Called(aliasName)
return args.Bool(0), args.Error(1)
}
func (mc *MockClient) CreateIndex(indexName string, mapping configuration.Index) error {
args := mc.Called(indexName, mapping)
return args.Error(0)
}
func (mc *MockClient) CreateAlias(aliasName string, indexName string) error {
args := mc.Called(aliasName, indexName)
return args.Error(0)
}
func (mc *MockClient) UpdateAlias(aliasName string, newIndexName string) error {
args := mc.Called(aliasName, newIndexName)
return args.Error(0)
}
func (mc *MockClient) GetAliasedIndex(aliasName string) (string, error) {
args := mc.Called(aliasName)
return args.String(0), args.Error(1)
}
func (mc *MockClient) GetIndexConfiguration(indexName string) (configuration.Index, error) {
args := mc.Called(indexName)
return args.Get(0).(configuration.Index), args.Error(1)
}
func (mc *MockClient) UpdateIndexConfiguration(indexName string, configuration configuration.Index) error {
args := mc.Called(indexName, configuration)
return args.Error(0)
}
func (mc *MockClient) Reindex(sourceIndexName string, targetIndexName string) error {
args := mc.Called(sourceIndexName, targetIndexName)
return args.Error(0)
}