• 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

0.0
/internal/resources/providers/awslib/lambda/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 lambda
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
// NewMockLambda creates a new instance of MockLambda. 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 NewMockLambda(t interface {
35
        mock.TestingT
36
        Cleanup(func())
NEW
37
}) *MockLambda {
×
NEW
38
        mock := &MockLambda{}
×
NEW
39
        mock.Mock.Test(t)
×
NEW
40

×
NEW
41
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
42

NEW
43
        return mock
×
44
}
45

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

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

NEW
55
func (_m *MockLambda) EXPECT() *MockLambda_Expecter {
×
NEW
56
        return &MockLambda_Expecter{mock: &_m.Mock}
×
NEW
57
}
×
58

59
// ListAliases provides a mock function for the type MockLambda
NEW
60
func (_mock *MockLambda) ListAliases(context1 context.Context) ([]awslib.AwsResource, error) {
×
NEW
61
        ret := _mock.Called(context1)
×
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) ([]awslib.AwsResource, error)); ok {
×
NEW
70
                return returnFunc(context1)
×
NEW
71
        }
×
NEW
72
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
×
NEW
73
                r0 = returnFunc(context1)
×
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) error); ok {
×
NEW
80
                r1 = returnFunc(context1)
×
NEW
81
        } else {
×
NEW
82
                r1 = ret.Error(1)
×
NEW
83
        }
×
NEW
84
        return r0, r1
×
85
}
86

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

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

NEW
98
func (_c *MockLambda_ListAliases_Call) Run(run func(context1 context.Context)) *MockLambda_ListAliases_Call {
×
NEW
99
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
100
                var arg0 context.Context
×
NEW
101
                if args[0] != nil {
×
NEW
102
                        arg0 = args[0].(context.Context)
×
NEW
103
                }
×
NEW
104
                run(
×
NEW
105
                        arg0,
×
NEW
106
                )
×
107
        })
NEW
108
        return _c
×
109
}
110

NEW
111
func (_c *MockLambda_ListAliases_Call) Return(awsResources []awslib.AwsResource, err error) *MockLambda_ListAliases_Call {
×
NEW
112
        _c.Call.Return(awsResources, err)
×
NEW
113
        return _c
×
NEW
114
}
×
115

NEW
116
func (_c *MockLambda_ListAliases_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *MockLambda_ListAliases_Call {
×
NEW
117
        _c.Call.Return(run)
×
NEW
118
        return _c
×
NEW
119
}
×
120

121
// ListEventSourceMappings provides a mock function for the type MockLambda
NEW
122
func (_mock *MockLambda) ListEventSourceMappings(context1 context.Context) ([]awslib.AwsResource, error) {
×
NEW
123
        ret := _mock.Called(context1)
×
NEW
124

×
NEW
125
        if len(ret) == 0 {
×
NEW
126
                panic("no return value specified for ListEventSourceMappings")
×
127
        }
128

NEW
129
        var r0 []awslib.AwsResource
×
NEW
130
        var r1 error
×
NEW
131
        if returnFunc, ok := ret.Get(0).(func(context.Context) ([]awslib.AwsResource, error)); ok {
×
NEW
132
                return returnFunc(context1)
×
NEW
133
        }
×
NEW
134
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
×
NEW
135
                r0 = returnFunc(context1)
×
NEW
136
        } else {
×
NEW
137
                if ret.Get(0) != nil {
×
NEW
138
                        r0 = ret.Get(0).([]awslib.AwsResource)
×
NEW
139
                }
×
140
        }
NEW
141
        if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
×
NEW
142
                r1 = returnFunc(context1)
×
NEW
143
        } else {
×
NEW
144
                r1 = ret.Error(1)
×
NEW
145
        }
×
NEW
146
        return r0, r1
×
147
}
148

149
// MockLambda_ListEventSourceMappings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListEventSourceMappings'
150
type MockLambda_ListEventSourceMappings_Call struct {
151
        *mock.Call
152
}
153

