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

elastic / cloudbeat / 17852480664

19 Sep 2025 08:07AM UTC coverage: 49.802% (-26.3%) from 76.148%
17852480664

push

github

web-flow
Switch to mockery v3 (#3600)

### Summary of your changes
- Migrates to new config syntax
- Renames mock files to be easier to track which mock file corresponds to which code file.
- Mocking functions is not supported in v3 anymore. aws_org_preset_test.go has been updated and internal/flavors/repeater_func_mock_old.go was kept with the code produced by old mockery to avoid having to fix repeater_test.go (CNVM only).
- Make sure we do not directly import testify libraries in our built binary with the `release` tag. Trivy and kiota still import it so fixes need to be sent there. Verified cloudbeat does not directly import testify with:
```shell
$ godepgraph -tags=release ./ | grep testify
"github.com/aquasecurity/trivy-db/pkg/db" -> "github.com/stretchr/testify/mock";
"github.com/microsoft/kiota-serialization-text-go" -> "github.com/stretchr/testify/assert";
"github.com/stretchr/testify/assert" [label="github.com/stretchr/testify/assert" color="paleturquoise" URL="https://godoc.org/github.com/stretchr/testify/assert" target="_blank"];
"github.com/stretchr/testify/assert" -> "bufio";
"github.com/stretchr/testify/assert" -> "bytes";
"github.com/stretchr/testify/assert" -> "encoding/json";
"github.com/stretchr/testify/assert" -> "errors";
"github.com/stretchr/testify/assert" -> "fmt";
"github.com/stretchr/testify/assert" -> "github.com/davecgh/go-spew/spew";
"github.com/stretchr/testify/assert" -> "github.com/pmezard/go-difflib/difflib";
"github.com/stretchr/testify/assert" -> "github.com/stretchr/testify/assert/yaml";
"github.com/stretchr/testify/assert" -> "math";
"github.com/stretchr/testify/assert" -> "net/http";
"github.com/stretchr/testify/assert" -> "net/http/httptest";
"github.com/stretchr/testify/assert" -> "net/url";
"github.com/stretchr/testify/assert" -> "os";
"github.com/stretchr/testify/assert" -> "reflect";
"github.com/stretchr/testify/assert" -> "regexp";
"github.com/stretchr/testify/assert" -> "runtime";
"github.com/stretchr/testify/assert... (continued)

3071 of 11934 new or added lines in 88 files covered. (25.73%)

2 existing lines in 1 file now uncovered.

14243 of 28599 relevant lines covered (49.8%)

9.75 hits per line

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

35.08
/internal/inventory/awsfetcher/fetcher_lambda_mock.go
1
// Licensed to Elasticsearch B.V. under one or more contributor
2
// license agreements. See the NOTICE file distributed with
3
// this work for additional information regarding copyright
4
// ownership. Elasticsearch B.V. licenses this file to you under
5
// the Apache License, Version 2.0 (the "License"); you may
6
// not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
//     http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
//go:build !release
18

19
// Code generated by mockery; DO NOT EDIT.
20
// github.com/vektra/mockery
21
// template: testify
22

23
package awsfetcher
24

25
import (
26
        "context"
27

28
        "github.com/elastic/cloudbeat/internal/resources/providers/awslib"
29
        mock "github.com/stretchr/testify/mock"
30
)
31

32
// newMockLambdaProvider creates a new instance of mockLambdaProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
33
// The first argument is typically a *testing.T value.
34
func newMockLambdaProvider(t interface {
35
        mock.TestingT
36
        Cleanup(func())
37
}) *mockLambdaProvider {
1✔
38
        mock := &mockLambdaProvider{}
1✔
39
        mock.Mock.Test(t)
1✔
40

1✔
41
        t.Cleanup(func() { mock.AssertExpectations(t) })
2✔
42

43
        return mock
1✔
44
}
45

46
// mockLambdaProvider is an autogenerated mock type for the lambdaProvider type
47
type mockLambdaProvider struct {
48
        mock.Mock
49
}
50

51
type mockLambdaProvider_Expecter struct {
52
        mock *mock.Mock
53
}
54

55
func (_m *mockLambdaProvider) EXPECT() *mockLambdaProvider_Expecter {
1✔
56
        return &mockLambdaProvider_Expecter{mock: &_m.Mock}
1✔
57
}
1✔
58

59
// ListAliases provides a mock function for the type mockLambdaProvider
NEW
60
func (_mock *mockLambdaProvider) ListAliases(context1 context.Context, s string, s1 string) ([]awslib.AwsResource, error) {
×
NEW
61
        ret := _mock.Called(context1, s, s1)
×
NEW
62

×
NEW
63
        if len(ret) == 0 {
×
NEW
64
                panic("no return value specified for ListAliases")
×
65
        }
66

NEW
67
        var r0 []awslib.AwsResource
×
NEW
68
        var r1 error
×
NEW
69
        if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) ([]awslib.AwsResource, error)); ok {
×
NEW
70
                return returnFunc(context1, s, s1)
×
NEW
71
        }
×
NEW
72
        if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) []awslib.AwsResource); ok {
×
NEW
73
                r0 = returnFunc(context1, s, s1)
×
NEW
74
        } else {
×
NEW
75
                if ret.Get(0) != nil {
×
NEW
76
                        r0 = ret.Get(0).([]awslib.AwsResource)
×
NEW
77
                }
×
78
        }
NEW
79
        if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
×
NEW
80
                r1 = returnFunc(context1, s, s1)
×
NEW
81
        } else {
×
NEW
82
                r1 = ret.Error(1)
×
NEW
83
        }
×
NEW
84
        return r0, r1
×
85
}
86

87
// mockLambdaProvider_ListAliases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAliases'
88
type mockLambdaProvider_ListAliases_Call struct {
89
        *mock.Call
90
}
91

92
// ListAliases is a helper method to define mock.On call
93
//   - context1 context.Context
94
//   - s string
95
//   - s1 string
NEW
96
func (_e *mockLambdaProvider_Expecter) ListAliases(context1 interface{}, s interface{}, s1 interface{}) *mockLambdaProvider_ListAliases_Call {
×
NEW
97
        return &mockLambdaProvider_ListAliases_Call{Call: _e.mock.On("ListAliases", context1, s, s1)}
×
NEW
98
}
×
99

NEW
100
func (_c *mockLambdaProvider_ListAliases_Call) Run(run func(context1 context.Context, s string, s1 string)) *mockLambdaProvider_ListAliases_Call {
×
NEW
101
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
102
                var arg0 context.Context
×
NEW
103
                if args[0] != nil {
×
NEW
104
                        arg0 = args[0].(context.Context)
×
NEW
105
                }
×
NEW
106
                var arg1 string
×
NEW
107
                if args[1] != nil {
×
NEW
108
                        arg1 = args[1].(string)
×
NEW
109
                }
×
NEW
110
                var arg2 string
×
NEW
111
                if args[2] != nil {
×
NEW
112
                        arg2 = args[2].(string)
×
NEW
113
                }
×
NEW
114
                run(
×
NEW
115
                        arg0,
×
NEW
116
                        arg1,
×
NEW
117
                        arg2,
×
NEW
118
                )
×
119
        })
NEW
120
        return _c
×
121
}
122

NEW
123
func (_c *mockLambdaProvider_ListAliases_Call) Return(awsResources []awslib.AwsResource, err error) *mockLambdaProvider_ListAliases_Call {
×
NEW
124
        _c.Call.Return(awsResources, err)
×
NEW
125
        return _c
×
NEW
126
}
×
127

NEW
128
func (_c *mockLambdaProvider_ListAliases_Call) RunAndReturn(run func(context1 context.Context, s string, s1 string) ([]awslib.AwsResource, error)) *mockLambdaProvider_ListAliases_Call {
×
NEW
129
        _c.Call.Return(run)
×
NEW
130
        return _c
×
NEW
131
}
×
132

133
// ListEventSourceMappings provides a mock function for the type mockLambdaProvider
134
func (_mock *mockLambdaProvider) ListEventSourceMappings(context1 context.Context) ([]awslib.AwsResource, error) {
1✔
135
        ret := _mock.Called(context1)
1✔
136

1✔
137
        if len(ret) == 0 {
1✔
NEW
138
                panic("no return value specified for ListEventSourceMappings")
×
139
        }
140

141
        var r0 []awslib.AwsResource
1✔
142
        var r1 error
1✔
143
        if returnFunc, ok := ret.Get(0).(func(context.Context) ([]awslib.AwsResource, error)); ok {
1✔
NEW
144
                return returnFunc(context1)
×
NEW
145
        }
×
146
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
1✔
NEW
147
                r0 = returnFunc(context1)
×
148
        } else {
1✔
149
                if ret.Get(0) != nil {
2✔
150
                        r0 = ret.Get(0).([]awslib.AwsResource)
1✔
151
                }
1✔
152
        }
153
        if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1✔
NEW
154
                r1 = returnFunc(context1)
×
155
        } else {
1✔
156
                r1 = ret.Error(1)
1✔
157
        }
1✔
158
        return r0, r1
1✔
159
}
160

161
// mockLambdaProvider_ListEventSourceMappings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEventSourceMappings'
162
type mockLambdaProvider_ListEventSourceMappings_Call struct {
163
        *mock.Call
164
}
165

166
// ListEventSourceMappings is a helper method to define mock.On call
167
//   - context1 context.Context
NEW
168
func (_e *mockLambdaProvider_Expecter) ListEventSourceMappings(context1 interface{}) *mockLambdaProvider_ListEventSourceMappings_Call {
×
NEW
169
        return &mockLambdaProvider_ListEventSourceMappings_Call{Call: _e.mock.On("ListEventSourceMappings", context1)}
×
NEW
170
}
×
171

NEW
172
func (_c *mockLambdaProvider_ListEventSourceMappings_Call) Run(run func(context1 context.Context)) *mockLambdaProvider_ListEventSourceMappings_Call {
×
NEW
173
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
174
                var arg0 context.Context
×
NEW
175
                if args[0] != nil {
×
NEW
176
                        arg0 = args[0].(context.Context)
×
NEW
177
                }
×
NEW
178
                run(
×
NEW
179
                        arg0,
×
NEW
180
                )
×
181
        })
NEW
182
        return _c
×
183
}
184

NEW
185
func (_c *mockLambdaProvider_ListEventSourceMappings_Call) Return(awsResources []awslib.AwsResource, err error) *mockLambdaProvider_ListEventSourceMappings_Call {
×
NEW
186
        _c.Call.Return(awsResources, err)
×
NEW
187
        return _c
×
NEW
188
}
×
189

NEW
190
func (_c *mockLambdaProvider_ListEventSourceMappings_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *mockLambdaProvider_ListEventSourceMappings_Call {
×
NEW
191
        _c.Call.Return(run)
×
NEW
192
        return _c
×
NEW
193
}
×
194

195
// ListFunctions provides a mock function for the type mockLambdaProvider
196
func (_mock *mockLambdaProvider) ListFunctions(context1 context.Context) ([]awslib.AwsResource, error) {
1✔
197
        ret := _mock.Called(context1)
1✔
198

1✔
199
        if len(ret) == 0 {
1✔
NEW
200
                panic("no return value specified for ListFunctions")
×
201
        }
202

203
        var r0 []awslib.AwsResource
1✔
204
        var r1 error
1✔
205
        if returnFunc, ok := ret.Get(0).(func(context.Context) ([]awslib.AwsResource, error)); ok {
1✔
NEW
206
                return returnFunc(context1)
×
NEW
207
        }
×
208
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
1✔
NEW
209
                r0 = returnFunc(context1)
×
210
        } else {
1✔
211
                if ret.Get(0) != nil {
2✔
212
                        r0 = ret.Get(0).([]awslib.AwsResource)
1✔
213
                }
1✔
214
        }
215
        if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1✔
NEW
216
                r1 = returnFunc(context1)
×
217
        } else {
1✔
218
                r1 = ret.Error(1)
1✔
219
        }
1✔
220
        return r0, r1
1✔
221
}
222

223
// mockLambdaProvider_ListFunctions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFunctions'
224
type mockLambdaProvider_ListFunctions_Call struct {
225
        *mock.Call
226
}
227

228
// ListFunctions is a helper method to define mock.On call
229
//   - context1 context.Context
230
func (_e *mockLambdaProvider_Expecter) ListFunctions(context1 interface{}) *mockLambdaProvider_ListFunctions_Call {
1✔
231
        return &mockLambdaProvider_ListFunctions_Call{Call: _e.mock.On("ListFunctions", context1)}
1✔
232
}
1✔
233

NEW
234
func (_c *mockLambdaProvider_ListFunctions_Call) Run(run func(context1 context.Context)) *mockLambdaProvider_ListFunctions_Call {
×
NEW
235
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
236
                var arg0 context.Context
×
NEW
237
                if args[0] != nil {
×
NEW
238
                        arg0 = args[0].(context.Context)
×
NEW
239
                }
×
NEW
240
                run(
×
NEW
241
                        arg0,
×
NEW
242
                )
×
243
        })
NEW
244
        return _c
×
245
}
246

247
func (_c *mockLambdaProvider_ListFunctions_Call) Return(awsResources []awslib.AwsResource, err error) *mockLambdaProvider_ListFunctions_Call {
1✔
248
        _c.Call.Return(awsResources, err)
1✔
249
        return _c
1✔
250
}
1✔
251

NEW
252
func (_c *mockLambdaProvider_ListFunctions_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *mockLambdaProvider_ListFunctions_Call {
×
NEW
253
        _c.Call.Return(run)
×
NEW
254
        return _c
×
NEW
255
}
×
256

257
// ListLayers provides a mock function for the type mockLambdaProvider
258
func (_mock *mockLambdaProvider) ListLayers(context1 context.Context) ([]awslib.AwsResource, error) {
1✔
259
        ret := _mock.Called(context1)
1✔
260

1✔
261
        if len(ret) == 0 {
1✔
NEW
262
                panic("no return value specified for ListLayers")
×
263
        }
264

265
        var r0 []awslib.AwsResource
1✔
266
        var r1 error
1✔
267
        if returnFunc, ok := ret.Get(0).(func(context.Context) ([]awslib.AwsResource, error)); ok {
1✔
NEW
268
                return returnFunc(context1)
×
NEW
269
        }
×
270
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
1✔
NEW
271
                r0 = returnFunc(context1)
×
272
        } else {
1✔
273
                if ret.Get(0) != nil {
2✔
274
                        r0 = ret.Get(0).([]awslib.AwsResource)
1✔
275
                }
1✔
276
        }
277
        if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1✔
NEW
278
                r1 = returnFunc(context1)
×
279
        } else {
1✔
280
                r1 = ret.Error(1)
1✔
281
        }
1✔
282
        return r0, r1
1✔
283
}
284

285
// mockLambdaProvider_ListLayers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListLayers'
286
type mockLambdaProvider_ListLayers_Call struct {
287
        *mock.Call
288
}
289

290
// ListLayers is a helper method to define mock.On call
291
//   - context1 context.Context
NEW
292
func (_e *mockLambdaProvider_Expecter) ListLayers(context1 interface{}) *mockLambdaProvider_ListLayers_Call {
×
NEW
293
        return &mockLambdaProvider_ListLayers_Call{Call: _e.mock.On("ListLayers", context1)}
×
NEW
294
}
×
295

NEW
296
func (_c *mockLambdaProvider_ListLayers_Call) Run(run func(context1 context.Context)) *mockLambdaProvider_ListLayers_Call {
×
NEW
297
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
298
                var arg0 context.Context
×
NEW
299
                if args[0] != nil {
×
NEW
300
                        arg0 = args[0].(context.Context)
×
NEW
301
                }
×
NEW
302
                run(
×
NEW
303
                        arg0,
×
NEW
304
                )
×
305
        })
NEW
306
        return _c
×
307
}
308

NEW
309
func (_c *mockLambdaProvider_ListLayers_Call) Return(awsResources []awslib.AwsResource, err error) *mockLambdaProvider_ListLayers_Call {
×
NEW
310
        _c.Call.Return(awsResources, err)
×
NEW
311
        return _c
×
NEW
312
}
×
313

NEW
314
func (_c *mockLambdaProvider_ListLayers_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *mockLambdaProvider_ListLayers_Call {
×
NEW
315
        _c.Call.Return(run)
×
NEW
316
        return _c
×
NEW
317
}
×
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