@@ -1854,12 +1854,13 @@ func TestAddContainersScan_WithCustomImages_ShouldSetUserCustomImages(t *testing
18541854func TestInitializeContainersConfigWithResubmitValues_UserCustomImages (t * testing.T ) {
18551855 // Define test cases
18561856 testCases := []struct {
1857- name string
1858- resubmitConfig []wrappers.Config
1859- expectedCustomImages string
1857+ name string
1858+ resubmitConfig []wrappers.Config
1859+ containerResolveLocally bool
1860+ expectedCustomImages string
18601861 }{
18611862 {
1862- name : "When UserCustomImages is valid string, it should be set in containerConfig" ,
1863+ name : "When UserCustomImages is valid string and ContainerResolveLocally is false , it should be set in containerConfig" ,
18631864 resubmitConfig : []wrappers.Config {
18641865 {
18651866 Type : commonParams .ContainersType ,
@@ -1868,7 +1869,21 @@ func TestInitializeContainersConfigWithResubmitValues_UserCustomImages(t *testin
18681869 },
18691870 },
18701871 },
1871- expectedCustomImages : "image1:tag1,image2:tag2" ,
1872+ containerResolveLocally : false ,
1873+ expectedCustomImages : "image1:tag1,image2:tag2" ,
1874+ },
1875+ {
1876+ name : "When UserCustomImages is valid string and ContainerResolveLocally is true, it should not be set in containerConfig" ,
1877+ resubmitConfig : []wrappers.Config {
1878+ {
1879+ Type : commonParams .ContainersType ,
1880+ Value : map [string ]interface {}{
1881+ ConfigUserCustomImagesKey : "image1:tag1,image2:tag2" ,
1882+ },
1883+ },
1884+ },
1885+ containerResolveLocally : true ,
1886+ expectedCustomImages : "" ,
18721887 },
18731888 {
18741889 name : "When UserCustomImages is empty string, containerConfig should not be updated" ,
@@ -1880,7 +1895,8 @@ func TestInitializeContainersConfigWithResubmitValues_UserCustomImages(t *testin
18801895 },
18811896 },
18821897 },
1883- expectedCustomImages : "" ,
1898+ containerResolveLocally : false ,
1899+ expectedCustomImages : "" ,
18841900 },
18851901 {
18861902 name : "When UserCustomImages is nil, containerConfig should not be updated" ,
@@ -1892,7 +1908,8 @@ func TestInitializeContainersConfigWithResubmitValues_UserCustomImages(t *testin
18921908 },
18931909 },
18941910 },
1895- expectedCustomImages : "" ,
1911+ containerResolveLocally : false ,
1912+ expectedCustomImages : "" ,
18961913 },
18971914 {
18981915 name : "When config.Value doesn't have UserCustomImages key, containerConfig should not be updated" ,
@@ -1902,7 +1919,8 @@ func TestInitializeContainersConfigWithResubmitValues_UserCustomImages(t *testin
19021919 Value : map [string ]interface {}{},
19031920 },
19041921 },
1905- expectedCustomImages : "" ,
1922+ containerResolveLocally : false ,
1923+ expectedCustomImages : "" ,
19061924 },
19071925 }
19081926
@@ -1913,7 +1931,7 @@ func TestInitializeContainersConfigWithResubmitValues_UserCustomImages(t *testin
19131931 containerConfig := & wrappers.ContainerConfig {}
19141932
19151933 // Call the function under test
1916- initializeContainersConfigWithResubmitValues (tc .resubmitConfig , containerConfig )
1934+ initializeContainersConfigWithResubmitValues (tc .resubmitConfig , containerConfig , tc . containerResolveLocally )
19171935
19181936 // Assert the result
19191937 assert .Equal (t , tc .expectedCustomImages , containerConfig .UserCustomImages ,
0 commit comments