Fixed e2e tests
This commit is contained in:
parent
05a446e4a2
commit
5e22cdfdce
|
|
@ -40,31 +40,29 @@ func TestConfiguration(t *testing.T) {
|
|||
RepositoryURL: "https://github.com/jenkinsci/kubernetes-operator.git",
|
||||
},
|
||||
}
|
||||
volumes := []corev1.Volume{
|
||||
{
|
||||
Name: "test-configmap",
|
||||
VolumeSource: corev1.VolumeSource{
|
||||
ConfigMap: &corev1.ConfigMapVolumeSource{
|
||||
LocalObjectReference: corev1.LocalObjectReference{
|
||||
Name: userConfigurationConfigMapName,
|
||||
},
|
||||
},
|
||||
groovyScripts := v1alpha2.GroovyScripts{
|
||||
Customization: v1alpha2.Customization{
|
||||
Configurations: []v1alpha2.ConfigMapRef{
|
||||
{userConfigurationConfigMapName},
|
||||
},
|
||||
Secret:v1alpha2.SecretRef{userConfigurationSecretName },
|
||||
},
|
||||
{
|
||||
Name: "test-secret",
|
||||
VolumeSource: corev1.VolumeSource{
|
||||
Secret: &corev1.SecretVolumeSource{
|
||||
SecretName: userConfigurationSecretName,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
casc := v1alpha2.ConfigurationAsCode{
|
||||
Customization: v1alpha2.Customization{
|
||||
Configurations: []v1alpha2.ConfigMapRef{
|
||||
{userConfigurationConfigMapName},
|
||||
},
|
||||
Secret:v1alpha2.SecretRef{userConfigurationSecretName },
|
||||
},
|
||||
}
|
||||
|
||||
// base
|
||||
createUserConfigurationSecret(t, namespace, systemMessageEnvName, systemMessage)
|
||||
createUserConfigurationConfigMap(t, namespace, numberOfExecutors, fmt.Sprintf("${%s}", systemMessageEnvName))
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, &[]v1alpha2.SeedJob{mySeedJob.SeedJob}, volumes)
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, &[]v1alpha2.SeedJob{mySeedJob.SeedJob}, groovyScripts, casc)
|
||||
createDefaultLimitsForContainersInNamespace(t, namespace)
|
||||
createKubernetesCredentialsProviderSecret(t, namespace, mySeedJob)
|
||||
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ func createJenkinsAPIClient(jenkins *v1alpha2.Jenkins) (jenkinsclient.Jenkins, e
|
|||
)
|
||||
}
|
||||
|
||||
func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.SeedJob, volumes []corev1.Volume) *v1alpha2.Jenkins {
|
||||
func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.SeedJob, groovyScripts v1alpha2.GroovyScripts, casc v1alpha2.ConfigurationAsCode) *v1alpha2.Jenkins {
|
||||
var seedJobs []v1alpha2.SeedJob
|
||||
if seedJob != nil {
|
||||
seedJobs = append(seedJobs, *seedJob...)
|
||||
|
|
@ -78,6 +78,8 @@ func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.S
|
|||
Namespace: namespace,
|
||||
},
|
||||
Spec: v1alpha2.JenkinsSpec{
|
||||
GroovyScripts:groovyScripts,
|
||||
ConfigurationAsCode:casc,
|
||||
Master: v1alpha2.JenkinsMaster{
|
||||
Annotations: map[string]string{"test": "label"},
|
||||
Containers: []v1alpha2.Container{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func TestJenkinsMasterPodRestart(t *testing.T) {
|
|||
// Deletes test namespace
|
||||
defer ctx.Cleanup()
|
||||
|
||||
jenkins := createJenkinsCR(t, "e2e", namespace, nil, []corev1.Volume{})
|
||||
jenkins := createJenkinsCR(t, "e2e", namespace, nil, v1alpha2.GroovyScripts{}, v1alpha2.ConfigurationAsCode{})
|
||||
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
|
||||
restartJenkinsMasterPod(t, jenkins)
|
||||
waitForRecreateJenkinsMasterPod(t, jenkins)
|
||||
|
|
@ -36,7 +36,7 @@ func TestSafeRestart(t *testing.T) {
|
|||
|
||||
jenkinsCRName := "e2e"
|
||||
configureAuthorizationToUnSecure(t, namespace)
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, nil, []corev1.Volume{})
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, nil, v1alpha2.GroovyScripts{}, v1alpha2.ConfigurationAsCode{})
|
||||
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
|
||||
waitForJenkinsUserConfigurationToComplete(t, jenkins)
|
||||
jenkinsClient := verifyJenkinsAPIConnection(t, jenkins)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func TestSeedJobs(t *testing.T) {
|
|||
createKubernetesCredentialsProviderSecret(t, namespace, seedJobConfig)
|
||||
seedJobs = append(seedJobs, seedJobConfig.SeedJob)
|
||||
}
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, &seedJobs, []corev1.Volume{})
|
||||
jenkins := createJenkinsCR(t, jenkinsCRName, namespace, &seedJobs, v1alpha2.GroovyScripts{}, v1alpha2.ConfigurationAsCode{})
|
||||
waitForJenkinsBaseConfigurationToComplete(t, jenkins)
|
||||
|
||||
verifyJenkinsMasterPodAttributes(t, jenkins)
|
||||
|
|
|
|||
Loading…
Reference in New Issue