#197 Improve checking the ImagePullSecret

This commit is contained in:
Tomasz Sęk
2019-12-25 14:40:46 +01:00
parent 2fd1784461
commit 33c3d47cee
9 changed files with 79 additions and 33 deletions
+3 -4
View File
@@ -9,7 +9,6 @@ import (
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/configuration/base/resources"
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/constants"
framework "github.com/operator-framework/operator-sdk/pkg/test"
"k8s.io/api/core/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -32,7 +31,7 @@ func getJenkins(t *testing.T, namespace, name string) *v1alpha2.Jenkins {
return jenkins
}
func getJenkinsMasterPod(t *testing.T, jenkins *v1alpha2.Jenkins) *v1.Pod {
func getJenkinsMasterPod(t *testing.T, jenkins *v1alpha2.Jenkins) *corev1.Pod {
lo := metav1.ListOptions{
LabelSelector: labels.SelectorFromSet(resources.BuildResourceLabels(jenkins)).String(),
}
@@ -47,7 +46,7 @@ func getJenkinsMasterPod(t *testing.T, jenkins *v1alpha2.Jenkins) *v1.Pod {
}
func createJenkinsAPIClient(jenkins *v1alpha2.Jenkins, hostname string, port int, useNodePort bool) (jenkinsclient.Jenkins, error) {
adminSecret := &v1.Secret{}
adminSecret := &corev1.Secret{}
namespaceName := types.NamespacedName{Namespace: jenkins.Namespace, Name: resources.GetOperatorCredentialsSecretName(jenkins)}
if err := framework.Global.Client.Get(context.TODO(), namespaceName, adminSecret); err != nil {
return nil, err
@@ -97,7 +96,7 @@ func createJenkinsCR(t *testing.T, name, namespace string, seedJob *[]v1alpha2.S
Containers: []v1alpha2.Container{
{
Name: resources.JenkinsMasterContainerName,
Env: []v1.EnvVar{
Env: []corev1.EnvVar{
{
Name: "TEST_ENV",
Value: "test_env_value",
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2"
"github.com/jenkinsci/kubernetes-operator/pkg/controller/jenkins/constants"
f "github.com/operator-framework/operator-sdk/pkg/test"
framework "github.com/operator-framework/operator-sdk/pkg/test"
"github.com/operator-framework/operator-sdk/pkg/test/e2eutil"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -35,7 +34,7 @@ func TestMain(m *testing.M) {
port = flag.Int(portParameterName, -1, "The port on which Jenkins API is working. Note: If you want to use nodePort don't set this setting and --jenkins-api-use-nodeport must be false.")
useNodePort = flag.Bool(nodePortParameterName, false, "Connect to Jenkins API using the nodePort instead of service port. If you want to set this as true - don't set --jenkins-api-port.")
f.MainEntry(m)
framework.MainEntry(m)
}
func setupTest(t *testing.T) (string, *framework.TestCtx) {