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

mendersoftware / mender-server / 1494786857

14 Oct 2024 10:01AM UTC coverage: 72.891% (-1.2%) from 74.094%
1494786857

Pull #100

gitlab-ci

tranchitella
chore: centralize the mock generator across the different services

Changelog: None
Ticket: None

Signed-off-by: Fabio Tranchitella <fabio@tranchitella.eu>
Pull Request #100: chore: centralize the mock generator across the different services

4399 of 6347 branches covered (69.31%)

Branch coverage included in aggregate %.

722 of 2034 new or added lines in 44 files covered. (35.5%)

197 existing lines in 36 files now uncovered.

42530 of 58035 relevant lines covered (73.28%)

28.15 hits per line

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

49.15
/backend/services/reporting/store/mocks/Store.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
// Code generated by mockery v2.45.1. DO NOT EDIT.
16

17
package mocks
18

19
import (
20
        context "context"
21

22
        model "github.com/mendersoftware/mender-server/services/reporting/model"
23
        mock "github.com/stretchr/testify/mock"
24
)
25

26
// Store is an autogenerated mock type for the Store type
27
type Store struct {
28
        mock.Mock
29
}
30

31
// AggregateDeployments provides a mock function with given fields: ctx, query
32
func (_m *Store) AggregateDeployments(ctx context.Context, query model.Query) (model.M, error) {
1✔
33
        ret := _m.Called(ctx, query)
1✔
34

1✔
35
        if len(ret) == 0 {
1✔
NEW
36
                panic("no return value specified for AggregateDeployments")
×
37
        }
38

39
        var r0 model.M
1✔
40
        var r1 error
1✔
41
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) (model.M, error)); ok {
1✔
NEW
42
                return rf(ctx, query)
×
NEW
43
        }
×
44
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) model.M); ok {
1✔
45
                r0 = rf(ctx, query)
×
46
        } else {
1✔
47
                if ret.Get(0) != nil {
2✔
48
                        r0 = ret.Get(0).(model.M)
1✔
49
                }
1✔
50
        }
51

52
        if rf, ok := ret.Get(1).(func(context.Context, model.Query) error); ok {
1✔
UNCOV
53
                r1 = rf(ctx, query)
×
54
        } else {
1✔
55
                r1 = ret.Error(1)
1✔
56
        }
1✔
57

58
        return r0, r1
1✔
59
}
60

61
// AggregateDevices provides a mock function with given fields: ctx, query
62
func (_m *Store) AggregateDevices(ctx context.Context, query model.Query) (model.M, error) {
1✔
63
        ret := _m.Called(ctx, query)
1✔
64

1✔
65
        if len(ret) == 0 {
1✔
NEW
66
                panic("no return value specified for AggregateDevices")
×
67
        }
68

69
        var r0 model.M
1✔
70
        var r1 error
1✔
71
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) (model.M, error)); ok {
1✔
NEW
72
                return rf(ctx, query)
×
NEW
73
        }
×
74
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) model.M); ok {
1✔
75
                r0 = rf(ctx, query)
×
76
        } else {
1✔
77
                if ret.Get(0) != nil {
2✔
78
                        r0 = ret.Get(0).(model.M)
1✔
79
                }
1✔
80
        }
81

82
        if rf, ok := ret.Get(1).(func(context.Context, model.Query) error); ok {
1✔
UNCOV
83
                r1 = rf(ctx, query)
×
84
        } else {
1✔
85
                r1 = ret.Error(1)
1✔
86
        }
1✔
87

88
        return r0, r1
1✔
89
}
90

91
// BulkIndexDeployments provides a mock function with given fields: ctx, deployments
92
func (_m *Store) BulkIndexDeployments(ctx context.Context, deployments []*model.Deployment) error {
1✔
93
        ret := _m.Called(ctx, deployments)
1✔
94

1✔
95
        if len(ret) == 0 {
1✔
NEW
96
                panic("no return value specified for BulkIndexDeployments")
×
97
        }
98

99
        var r0 error
1✔
100
        if rf, ok := ret.Get(0).(func(context.Context, []*model.Deployment) error); ok {
1✔
101
                r0 = rf(ctx, deployments)
×
102
        } else {
1✔
103
                r0 = ret.Error(0)
1✔
104
        }
1✔
105

106
        return r0
1✔
107
}
108

109
// BulkIndexDevices provides a mock function with given fields: ctx, devices, removedDevices
110
func (_m *Store) BulkIndexDevices(ctx context.Context, devices []*model.Device, removedDevices []*model.Device) error {
1✔
111
        ret := _m.Called(ctx, devices, removedDevices)
1✔
112

1✔
113
        if len(ret) == 0 {
1✔
NEW
114
                panic("no return value specified for BulkIndexDevices")
×
115
        }
116

117
        var r0 error
1✔
118
        if rf, ok := ret.Get(0).(func(context.Context, []*model.Device, []*model.Device) error); ok {
1✔
119
                r0 = rf(ctx, devices, removedDevices)
×
120
        } else {
1✔
121
                r0 = ret.Error(0)
1✔
122
        }
1✔
123

124
        return r0
1✔
125
}
126

