@@ -96,17 +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
- defSecretNamespace string
110
107
configSecretRef * v1.ObjectReference
111
108
}
112
109
tests := []struct {
@@ -122,30 +119,11 @@ func TestDeploymentEnvVar(t *testing.T) {
122
119
wantErr : true ,
123
120
error : "there's no ConfigSecretRef set" ,
124
121
},
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
122
{
145
123
name : "Receive correct Env settings" ,
146
124
want : []v1.EnvVar {
147
125
{
148
- Name : "URL " ,
126
+ Name : "LIMITADOR_OPERATOR_REDIS_URL " ,
149
127
ValueFrom : & v1.EnvVarSource {
150
128
SecretKeyRef : & v1.SecretKeySelector {
151
129
LocalObjectReference : v1.LocalObjectReference {
@@ -158,17 +136,6 @@ func TestDeploymentEnvVar(t *testing.T) {
158
136
},
159
137
wantErr : false ,
160
138
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
- defSecretNamespace : "test" ,
172
139
configSecretRef : & v1.ObjectReference {
173
140
Name : "test" ,
174
141
},
@@ -177,7 +144,7 @@ func TestDeploymentEnvVar(t *testing.T) {
177
144
}
178
145
for _ , tt := range tests {
179
146
t .Run (tt .name , func (t * testing.T ) {
180
- got , err := DeploymentEnvVar (tt .args .ctx , tt . args . cl , tt . args . defSecretNamespace , tt . args . configSecretRef )
147
+ got , err := DeploymentEnvVar (tt .args .configSecretRef )
181
148
if (err != nil ) != tt .wantErr {
182
149
t .Errorf ("DeploymentEnvVar() error = %v, wantErr %v" , err , tt .wantErr )
183
150
return
0 commit comments