@@ -21,8 +21,8 @@ type MockImagesExtractor struct {
21
21
mock.Mock
22
22
}
23
23
24
- func (m * MockImagesExtractor ) ExtractFiles (scanPath string ) (types.FileImages , map [string ]map [string ]string , string , error ) {
25
- args := m .Called (scanPath )
24
+ func (m * MockImagesExtractor ) ExtractFiles (scanPath string , isFullHelmDirectory ... bool ) (types.FileImages , map [string ]map [string ]string , string , error ) {
25
+ args := m .Called (scanPath , isFullHelmDirectory )
26
26
return args .Get (0 ).(types.FileImages ), args .Get (1 ).(map [string ]map [string ]string ), args .String (2 ), args .Error (3 )
27
27
}
28
28
@@ -31,6 +31,11 @@ func (m *MockImagesExtractor) ExtractAndMergeImagesFromFiles(files types.FileIma
31
31
return args .Get (0 ).([]types.ImageModel ), args .Error (1 )
32
32
}
33
33
34
+ func (m * MockImagesExtractor ) ExtractAndMergeImagesFromFilesWithLineInfo (files types.FileImages , images []types.ImageModel , settingsFiles map [string ]map [string ]string ) ([]types.ImageModel , error ) {
35
+ args := m .Called (files , images , settingsFiles )
36
+ return args .Get (0 ).([]types.ImageModel ), args .Error (1 )
37
+ }
38
+
34
39
func (m * MockImagesExtractor ) SaveObjectToFile (folderPath string , obj interface {}) error {
35
40
return m .Called (folderPath , obj ).Error (0 )
36
41
}
@@ -128,7 +133,7 @@ func TestResolve(t *testing.T) {
128
133
checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
129
134
createTestFolder (checkmarxPath )
130
135
131
- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
136
+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
132
137
Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" , nil )
133
138
mockImagesExtractor .On ("ExtractAndMergeImagesFromFiles" ,
134
139
sampleFileImages ,
@@ -141,7 +146,7 @@ func TestResolve(t *testing.T) {
141
146
err := resolver .Resolve (scanPath , resolutionFolderPath , images , true )
142
147
assert .NoError (t , err )
143
148
144
- mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath )
149
+ mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath , mock . Anything )
145
150
mockImagesExtractor .AssertCalled (t , "ExtractAndMergeImagesFromFiles" , sampleFileImages , mock .Anything , mock .Anything )
146
151
mockSyftPackagesExtractor .AssertCalled (t , "AnalyzeImagesWithPlatform" , mock .Anything , "linux/amd64" )
147
152
mockImagesExtractor .AssertCalled (t , "SaveObjectToFile" , checkmarxPath , expectedResolution )
@@ -169,14 +174,14 @@ func TestResolve(t *testing.T) {
169
174
checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
170
175
createTestFolder (checkmarxPath )
171
176
172
- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
177
+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
173
178
Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" ,
174
179
errors .New ("invalid path" ))
175
180
176
181
err := resolver .Resolve (scanPath , resolutionFolderPath , images , false )
177
182
assert .Error (t , err )
178
183
assert .Equal (t , "invalid path" , err .Error ())
179
- mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath )
184
+ mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath , mock . Anything )
180
185
})
181
186
182
187
t .Run ("Error in AnalyzeImages" , func (t * testing.T ) {
@@ -188,7 +193,7 @@ func TestResolve(t *testing.T) {
188
193
checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
189
194
createTestFolder (checkmarxPath )
190
195
191
- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
196
+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
192
197
Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" , nil )
193
198
194
199
mockImagesExtractor .On ("ExtractAndMergeImagesFromFiles" , sampleFileImages , types .ToImageModels (images ),
0 commit comments