154
// ListEventSourceMappings is a helper method to define mock.On call
155
//   - context1 context.Context
NEW
156
func (_e *MockLambda_Expecter) ListEventSourceMappings(context1 interface{}) *MockLambda_ListEventSourceMappings_Call {
×
NEW
157
        return &MockLambda_ListEventSourceMappings_Call{Call: _e.mock.On("ListEventSourceMappings", context1)}
×
NEW
158
}
×
159

NEW
160
func (_c *MockLambda_ListEventSourceMappings_Call) Run(run func(context1 context.Context)) *MockLambda_ListEventSourceMappings_Call {
×
NEW
161
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
162
                var arg0 context.Context
×
NEW
163
                if args[0] != nil {
×
NEW
164
                        arg0 = args[0].(context.Context)
×
NEW
165
                }
×
NEW
166
                run(
×
NEW
167
                        arg0,
×
NEW
168
                )
×
169
        })
NEW
170
        return _c
×
171
}
172

NEW
173
func (_c *MockLambda_ListEventSourceMappings_Call) Return(awsResources []awslib.AwsResource, err error) *MockLambda_ListEventSourceMappings_Call {
×
NEW
174
        _c.Call.Return(awsResources, err)
×
NEW
175
        return _c
×
NEW
176
}
×
177

NEW
178
func (_c *MockLambda_ListEventSourceMappings_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *MockLambda_ListEventSourceMappings_Call {
×
NEW
179
        _c.Call.Return(run)
×
NEW
180
        return _c
×
NEW
181
}
×
182

183
// ListFunctions provides a mock function for the type MockLambda
NEW
184
func (_mock *MockLambda) ListFunctions(context1 context.Context) ([]awslib.AwsResource, error) {
×
NEW
185
        ret := _mock.Called(context1)
×
NEW
186

×
NEW
187
        if len(ret) == 0 {
×
NEW
188
                panic("no return value specified for ListFunctions")
×
189
        }
190

NEW
191
        var r0 []awslib.AwsResource
×
NEW
192
        var r1 error
×
NEW
193
        if returnFunc, ok := ret.Get(0).(func(context.Context) ([]awslib.AwsResource, error)); ok {
×
NEW
194
                return returnFunc(context1)
×
NEW
195
        }
×
NEW
196
        if returnFunc, ok := ret.Get(0).(func(context.Context) []awslib.AwsResource); ok {
×
NEW
197
                r0 = returnFunc(context1)
×
NEW
198
        } else {
×
NEW
199
                if ret.Get(0) != nil {
×
NEW
200
                        r0 = ret.Get(0).([]awslib.AwsResource)
×
NEW
201
                }
×
202
        }
NEW
203
        if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
×
NEW
204
                r1 = returnFunc(context1)
×
NEW
205
        } else {
×
NEW
206
                r1 = ret.Error(1)
×
NEW
207
        }
×
NEW
208
        return r0, r1
×
209
}
210

211
// MockLambda_ListFunctions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFunctions'
212
type MockLambda_ListFunctions_Call struct {
213
        *mock.Call
214
}
215

216
// ListFunctions is a helper method to define mock.On call
217
//   - context1 context.Context
NEW
218
func (_e *MockLambda_Expecter) ListFunctions(context1 interface{}) *MockLambda_ListFunctions_Call {
×
NEW
219
        return &MockLambda_ListFunctions_Call{Call: _e.mock.On("ListFunctions", context1)}
×
NEW
220
}
×
221

NEW
222
func (_c *MockLambda_ListFunctions_Call) Run(run func(context1 context.Context)) *MockLambda_ListFunctions_Call {
×
NEW
223
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
224
                var arg0 context.Context
×
NEW
225
                if args[0] != nil {
×
NEW
226
                        arg0 = args[0].(context.Context)
×
NEW
227
                }
×
NEW
228
                run(
×
NEW
229
                        arg0,
×
NEW
230
                )
×
231
        })