127
// GetDeploymentsIndex provides a mock function with given fields: tid
128
func (_m *Store) GetDeploymentsIndex(tid string) string {
×
129
        ret := _m.Called(tid)
×
130

×
NEW
131
        if len(ret) == 0 {
×
NEW
132
                panic("no return value specified for GetDeploymentsIndex")
×
133
        }
134

135
        var r0 string
×
136
        if rf, ok := ret.Get(0).(func(string) string); ok {
×
137
                r0 = rf(tid)
×
138
        } else {
×
139
                r0 = ret.Get(0).(string)
×
140
        }
×
141

142
        return r0
×
143
}
144

145
// GetDeploymentsIndexMapping provides a mock function with given fields: ctx, tid
146
func (_m *Store) GetDeploymentsIndexMapping(ctx context.Context, tid string) (map[string]interface{}, error) {
×
147
        ret := _m.Called(ctx, tid)
×
148

×
NEW
149
        if len(ret) == 0 {
×
NEW
150
                panic("no return value specified for GetDeploymentsIndexMapping")
×
151
        }
152

153
        var r0 map[string]interface{}
×
NEW
154
        var r1 error
×
NEW
155
        if rf, ok := ret.Get(0).(func(context.Context, string) (map[string]interface{}, error)); ok {
×
NEW
156
                return rf(ctx, tid)
×
NEW
157
        }
×
158
        if rf, ok := ret.Get(0).(func(context.Context, string) map[string]interface{}); ok {
×
159
                r0 = rf(ctx, tid)
×
160
        } else {
×
161
                if ret.Get(0) != nil {
×
162
                        r0 = ret.Get(0).(map[string]interface{})
×
163
                }
×
164
        }
165

166
        if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
×
167
                r1 = rf(ctx, tid)
×
168
        } else {
×
169
                r1 = ret.Error(1)
×
170
        }
×
171

172
        return r0, r1
×
173
}
174

175
// GetDeploymentsRoutingKey provides a mock function with given fields: tid
176
func (_m *Store) GetDeploymentsRoutingKey(tid string) string {
×
177
        ret := _m.Called(tid)
×
178

×
NEW
179
        if len(ret) == 0 {
×
NEW
180
                panic("no return value specified for GetDeploymentsRoutingKey")
×
181
        }
182

183
        var r0 string
×
184
        if rf, ok := ret.Get(0).(func(string) string); ok {
×
185
                r0 = rf(tid)
×
186
        } else {
×
187
                r0 = ret.Get(0).(string)
×
188
        }
×
189

190
        return r0
×
191
}
192

193
// GetDevicesIndex provides a mock function with given fields: tid
194
func (_m *Store) GetDevicesIndex(tid string) string {
×
195
        ret := _m.Called(tid)
×
196

×
NEW
197
        if len(ret) == 0 {
×
NEW
198
                panic("no return value specified for GetDevicesIndex")
×
199
        }
200

201
        var r0 string
×
202
        if rf, ok := ret.Get(0).(func(string) string); ok {
×
203
                r0 = rf(tid)
×
204
        } else {
×
205
                r0 = ret.Get(0).(string)
×
206
        }
×
207

208
        return r0
×
209
}
210

211
// GetDevicesIndexMapping provides a mock function with given fields: ctx, tid
212
func (_m *Store) GetDevicesIndexMapping(ctx context.Context, tid string) (map[string]interface{}, error) {
1✔
213
        ret := _m.Called(ctx, tid)
1✔
214

1✔
215
        if len(ret) == 0 {
1✔
NEW
216
                panic("no return value specified for GetDevicesIndexMapping")
×
217
        }
218

219
        var r0 map[string]interface{}
1✔
220
        var r1 error
1✔
221
        if rf, ok := ret.Get(0).(func(context.Context, string) (map[string]interface{}, error)); ok {
1✔
NEW
222
                return rf(ctx, tid)
×
NEW
223
        }
×
224
        if rf, ok := ret.Get(0).(func(context.Context, string) map[string]interface{}); ok {
1✔
225
                r0 = rf(ctx, tid)
×
226
        } else {
1✔
227
                if ret.Get(0) != nil {
2✔
228
                        r0 = ret.Get(0).(map[string]interface{})
1✔
229
                }
1✔
230
        }
231

232
        if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
1✔
UNCOV
233
                r1 = rf(ctx, tid)
×
234
        } else {
1✔
235
                r1 = ret.Error(1)
1✔
236
        }
