@@ -19,29 +19,20 @@ import (
19
19
"testing"
20
20
21
21
baremetal "github.com/oracle/bmcs-go-sdk"
22
+ "github.com/oracle/oci-go-sdk/common"
23
+ "github.com/oracle/oci-go-sdk/core"
22
24
23
25
"k8s.io/api/core/v1"
24
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25
27
v1listers "k8s.io/client-go/listers/core/v1"
26
28
"k8s.io/client-go/tools/cache"
27
29
)
28
30
29
- func TestGetBackendPort (t * testing.T ) {
30
- backends := []baremetal.Backend {
31
- {Port : 80 },
32
- }
33
-
34
- port := getBackendPort (backends )
35
- if port != 80 {
36
- t .Errorf ("expected port 80 but got %d" , port )
37
- }
38
- }
39
-
40
31
func TestGetNodeIngressRules (t * testing.T ) {
41
32
testCases := []struct {
42
33
name string
43
34
securityList * baremetal.SecurityList
44
- lbSubnets []* baremetal .Subnet
35
+ lbSubnets []* core .Subnet
45
36
port uint64
46
37
services []* v1.Service
47
38
expected []baremetal.IngressSecurityRule
@@ -53,9 +44,9 @@ func TestGetNodeIngressRules(t *testing.T) {
53
44
makeIngressSecurityRule ("existing" , 9000 ),
54
45
},
55
46
},
56
- lbSubnets : []* baremetal .Subnet {
57
- {CIDRBlock : "1" },
58
- {CIDRBlock : "2" },
47
+ lbSubnets : []* core .Subnet {
48
+ {CidrBlock : common . String ( "1" ) },
49
+ {CidrBlock : common . String ( "2" ) },
59
50
},
60
51
port : 80 ,
61
52
services : []* v1.Service {},
@@ -73,9 +64,9 @@ func TestGetNodeIngressRules(t *testing.T) {
73
64
makeIngressSecurityRule ("2" , 80 ),
74
65
},
75
66
},
76
- lbSubnets : []* baremetal .Subnet {
77
- {CIDRBlock : "1" },
78
- {CIDRBlock : "2" },
67
+ lbSubnets : []* core .Subnet {
68
+ {CidrBlock : common . String ( "1" ) },
69
+ {CidrBlock : common . String ( "2" ) },
79
70
},
80
71
port : 80 ,
81
72
services : []* v1.Service {},
@@ -94,9 +85,9 @@ func TestGetNodeIngressRules(t *testing.T) {
94
85
makeIngressSecurityRule ("existing" , 9001 ),
95
86
},
96
87
},
97
- lbSubnets : []* baremetal .Subnet {
98
- {CIDRBlock : "1" },
99
- {CIDRBlock : "3" },
88
+ lbSubnets : []* core .Subnet {
89
+ {CidrBlock : common . String ( "1" ) },
90
+ {CidrBlock : common . String ( "3" ) },
100
91
},
101
92
port : 80 ,
102
93
services : []* v1.Service {},
@@ -116,7 +107,7 @@ func TestGetNodeIngressRules(t *testing.T) {
116
107
makeIngressSecurityRule ("existing" , 9001 ),
117
108
},
118
109
},
119
- lbSubnets : []* baremetal .Subnet {},
110
+ lbSubnets : []* core .Subnet {},
120
111
port : 80 ,
121
112
services : []* v1.Service {},
122
113
expected : []baremetal.IngressSecurityRule {
@@ -130,7 +121,7 @@ func TestGetNodeIngressRules(t *testing.T) {
130
121
makeIngressSecurityRule ("0.0.0.0/0" , lbNodesHealthCheckPort ),
131
122
},
132
123
},
133
- lbSubnets : []* baremetal .Subnet {},
124
+ lbSubnets : []* core .Subnet {},
134
125
port : lbNodesHealthCheckPort ,
135
126
services : []* v1.Service {
136
127
{
@@ -295,7 +286,7 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
295
286
testCases := []struct {
296
287
name string
297
288
securityList * baremetal.SecurityList
298
- subnets []* baremetal .Subnet
289
+ subnets []* core .Subnet
299
290
port uint64
300
291
services []* v1.Service
301
292
expected []baremetal.EgressSecurityRule
@@ -307,9 +298,9 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
307
298
makeEgressSecurityRule ("existing" , 9000 ),
308
299
},
309
300
},
310
- subnets : []* baremetal .Subnet {
311
- {CIDRBlock : "1" },
312
- {CIDRBlock : "2" },
301
+ subnets : []* core .Subnet {
302
+ {CidrBlock : common . String ( "1" ) },
303
+ {CidrBlock : common . String ( "2" ) },
313
304
},
314
305
port : 80 ,
315
306
services : []* v1.Service {},
@@ -327,9 +318,9 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
327
318
makeEgressSecurityRule ("2" , 80 ),
328
319
},
329
320
},
330
- subnets : []* baremetal .Subnet {
331
- {CIDRBlock : "1" },
332
- {CIDRBlock : "2" },
321
+ subnets : []* core .Subnet {
322
+ {CidrBlock : common . String ( "1" ) },
323
+ {CidrBlock : common . String ( "2" ) },
333
324
},
334
325
port : 80 ,
335
326
services : []* v1.Service {},
@@ -348,9 +339,9 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
348
339
makeEgressSecurityRule ("existing" , 9001 ),
349
340
},
350
341
},
351
- subnets : []* baremetal .Subnet {
352
- {CIDRBlock : "1" },
353
- {CIDRBlock : "3" },
342
+ subnets : []* core .Subnet {
343
+ {CidrBlock : common . String ( "1" ) },
344
+ {CidrBlock : common . String ( "3" ) },
354
345
},
355
346
port : 80 ,
356
347
services : []* v1.Service {},
@@ -370,7 +361,7 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
370
361
makeEgressSecurityRule ("existing" , 9001 ),
371
362
},
372
363
},
373
- subnets : []* baremetal .Subnet {},
364
+ subnets : []* core .Subnet {},
374
365
port : 80 ,
375
366
services : []* v1.Service {},
376
367
expected : []baremetal.EgressSecurityRule {
@@ -384,7 +375,7 @@ func TestGetLoadBalancerEgressRules(t *testing.T) {
384
375
makeEgressSecurityRule ("0.0.0.0/0" , lbNodesHealthCheckPort ),
385
376
},
386
377
},
387
- subnets : []* baremetal .Subnet {},
378
+ subnets : []* core .Subnet {},
388
379
port : lbNodesHealthCheckPort ,
389
380
services : []* v1.Service {
390
381
{
@@ -538,11 +529,11 @@ func TestDelete(t *testing.T) {
538
529
// lbSubnets := []*baremetal.Subnet{
539
530
// {
540
531
// ID: "lb-subnet-1",
541
- // CIDRBlock : "lb-subnet-1",
532
+ // CidrBlock : "lb-subnet-1",
542
533
// },
543
534
// {
544
535
// ID: "lb-subnet-2",
545
- // CIDRBlock : "lb-subnet-2",
536
+ // CidrBlock : "lb-subnet-2",
546
537
// },
547
538
// }
548
539
// lbSecurityLists := []*baremetal.SecurityList{
0 commit comments