• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillya / wg-relay / 20543022641

27 Dec 2025 06:53PM UTC coverage: 26.309% (-2.1%) from 28.375%
20543022641

Pull #8

github

stillya
polish commit
Pull Request #8: feat(agent): made seperation on control plane and cli

271 of 938 new or added lines in 7 files covered. (28.89%)

412 of 1566 relevant lines covered (26.31%)

0.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.28
/pkg/api/controlhandler_mock.go
1
// Code generated by moq; DO NOT EDIT.
2
// github.com/matryer/moq
3

4
package api
5

6
import (
7
        "context"
8
        "sync"
9
)
10

11
// Ensure, that ControlHandlerMock does implement ControlHandler.
12
// If this is not the case, regenerate this file with moq.
13
var _ ControlHandler = &ControlHandlerMock{}
14

15
// ControlHandlerMock is a mock implementation of ControlHandler.
16
//
17
//        func TestSomethingThatUsesControlHandler(t *testing.T) {
18
//
19
//                // make and configure a mocked ControlHandler
20
//                mockedControlHandler := &ControlHandlerMock{
21
//                        GetStatsFunc: func(ctx context.Context) (*StatsResponse, error) {
22
//                                panic("mock out the GetStats method")
23
//                        },
24
//                        GetStatusFunc: func(ctx context.Context) (*StatusResponse, error) {
25
//                                panic("mock out the GetStatus method")
26
//                        },
27
//                        HandleDisableFunc: func(ctx context.Context) error {
28
//                                panic("mock out the HandleDisable method")
29
//                        },
30
//                        HandleEnableFunc: func(ctx context.Context, args EnableArgs) error {
31
//                                panic("mock out the HandleEnable method")
32
//                        },
33
//                        HandleReloadFunc: func(ctx context.Context, args ReloadArgs) error {
34
//                                panic("mock out the HandleReload method")
35
//                        },
36
//                }
37
//
38
//                // use mockedControlHandler in code that requires ControlHandler
39
//                // and then make assertions.
40
//
41
//        }
42
type ControlHandlerMock struct {
43
        // GetStatsFunc mocks the GetStats method.
44
        GetStatsFunc func(ctx context.Context) (*StatsResponse, error)
45

46
        // GetStatusFunc mocks the GetStatus method.
47
        GetStatusFunc func(ctx context.Context) (*StatusResponse, error)
48

49
        // HandleDisableFunc mocks the HandleDisable method.
50
        HandleDisableFunc func(ctx context.Context) error
51

52
        // HandleEnableFunc mocks the HandleEnable method.
53
        HandleEnableFunc func(ctx context.Context, args EnableArgs) error
54

55
        // HandleReloadFunc mocks the HandleReload method.
56
        HandleReloadFunc func(ctx context.Context, args ReloadArgs) error
57

58
        // calls tracks calls to the methods.
59
        calls struct {
60
                // GetStats holds details about calls to the GetStats method.
61
                GetStats []struct {
62
                        // Ctx is the ctx argument value.
63
                        Ctx context.Context
64
                }
65
                // GetStatus holds details about calls to the GetStatus method.
66
                GetStatus []struct {
67
                        // Ctx is the ctx argument value.
68
                        Ctx context.Context
69
                }
70
                // HandleDisable holds details about calls to the HandleDisable method.
71
                HandleDisable []struct {
72
                        // Ctx is the ctx argument value.
73
                        Ctx context.Context
74
                }
75
                // HandleEnable holds details about calls to the HandleEnable method.
76
                HandleEnable []struct {
77
                        // Ctx is the ctx argument value.
78
                        Ctx context.Context
79
                        // Args is the args argument value.
80
                        Args EnableArgs
81
                }
82
                // HandleReload holds details about calls to the HandleReload method.
83
                HandleReload []struct {
84
                        // Ctx is the ctx argument value.
85
                        Ctx context.Context
86
                        // Args is the args argument value.
87
                        Args ReloadArgs
88
                }
89
        }
90
        lockGetStats      sync.RWMutex
91
        lockGetStatus     sync.RWMutex
92
        lockHandleDisable sync.RWMutex
93
        lockHandleEnable  sync.RWMutex
94
        lockHandleReload  sync.RWMutex
95
}
96