1✔
237

238
        return r0, r1
1✔
239
}
240

241
// GetDevicesRoutingKey provides a mock function with given fields: tid
242
func (_m *Store) GetDevicesRoutingKey(tid string) string {
×
243
        ret := _m.Called(tid)
×
244

×
NEW
245
        if len(ret) == 0 {
×
NEW
246
                panic("no return value specified for GetDevicesRoutingKey")
×
247
        }
248

249
        var r0 string
×
250
        if rf, ok := ret.Get(0).(func(string) string); ok {
×
251
                r0 = rf(tid)
×
252
        } else {
×
253
                r0 = ret.Get(0).(string)
×
254
        }
×
255

256
        return r0
×
257
}
258

259
// Migrate provides a mock function with given fields: ctx
260
func (_m *Store) Migrate(ctx context.Context) error {
×
261
        ret := _m.Called(ctx)
×
262

×
NEW
263
        if len(ret) == 0 {
×
NEW
264
                panic("no return value specified for Migrate")
×
265
        }
266

267
        var r0 error
×
268
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
×
269
                r0 = rf(ctx)
×
270
        } else {
×
271
                r0 = ret.Error(0)
×
272
        }
×
273

274
        return r0
×
275
}
276

277
// Ping provides a mock function with given fields: ctx
278
func (_m *Store) Ping(ctx context.Context) error {
1✔
279
        ret := _m.Called(ctx)
1✔
280

1✔
281
        if len(ret) == 0 {
1✔
NEW
282
                panic("no return value specified for Ping")
×
283
        }
284

285
        var r0 error
1✔
286
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
1✔
287
                r0 = rf(ctx)
×
288
        } else {
1✔
289
                r0 = ret.Error(0)
1✔
290
        }
1✔
291

292
        return r0
1✔
293
}
294

295
// SearchDeployments provides a mock function with given fields: ctx, query
296
func (_m *Store) SearchDeployments(ctx context.Context, query model.Query) (model.M, error) {
1✔
297
        ret := _m.Called(ctx, query)
1✔
298

1✔
299
        if len(ret) == 0 {
1✔
NEW
300
                panic("no return value specified for SearchDeployments")
×
301
        }
302

303
        var r0 model.M
1✔
304
        var r1 error
1✔
305
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) (model.M, error)); ok {
1✔
NEW
306
                return rf(ctx, query)
×
NEW
307
        }
×
308
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) model.M); ok {
1✔
309
                r0 = rf(ctx, query)
×
310
        } else {
1✔
311
                if ret.Get(0) != nil {
2✔
312
                        r0 = ret.Get(0).(model.M)
1✔
313
                }
1✔
314
        }
315

316
        if rf, ok := ret.Get(1).(func(context.Context, model.Query) error); ok {
1✔
UNCOV
317
                r1 = rf(ctx, query)
×
318
        } else {
1✔
319
                r1 = ret.Error(1)
1✔
320
        }
1✔
321

322
        return r0, r1
1✔
323
}
324

325
// SearchDevices provides a mock function with given fields: ctx, query
326
func (_m *Store) SearchDevices(ctx context.Context, query model.Query) (model.M, error) {
1✔
327
        ret := _m.Called(ctx, query)
1✔
328

1✔
329
        if len(ret) == 0 {
1✔
NEW
330
                panic("no return value specified for SearchDevices")
×
331
        }
332

333
        var r0 model.M
1✔
334
        var r1 error
1✔
335
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) (model.M, error)); ok {
1✔
NEW
336
                return rf(ctx, query)
×
NEW
337
        }
×
338
        if rf, ok := ret.Get(0).(func(context.Context, model.Query) model.M); ok {
1✔
339
                r0 = rf(ctx, query)
×
340
        } else {
1✔
341
                if ret.Get(0) != nil {
2✔
342
                        r0 = ret.Get(0).(model.M)
1✔
343
                }
1✔
344
        }
345

346
        if rf, ok := ret.Get(1).(func(context.Context, model.Query) error); ok {
1✔
UNCOV
347
                r1 = rf(ctx, query)
×
348
        } else {
1✔
349
                r1 = ret.Error(1)
1✔
350
        }
1✔
351

352
        return r0, r1
1✔
353
}
354

355
// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
356
// The first argument is typically a *testing.T value.
357
func NewStore(t interface {
358
        mock.TestingT
359
        Cleanup(func())
NEW
360
}) *Store {
×
NEW
361
        mock := &Store{}
×
NEW
362
        mock.Mock.Test(t)
×
NEW
363

×
NEW
364
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
365

NEW
366
        return mock
×
367
}
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

© 2025 Coveralls, Inc