@@ -2,6 +2,7 @@ package test
22
33import (
44 "context"
5+ "fmt"
56 "os"
67 "testing"
78
@@ -16,6 +17,7 @@ import (
1617 imagev1 "github.com/openshift/api/image/v1"
1718 routev1 "github.com/openshift/api/route/v1"
1819 monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
20+ corev1 "k8s.io/api/core/v1"
1921 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2022 "k8s.io/apimachinery/pkg/runtime"
2123 "k8s.io/apimachinery/pkg/types"
@@ -76,6 +78,23 @@ func TestAPIManagerControllerCreate(t *testing.T) {
7678 t .Fatal (err )
7779 }
7880
81+ // Define the secret
82+ systemappSecret := & corev1.Secret {
83+ ObjectMeta : metav1.ObjectMeta {
84+ Name : "system-database" ,
85+ Namespace : namespace ,
86+ },
87+ StringData : map [string ]string {
88+ "DB_USER" : "mysql" ,
89+ "DB_PASSWORD" : "password" ,
90+ "DB_ROOT_PASSWORD" : "rootpassword" ,
91+ "URL" : fmt .Sprintf ("mysql2://root:rootpassword@system-mysql.%s.svc.cluster.local/dev" , namespace ),
92+ },
93+ Type : corev1 .SecretTypeOpaque ,
94+ }
95+
96+ objs = append (objs , systemappSecret )
97+
7998 // Create a fake client to mock API calls.
8099 cl := fake .NewClientBuilder ().WithScheme (s ).WithRuntimeObjects (objs ... ).WithStatusSubresource (apimanager ).Build ()
81100 clientAPIReader := fake .NewClientBuilder ().WithScheme (s ).WithRuntimeObjects (objs ... ).WithStatusSubresource (apimanager ).Build ()
@@ -110,7 +129,6 @@ func TestAPIManagerControllerCreate(t *testing.T) {
110129
111130 if finalAPIManager .Annotations == nil {
112131 t .Error ("APIManager's does not have annotations" )
113-
114132 }
115133
116134 if val , ok := finalAPIManager .Annotations [appsv1alpha1 .OperatorVersionAnnotation ]; ! ok || val != version .Version {
0 commit comments