/
webhookmanager_mock.go
72 lines (65 loc) · 1.96 KB
/
webhookmanager_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
60
61
62
63
64
65
66
67
68
69
70
71
72
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package fake
import (
"sync"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
// MockWebhookManager is a mock implementation of manager.Provider.
//
// func TestSomethingThatUsesProvider(t *testing.T) {
//
// // make and configure a mocked manager.Provider
// mockedProvider := &MockWebhookManager{
// SetupWebhookServerFunc: func(mgr manager.Manager) {
// panic("mock out the SetupWebhookServer method")
// },
// }
//
// // use mockedProvider in code that requires manager.Provider
// // and then make assertions.
//
// }
type MockWebhookManager struct {
// SetupWebhookServerFunc mocks the SetupWebhookServer method.
SetupWebhookServerFunc func(mgr manager.Manager)
// calls tracks calls to the methods.
calls struct {
// SetupWebhookServer holds details about calls to the SetupWebhookServer method.
SetupWebhookServer []struct {
// Mgr is the mgr argument value.
Mgr manager.Manager
}
}
lockSetupWebhookServer sync.RWMutex
}
// SetupWebhookServer calls SetupWebhookServerFunc.
func (mock *MockWebhookManager) SetupWebhookServer(mgr manager.Manager) {
if mock.SetupWebhookServerFunc == nil {
panic("MockWebhookManager.SetupWebhookServerFunc: method is nil but Provider.SetupWebhookServer was just called")
}
callInfo := struct {
Mgr manager.Manager
}{
Mgr: mgr,
}
mock.lockSetupWebhookServer.Lock()
mock.calls.SetupWebhookServer = append(mock.calls.SetupWebhookServer, callInfo)
mock.lockSetupWebhookServer.Unlock()
mock.SetupWebhookServerFunc(mgr)
}
// SetupWebhookServerCalls gets all the calls that were made to SetupWebhookServer.
// Check the length with:
//
// len(mockedProvider.SetupWebhookServerCalls())
func (mock *MockWebhookManager) SetupWebhookServerCalls() []struct {
Mgr manager.Manager
} {
var calls []struct {
Mgr manager.Manager
}
mock.lockSetupWebhookServer.RLock()
calls = mock.calls.SetupWebhookServer
mock.lockSetupWebhookServer.RUnlock()
return calls
}