@@ -114,7 +114,7 @@ func TestOneConfigMapWithNoUserMountPath(t *testing.T) {
114114 buildConfig (defaultName , mountPath , defaultData ),
115115 }
116116
117- gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil )
117+ gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil , nil )
118118 if ! assert .NoError (t , err , "Should not return error" ) {
119119 return
120120 }
@@ -127,7 +127,7 @@ func TestOneConfigMapWithMountPathAndHostAndCert(t *testing.T) {
127127 buildConfig (defaultName , mountPath , defaultData ),
128128 }
129129
130- gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil )
130+ gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil , nil )
131131 if ! assert .NoError (t , err , "Should not return error" ) {
132132 return
133133 }
@@ -140,7 +140,7 @@ func TestOneConfigMapWithMountPathAndWithoutHostAndWithoutCert(t *testing.T) {
140140 buildConfig (defaultName , mountPath , map [string ]string {}),
141141 }
142142
143- _ , err := constructGitConfig (testNamespace , mountPath , configmaps , nil )
143+ _ , err := constructGitConfig (testNamespace , mountPath , configmaps , nil , nil )
144144 assert .Equal (t , err .Error (), fmt .Sprintf ("could not find certificate field in configmap %s" , defaultName ))
145145}
146146
@@ -152,7 +152,7 @@ func TestOneConfigMapWithMountPathAndWithoutHostAndWithCert(t *testing.T) {
152152 }),
153153 }
154154
155- gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil )
155+ gitconfig , err := constructGitConfig (testNamespace , mountPath , configmaps , nil , nil )
156156 if ! assert .NoError (t , err , "Should not return error" ) {
157157 return
158158 }
@@ -167,7 +167,7 @@ func TestOneConfigMapWithMountPathAndWithHostAndWithoutCert(t *testing.T) {
167167 }),
168168 }
169169
170- _ , err := constructGitConfig (testNamespace , mountPath , configmaps , nil )
170+ _ , err := constructGitConfig (testNamespace , mountPath , configmaps , nil , nil )
171171 assert .Equal (t , err .Error (), fmt .Sprintf ("could not find certificate field in configmap %s" , defaultName ))
172172}
173173
@@ -177,7 +177,7 @@ func TestTwoConfigMapWithNoDefinedMountPathInAnnotation(t *testing.T) {
177177 buildConfig ("configmap2" , "/folder2" , defaultData ),
178178 }
179179
180- gitconfig , err := constructGitConfig (testNamespace , "" , configmaps , nil )
180+ gitconfig , err := constructGitConfig (testNamespace , "" , configmaps , nil , nil )
181181 if ! assert .NoError (t , err , "Should not return error" ) {
182182 return
183183 }
@@ -196,7 +196,7 @@ func TestTwoConfigMapWithOneDefaultTLSAndOtherGithubTLS(t *testing.T) {
196196 }),
197197 }
198198
199- gitconfig , err := constructGitConfig (testNamespace , "" , configmaps , nil )
199+ gitconfig , err := constructGitConfig (testNamespace , "" , configmaps , nil , nil )
200200 if ! assert .NoError (t , err , "Should not return error" ) {
201201 return
202202 }
@@ -214,10 +214,32 @@ func TestTwoConfigMapWithBothMissingHost(t *testing.T) {
214214 }),
215215 }
216216
217- _ , err := constructGitConfig (testNamespace , "" , configmaps , nil )
217+ _ , err := constructGitConfig (testNamespace , "" , configmaps , nil , nil )
218218 assert .Equal (t , err .Error (), "multiple git tls credentials do not have host specified" )
219219}
220220
221+ func TestExtraProperties (t * testing.T ) {
222+ mountPath := "/sample/test"
223+ secret := corev1.Secret {
224+ ObjectMeta : metav1.ObjectMeta {
225+ Name : constants .DevWorkspaceGitconfigExtraPropertiesSecretName ,
226+ Namespace : testNamespace ,
227+ },
228+ Data : map [string ][]byte {
229+ "section" : []byte ("property1 = value1\n property2 = value2\n invalidPropertySet" ),
230+ },
231+ }
232+
233+ gitconfig , err := constructGitConfig (testNamespace , mountPath , []corev1.ConfigMap {}, & secret , nil )
234+ if ! assert .NoError (t , err , "Should not return error" ) {
235+ return
236+ }
237+ assert .Contains (t , gitconfig .Data [gitConfigName ], `[section]
238+ property1 = value1
239+ property2 = value2` )
240+ assert .NotContains (t , gitconfig .Data [gitConfigName ], `invalidPropertySet` )
241+ }
242+
221243func buildConfig (name string , mountPath string , data map [string ]string ) corev1.ConfigMap {
222244 return corev1.ConfigMap {
223245 ObjectMeta : metav1.ObjectMeta {
0 commit comments