@@ -21,8 +21,8 @@ type MockImagesExtractor struct {
2121 mock.Mock
2222}
2323
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 )
2626 return args .Get (0 ).(types.FileImages ), args .Get (1 ).(map [string ]map [string ]string ), args .String (2 ), args .Error (3 )
2727}
2828
@@ -31,6 +31,11 @@ func (m *MockImagesExtractor) ExtractAndMergeImagesFromFiles(files types.FileIma
3131 return args .Get (0 ).([]types.ImageModel ), args .Error (1 )
3232}
3333
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+
3439func (m * MockImagesExtractor ) SaveObjectToFile (folderPath string , obj interface {}) error {
3540 return m .Called (folderPath , obj ).Error (0 )
3641}
@@ -128,7 +133,7 @@ func TestResolve(t *testing.T) {
128133 checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
129134 createTestFolder (checkmarxPath )
130135
131- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
136+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
132137 Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" , nil )
133138 mockImagesExtractor .On ("ExtractAndMergeImagesFromFiles" ,
134139 sampleFileImages ,
@@ -141,7 +146,7 @@ func TestResolve(t *testing.T) {
141146 err := resolver .Resolve (scanPath , resolutionFolderPath , images , true )
142147 assert .NoError (t , err )
143148
144- mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath )
149+ mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath , mock . Anything )
145150 mockImagesExtractor .AssertCalled (t , "ExtractAndMergeImagesFromFiles" , sampleFileImages , mock .Anything , mock .Anything )
146151 mockSyftPackagesExtractor .AssertCalled (t , "AnalyzeImagesWithPlatform" , mock .Anything , "linux/amd64" )
147152 mockImagesExtractor .AssertCalled (t , "SaveObjectToFile" , checkmarxPath , expectedResolution )
@@ -169,14 +174,14 @@ func TestResolve(t *testing.T) {
169174 checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
170175 createTestFolder (checkmarxPath )
171176
172- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
177+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
173178 Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" ,
174179 errors .New ("invalid path" ))
175180
176181 err := resolver .Resolve (scanPath , resolutionFolderPath , images , false )
177182 assert .Error (t , err )
178183 assert .Equal (t , "invalid path" , err .Error ())
179- mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath )
184+ mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath , mock . Anything )
180185 })
181186
182187 t .Run ("Error in AnalyzeImages" , func (t * testing.T ) {
@@ -188,7 +193,7 @@ func TestResolve(t *testing.T) {
188193 checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
189194 createTestFolder (checkmarxPath )
190195
191- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
196+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
192197 Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" , nil )
193198
194199 mockImagesExtractor .On ("ExtractAndMergeImagesFromFiles" , sampleFileImages , types .ToImageModels (images ),
0 commit comments