#96 Small improvements in tests
This commit is contained in:
		
							parent
							
								
									e8277cc8a0
								
							
						
					
					
						commit
						9763ea5899
					
				|  | @ -150,18 +150,6 @@ func GetJenkinsMasterPodBaseVolumes(jenkins *v1alpha2.Jenkins) []corev1.Volume { | |||
| 	return volumes | ||||
| } | ||||
| 
 | ||||
| func checkSecretVolumesPresence(jenkins *v1alpha2.Jenkins) (groovyExists bool, cascExists bool) { | ||||
| 	for _, volume := range GetJenkinsMasterPodBaseVolumes(jenkins) { | ||||
| 		if volume.Name == ("gs-" + jenkins.Spec.GroovyScripts.Secret.Name) { | ||||
| 			groovyExists = true | ||||
| 		} else if volume.Name == ("casc-" + jenkins.Spec.ConfigurationAsCode.Secret.Name) { | ||||
| 			cascExists = true | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return groovyExists, cascExists | ||||
| } | ||||
| 
 | ||||
| func getGroovyScriptsSecretVolumeName(jenkins *v1alpha2.Jenkins) string { | ||||
| 	return "gs-" + jenkins.Spec.GroovyScripts.Secret.Name | ||||
| } | ||||
|  |  | |||
|  | @ -138,9 +138,14 @@ func TestGetJenkinsMasterPodBaseVolumes(t *testing.T) { | |||
| 			}, | ||||
| 		} | ||||
| 
 | ||||
| 		groovyExists := false | ||||
| 		cascExists := false | ||||
| 		groovyExists, cascExists := checkSecretVolumesPresence(jenkins) | ||||
| 
 | ||||
| 		assert.True(t, groovyExists) | ||||
| 		assert.True(t, cascExists) | ||||
| 	}) | ||||
| } | ||||
| 
 | ||||
| func checkSecretVolumesPresence(jenkins *v1alpha2.Jenkins) (groovyExists bool, cascExists bool) { | ||||
| 	for _, volume := range GetJenkinsMasterPodBaseVolumes(jenkins) { | ||||
| 		if volume.Name == ("gs-" + jenkins.Spec.GroovyScripts.Secret.Name) { | ||||
| 			groovyExists = true | ||||
|  | @ -148,8 +153,6 @@ func TestGetJenkinsMasterPodBaseVolumes(t *testing.T) { | |||
| 			cascExists = true | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 		assert.True(t, groovyExists) | ||||
| 		assert.True(t, cascExists) | ||||
| 	}) | ||||
| 	return groovyExists, cascExists | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue