#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 | 	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 { | func getGroovyScriptsSecretVolumeName(jenkins *v1alpha2.Jenkins) string { | ||||||
| 	return "gs-" + jenkins.Spec.GroovyScripts.Secret.Name | 	return "gs-" + jenkins.Spec.GroovyScripts.Secret.Name | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -138,18 +138,21 @@ func TestGetJenkinsMasterPodBaseVolumes(t *testing.T) { | ||||||
| 			}, | 			}, | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		groovyExists := false | 		groovyExists, cascExists := checkSecretVolumesPresence(jenkins) | ||||||
| 		cascExists := false |  | ||||||
| 
 |  | ||||||
| 		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 |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		assert.True(t, groovyExists) | 		assert.True(t, groovyExists) | ||||||
| 		assert.True(t, cascExists) | 		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 | ||||||
|  | 		} else if volume.Name == ("casc-" + jenkins.Spec.ConfigurationAsCode.Secret.Name) { | ||||||
|  | 			cascExists = true | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return groovyExists, cascExists | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue