@@ -96,16 +96,14 @@ func TestRedisDeploymentOptions(t *testing.T) {
96
96
assert .NilError (subT , err )
97
97
assert .DeepEqual (subT , options ,
98
98
DeploymentStorageOptions {
99
- Command : []string {"redis" , "$(URL )" },
99
+ Command : []string {"redis" , "$(LIMITADOR_OPERATOR_REDIS_URL )" },
100
100
},
101
101
)
102
102
})
103
103
}
104
104
105
105
func TestDeploymentEnvVar (t * testing.T ) {
106
106
type args struct {
107
- ctx context.Context
108
- cl client.Client
109
107
defSecretNamespace string
110
108
configSecretRef * v1.ObjectReference
111
109
}
@@ -122,30 +120,11 @@ func TestDeploymentEnvVar(t *testing.T) {
122
120
wantErr : true ,
123
121
error : "there's no ConfigSecretRef set" ,
124
122
},
125
- {
126
- name : "Getting URL from Redis Secret fails" ,
127
- want : nil ,
128
- wantErr : true ,
129
- error : "doesn't have the `URL` field" ,
130
- args : args {
131
- ctx : context .TODO (),
132
- cl : fake .NewClientBuilder ().WithObjects (& v1.Secret {
133
- ObjectMeta : metav1.ObjectMeta {
134
- Name : "test" ,
135
- Namespace : "test" ,
136
- },
137
- }).Build (),
138
- defSecretNamespace : "test" ,
139
- configSecretRef : & v1.ObjectReference {
140
- Name : "test" ,
141
- },
142
- },
143
- },
144
123
{
145
124
name : "Receive correct Env settings" ,
146
125
want : []v1.EnvVar {
147
126
{
148
- Name : "URL " ,
127
+ Name : "LIMITADOR_OPERATOR_REDIS_URL " ,
149
128
ValueFrom : & v1.EnvVarSource {
150
129
SecretKeyRef : & v1.SecretKeySelector {
151
130
LocalObjectReference : v1.LocalObjectReference {
@@ -158,16 +137,6 @@ func TestDeploymentEnvVar(t *testing.T) {
158
137
},
159
138
wantErr : false ,
160
139
args : args {
161
- ctx : context .TODO (),
162
- cl : fake .NewClientBuilder ().WithObjects (& v1.Secret {
163
- ObjectMeta : metav1.ObjectMeta {
164
- Name : "test" ,
165
- Namespace : "test" ,
166
- },
167
- Data : map [string ][]byte {
168
- "URL" : []byte ("cmVkaXM6Ly9yZWRpcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsLzA=" ),
169
- },
170
- }).Build (),
171
140
defSecretNamespace : "test" ,
172
141
configSecretRef : & v1.ObjectReference {
173
142
Name : "test" ,
@@ -177,7 +146,7 @@ func TestDeploymentEnvVar(t *testing.T) {
177
146
}
178
147
for _ , tt := range tests {
179
148
t .Run (tt .name , func (t * testing.T ) {
180
- got , err := DeploymentEnvVar (tt .args .ctx , tt . args . cl , tt . args . defSecretNamespace , tt .args .configSecretRef )
149
+ got , err := DeploymentEnvVar (tt .args .defSecretNamespace , tt .args .configSecretRef )
181
150
if (err != nil ) != tt .wantErr {
182
151
t .Errorf ("DeploymentEnvVar() error = %v, wantErr %v" , err , tt .wantErr )
183
152
return
0 commit comments