@@ -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 )
@@ -163,14 +168,14 @@ func TestResolve(t *testing.T) {
163168 checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
164169 createTestFolder (checkmarxPath )
165170
166- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
171+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
167172 Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" ,
168173 errors .New ("invalid path" ))
169174
170175 err := resolver .Resolve (scanPath , resolutionFolderPath , images , false )
171176 assert .Error (t , err )
172177 assert .Equal (t , "invalid path" , err .Error ())
173- mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath )
178+ mockImagesExtractor .AssertCalled (t , "ExtractFiles" , scanPath , mock . Anything )
174179 })
175180
176181 t .Run ("Error in AnalyzeImages" , func (t * testing.T ) {
@@ -182,7 +187,7 @@ func TestResolve(t *testing.T) {
182187 checkmarxPath := filepath .Join (resolutionFolderPath , ".checkmarx" , "containers" )
183188 createTestFolder (checkmarxPath )
184189
185- mockImagesExtractor .On ("ExtractFiles" , scanPath ).
190+ mockImagesExtractor .On ("ExtractFiles" , scanPath , mock . Anything ).
186191 Return (sampleFileImages , map [string ]map [string ]string {"settings.json" : {"key" : "value" }}, "/output/path" , nil )
187192
188193 mockImagesExtractor .On ("ExtractAndMergeImagesFromFiles" , sampleFileImages , types .ToImageModels (images ),
0 commit comments