97
// GetStats calls GetStatsFunc.
98
func (mock *ControlHandlerMock) GetStats(ctx context.Context) (*StatsResponse, error) {
1✔
99
        if mock.GetStatsFunc == nil {
1✔
NEW
100
                panic("ControlHandlerMock.GetStatsFunc: method is nil but ControlHandler.GetStats was just called")
×
101
        }
102
        callInfo := struct {
1✔
103
                Ctx context.Context
1✔
104
        }{
1✔
105
                Ctx: ctx,
1✔
106
        }
1✔
107
        mock.lockGetStats.Lock()
1✔
108
        mock.calls.GetStats = append(mock.calls.GetStats, callInfo)
1✔
109
        mock.lockGetStats.Unlock()
1✔
110
        return mock.GetStatsFunc(ctx)
1✔
111
}
112

113
// GetStatsCalls gets all the calls that were made to GetStats.
114
// Check the length with:
115
//
116
//        len(mockedControlHandler.GetStatsCalls())
117
func (mock *ControlHandlerMock) GetStatsCalls() []struct {
118
        Ctx context.Context
NEW
119
} {
×
NEW
120
        var calls []struct {
×
NEW
121
                Ctx context.Context
×
NEW
122
        }
×
NEW
123
        mock.lockGetStats.RLock()
×
NEW
124
        calls = mock.calls.GetStats
×
NEW
125
        mock.lockGetStats.RUnlock()
×
NEW
126
        return calls
×
NEW
127
}
×
128

129
// GetStatus calls GetStatusFunc.
130
func (mock *ControlHandlerMock) GetStatus(ctx context.Context) (*StatusResponse, error) {
1✔
131
        if mock.GetStatusFunc == nil {
1✔
NEW
132
                panic("ControlHandlerMock.GetStatusFunc: method is nil but ControlHandler.GetStatus was just called")
×
133
        }
134
        callInfo := struct {
1✔
135
                Ctx context.Context
1✔
136
        }{
1✔
137
                Ctx: ctx,
1✔
138
        }
1✔
139
        mock.lockGetStatus.Lock()
1✔
140
        mock.calls.GetStatus = append(mock.calls.GetStatus, callInfo)
1✔
141
        mock.lockGetStatus.Unlock()
1✔
142
        return mock.GetStatusFunc(ctx)
1✔
143
}
144

145
// GetStatusCalls gets all the calls that were made to GetStatus.
146
// Check the length with:
147
//
148
//        len(mockedControlHandler.GetStatusCalls())
149
func (mock *ControlHandlerMock) GetStatusCalls() []struct {
150
        Ctx context.Context
NEW
151
} {
×
NEW
152
        var calls []struct {
×
NEW
153
                Ctx context.Context
×
NEW
154
        }
×
NEW
155
        mock.lockGetStatus.RLock()
×
NEW
156
        calls = mock.calls.GetStatus
×
NEW
157
        mock.lockGetStatus.RUnlock()
×
NEW
158
        return calls
×
NEW
159
}
×
160

161
// HandleDisable calls HandleDisableFunc.
162
func (mock *ControlHandlerMock) HandleDisable(ctx context.Context) error {
1✔
163
        if mock.HandleDisableFunc == nil {
1✔
NEW
164
                panic("ControlHandlerMock.HandleDisableFunc: method is nil but ControlHandler.HandleDisable was just called")
×
165
        }
166
        callInfo := struct {
1✔
167
                Ctx context.Context
1✔
168
        }{
1✔
169
                Ctx: ctx,
1✔
170
        }
1✔
171
        mock.lockHandleDisable.Lock()
1✔
172
        mock.calls.HandleDisable = append(mock.calls.HandleDisable, callInfo)
1✔
173
        mock.lockHandleDisable.Unlock()
1✔
174
        return mock.HandleDisableFunc(ctx)
1✔
175
}
176