NEW
232
        return _c
×
233
}
234

NEW
235
func (_c *MockLambda_ListFunctions_Call) Return(awsResources []awslib.AwsResource, err error) *MockLambda_ListFunctions_Call {
×
NEW
236
        _c.Call.Return(awsResources, err)
×
NEW
237
        return _c
×
NEW
238
}
×
239

NEW
240
func (_c *MockLambda_ListFunctions_Call) RunAndReturn(run func(context1 context.Context) ([]awslib.AwsResource, error)) *MockLambda_ListFunctions_Call {
×
NEW
241
        _c.Call.Return(run)
×
NEW
242
        return _c
×
NEW
243
}
×
244

245
// ListLayers provides a mock function for the type MockLambda
NEW
246
func (_mock *MockLambda) ListLayers(context1 context.Context, s string, s1 string) ([]awslib.AwsResource, error) {
×
NEW
247
        ret := _mock.Called(context1, s, s1)
×
NEW
248

×
NEW
249
        if len(ret) == 0 {
×
NEW
250
                panic("no return value specified for ListLayers")
×
251
        }
252

NEW
253
        var r0 []awslib.AwsResource
×
NEW
254
        var r1 error
×
NEW
255
        if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) ([]awslib.AwsResource, error)); ok {
×
NEW
256
                return returnFunc(context1, s, s1)
×
NEW
257
        }
×
NEW
258
        if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) []awslib.AwsResource); ok {
×
NEW
259
                r0 = returnFunc(context1, s, s1)
×
NEW
260
        } else {
×
NEW
261
                if ret.Get(0) != nil {
×
NEW
262
                        r0 = ret.Get(0).([]awslib.AwsResource)
×
NEW
263
                }
×
264
        }
NEW
265
        if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
×
NEW
266
                r1 = returnFunc(context1, s, s1)
×
NEW
267
        } else {
×
NEW
268
                r1 = ret.Error(1)
×
NEW
269
        }
×
NEW
270
        return r0, r1
×
271
}
272

273
// MockLambda_ListLayers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListLayers'
274
type MockLambda_ListLayers_Call struct {
275
        *mock.Call
276
}
277

278
// ListLayers is a helper method to define mock.On call
279
//   - context1 context.Context
280
//   - s string
281
//   - s1 string
NEW
282
func (_e *MockLambda_Expecter) ListLayers(context1 interface{}, s interface{}, s1 interface{}) *MockLambda_ListLayers_Call {
×
NEW
283
        return &MockLambda_ListLayers_Call{Call: _e.mock.On("ListLayers", context1, s, s1)}
×
NEW
284
}
×
285

NEW
286
func (_c *MockLambda_ListLayers_Call) Run(run func(context1 context.Context, s string, s1 string)) *MockLambda_ListLayers_Call {
×
NEW
287
        _c.Call.Run(func(args mock.Arguments) {
×
NEW
288
                var arg0 context.Context
×
NEW
289
                if args[0] != nil {
×
NEW
290
                        arg0 = args[0].(context.Context)
×
NEW
291
                }
×
NEW
292
                var arg1 string
×
NEW
293
                if args[1] != nil {
×
NEW
294
                        arg1 = args[1].(string)
×
NEW
295
                }
×
NEW
296
                var arg2 string
×
NEW
297
                if args[2] != nil {
×
NEW
298
                        arg2 = args[2].(string)
×
NEW
299
                }
×
NEW
300
                run(
×
NEW
301
                        arg0,
×
NEW
302
                        arg1,
×
NEW
303
                        arg2,
×
NEW
304
                )
×
305
        })
NEW
306
        return _c
×
307
}
308

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

NEW
314
func (_c *MockLambda_ListLayers_Call) RunAndReturn(run func(context1 context.Context, s string, s1 string) ([]awslib.AwsResource, error)) *MockLambda_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