#190 Allow set quay.io/openshift/origin-jenkins image in e2e tests

This commit is contained in:
Tomasz Sęk 2020-03-22 19:29:56 +01:00
parent c1c301ec79
commit cc35dcfc72
No known key found for this signature in database
GPG Key ID: DC356D23F6A644D0
3 changed files with 45 additions and 0 deletions

13
test/e2e/cr.go Normal file
View File

@ -0,0 +1,13 @@
// +build !OpenShift
package e2e
import (
"testing"
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
)
func updateJenkinsCR(t *testing.T, jenkins *v1alpha2.Jenkins) {
// do nothing
}

31
test/e2e/cr_openshift.go Normal file
View File

@ -0,0 +1,31 @@
// +build OpenShift
package e2e
import (
"testing"
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/configuration/base/resources"
corev1 "k8s.io/api/core/v1"
)
func updateJenkinsCR(t *testing.T, jenkins *v1alpha2.Jenkins) {
jenkins.Spec.Master.Containers[0].Image = "quay.io/openshift/origin-jenkins"
jenkins.Spec.Master.Containers[0].Command = []string{
"bash",
"-c",
"/var/jenkins/scripts/init.sh && exec /usr/bin/go-init -main /usr/libexec/s2i/run",
}
jenkins.Spec.Master.Containers[0].Env = append(jenkins.Spec.Master.Containers[0].Env,
corev1.EnvVar{
Name: "JENKINS_SERVICE_NAME",
Value: resources.GetJenkinsHTTPServiceName(jenkins),
},
corev1.EnvVar{
Name: "JNLP_SERVICE_NAME",
Value: resources.GetJenkinsSlavesServiceName(jenkins),
},
)
}

View File

@ -168,6 +168,7 @@ func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.S
Name: resources.GetResourceName(jenkins), Name: resources.GetResourceName(jenkins),
}, },
} }
updateJenkinsCR(t, jenkins)
t.Logf("Jenkins CR %+v", *jenkins) t.Logf("Jenkins CR %+v", *jenkins)
if err := framework.Global.Client.Create(context.TODO(), jenkins, nil); err != nil { if err := framework.Global.Client.Create(context.TODO(), jenkins, nil); err != nil {