177
// HandleDisableCalls gets all the calls that were made to HandleDisable.
178
// Check the length with:
179
//
180
//        len(mockedControlHandler.HandleDisableCalls())
181
func (mock *ControlHandlerMock) HandleDisableCalls() []struct {
182
        Ctx context.Context
183
} {
1✔
184
        var calls []struct {
1✔
185
                Ctx context.Context
1✔
186
        }
1✔
187
        mock.lockHandleDisable.RLock()
1✔
188
        calls = mock.calls.HandleDisable
1✔
189
        mock.lockHandleDisable.RUnlock()
1✔
190
        return calls
1✔
191
}
1✔
192

193
// HandleEnable calls HandleEnableFunc.
194
func (mock *ControlHandlerMock) HandleEnable(ctx context.Context, args EnableArgs) error {
1✔
195
        if mock.HandleEnableFunc == nil {
1✔
NEW
196
                panic("ControlHandlerMock.HandleEnableFunc: method is nil but ControlHandler.HandleEnable was just called")
×
197
        }
198
        callInfo := struct {
1✔
199
                Ctx  context.Context
1✔
200
                Args EnableArgs
1✔
201
        }{
1✔
202
                Ctx:  ctx,
1✔
203
                Args: args,
1✔
204
        }
1✔
205
        mock.lockHandleEnable.Lock()
1✔
206
        mock.calls.HandleEnable = append(mock.calls.HandleEnable, callInfo)
1✔
207
        mock.lockHandleEnable.Unlock()
1✔
208
        return mock.HandleEnableFunc(ctx, args)
1✔
209
}
210

211
// HandleEnableCalls gets all the calls that were made to HandleEnable.
212
// Check the length with:
213
//
214
//        len(mockedControlHandler.HandleEnableCalls())
215
func (mock *ControlHandlerMock) HandleEnableCalls() []struct {
216
        Ctx  context.Context
217
        Args EnableArgs
218
} {
1✔
219
        var calls []struct {
1✔
220
                Ctx  context.Context
1✔
221
                Args EnableArgs
1✔
222
        }
1✔
223
        mock.lockHandleEnable.RLock()
1✔
224
        calls = mock.calls.HandleEnable
1✔
225
        mock.lockHandleEnable.RUnlock()
1✔
226
        return calls
1✔
227
}
1✔
228

229
// HandleReload calls HandleReloadFunc.
230
func (mock *ControlHandlerMock) HandleReload(ctx context.Context, args ReloadArgs) error {
1✔
231
        if mock.HandleReloadFunc == nil {
1✔
NEW
232
                panic("ControlHandlerMock.HandleReloadFunc: method is nil but ControlHandler.HandleReload was just called")
×
233
        }
234
        callInfo := struct {
1✔
235
                Ctx  context.Context
1✔
236
                Args ReloadArgs
1✔
237
        }{
1✔
238
                Ctx:  ctx,
1✔
239
                Args: args,
1✔
240
        }
1✔
241
        mock.lockHandleReload.Lock()
1✔
242
        mock.calls.HandleReload = append(mock.calls.HandleReload, callInfo)
1✔
243
        mock.lockHandleReload.Unlock()
1✔
244
        return mock.HandleReloadFunc(ctx, args)
1✔
245
}
246

247
// HandleReloadCalls gets all the calls that were made to HandleReload.
248
// Check the length with:
249
//
250
//        len(mockedControlHandler.HandleReloadCalls())
251
func (mock *ControlHandlerMock) HandleReloadCalls() []struct {
252
        Ctx  context.Context
253
        Args ReloadArgs
254
} {
1✔
255
        var calls []struct {
1✔
256
                Ctx  context.Context
1✔
257
                Args ReloadArgs
1✔
258
        }
1✔
259
        mock.lockHandleReload.RLock()
1✔
260
        calls = mock.calls.HandleReload
1✔
261
        mock.lockHandleReload.RUnlock()
1✔
262
        return calls
1✔
263
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc