@@ -3,11 +3,12 @@ package utils
3
3
import (
4
4
"context"
5
5
"fmt"
6
- appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1"
7
6
"reflect"
8
7
"strings"
9
8
"testing"
10
9
10
+ appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1"
11
+
11
12
"github.com/application-stacks/runtime-component-operator/common"
12
13
13
14
routev1 "github.com/openshift/api/route/v1"
@@ -166,7 +167,7 @@ func TestGetDiscoveryClient(t *testing.T) {
166
167
logger := zap .New ()
167
168
logf .SetLogger (logger )
168
169
169
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
170
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
170
171
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
171
172
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
172
173
cl := fakeclient .NewFakeClient (objs ... )
@@ -186,7 +187,7 @@ func TestCreateOrUpdate(t *testing.T) {
186
187
logf .SetLogger (logger )
187
188
serviceAccount := & corev1.ServiceAccount {ObjectMeta : defaultMeta }
188
189
189
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
190
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
190
191
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
191
192
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
192
193
cl := fakeclient .NewFakeClient (objs ... )
@@ -207,7 +208,7 @@ func TestDeleteResources(t *testing.T) {
207
208
logger := zap .New ()
208
209
logf .SetLogger (logger )
209
210
210
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
211
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
211
212
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
212
213
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
213
214
cl := fakeclient .NewFakeClient (objs ... )
@@ -260,7 +261,7 @@ func TestGetOpConfigMap(t *testing.T) {
260
261
},
261
262
}
262
263
263
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
264
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
264
265
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
265
266
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
266
267
cl := fakeclient .NewFakeClient (objs ... )
@@ -286,7 +287,7 @@ func TestManageError(t *testing.T) {
286
287
logf .SetLogger (logger )
287
288
err := fmt .Errorf ("test-error" )
288
289
289
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
290
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
290
291
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
291
292
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
292
293
cl := fakeclient .NewFakeClient (objs ... )
@@ -307,7 +308,7 @@ func TestManageSuccess(t *testing.T) {
307
308
logger := zap .New ()
308
309
logf .SetLogger (logger )
309
310
310
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
311
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
311
312
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
312
313
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
313
314
cl := fakeclient .NewFakeClient (objs ... )
@@ -326,7 +327,7 @@ func TestIsGroupVersionSupported(t *testing.T) {
326
327
logger := zap .New ()
327
328
logf .SetLogger (logger )
328
329
329
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
330
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
330
331
objs , s := []runtime.Object {runtimecomponent }, scheme .Scheme
331
332
s .AddKnownTypes (appstacksv1 .GroupVersion , runtimecomponent )
332
333
cl := fakeclient .NewFakeClient (objs ... )
@@ -363,7 +364,7 @@ func TestIsGroupVersionSupported(t *testing.T) {
363
364
func testGetSvcTLSValues (t * testing.T ) {
364
365
// Configure the runtime component
365
366
366
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
367
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
367
368
expose := true
368
369
runtimecomponent .Spec .Expose = & expose
369
370
runtimecomponent .Spec .Service = & appstacksv1.RuntimeComponentService {
@@ -404,7 +405,7 @@ func testGetSvcTLSValues(t *testing.T) {
404
405
// testGetRouteTLSValues test the function GetRouteTLSValues in reconciler.go.
405
406
func testGetRouteTLSValues (t * testing.T ) {
406
407
// Configure the rumtime component
407
- runtimecomponent := createRuntimeComponent (name , namespace , spec )
408
+ runtimecomponent := createRuntimeComponent (objMeta , spec )
408
409
terminationPolicy := routev1 .TLSTerminationReencrypt
409
410
secretRefName := "my-app-route-tls"
410
411
runtimecomponent .Spec .Expose = & expose
0 commit comments