Skip to content

Commit 2a458e6

Browse files
committed
Replace GetInt32Pointer uses with generic GetPointer
1 parent 7092665 commit 2a458e6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

internal/mode/static/state/graph/graph_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestBuildGraph(t *testing.T) {
6666
Kind: (*v1beta1.Kind)(helpers.GetStringPointer("Service")),
6767
Name: "foo",
6868
Namespace: (*v1beta1.Namespace)(helpers.GetStringPointer("service")),
69-
Port: (*v1beta1.PortNumber)(helpers.GetInt32Pointer(80)),
69+
Port: (*v1beta1.PortNumber)(helpers.GetPointer(int32(80))),
7070
},
7171
},
7272
},

internal/mode/static/state/relationship/relationships_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestGetBackendServiceNamesFromRoute(t *testing.T) {
2020
Kind: (*v1beta1.Kind)(helpers.GetStringPointer("Service")),
2121
Name: svcName,
2222
Namespace: (*v1beta1.Namespace)(helpers.GetStringPointer("test")),
23-
Port: (*v1beta1.PortNumber)(helpers.GetInt32Pointer(80)),
23+
Port: (*v1beta1.PortNumber)(helpers.GetPointer(int32(80))),
2424
},
2525
},
2626
},
@@ -94,7 +94,7 @@ func TestGetBackendServiceNamesFromRoute(t *testing.T) {
9494
helpers.GetStringPointer("test"),
9595
),
9696
Port: (*v1beta1.PortNumber)(
97-
helpers.GetInt32Pointer(80),
97+
helpers.GetPointer(int32(80)),
9898
),
9999
},
100100
},

internal/mode/static/state/resolver/resolver_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var (
3434
Ports: []discoveryV1.EndpointPort{
3535
{
3636
Name: &svcPortName,
37-
Port: helpers.GetInt32Pointer(80),
37+
Port: helpers.GetPointer(int32(80)),
3838
},
3939
},
4040
}
@@ -54,7 +54,7 @@ var (
5454
Ports: []discoveryV1.EndpointPort{
5555
{
5656
Name: &svcPortName,
57-
Port: helpers.GetInt32Pointer(80),
57+
Port: helpers.GetPointer(int32(80)),
5858
},
5959
},
6060
}
@@ -65,7 +65,7 @@ var (
6565
Ports: []discoveryV1.EndpointPort{
6666
{
6767
Name: &svcPortName,
68-
Port: helpers.GetInt32Pointer(80),
68+
Port: helpers.GetPointer(int32(80)),
6969
},
7070
},
7171
}
@@ -76,7 +76,7 @@ var (
7676
Ports: []discoveryV1.EndpointPort{
7777
{
7878
Name: helpers.GetStringPointer("other-svc-port"),
79-
Port: helpers.GetInt32Pointer(8080),
79+
Port: helpers.GetPointer(int32(8080)),
8080
},
8181
},
8282
}
@@ -387,7 +387,7 @@ func TestFindPort(t *testing.T) {
387387
ports: []discoveryV1.EndpointPort{
388388
{
389389
Name: nil,
390-
Port: helpers.GetInt32Pointer(8080),
390+
Port: helpers.GetPointer(int32(8080)),
391391
},
392392
},
393393
svcPort: v1.ServicePort{
@@ -402,15 +402,15 @@ func TestFindPort(t *testing.T) {
402402
ports: []discoveryV1.EndpointPort{
403403
{
404404
Name: helpers.GetStringPointer("other-svc-port"),
405-
Port: helpers.GetInt32Pointer(8080),
405+
Port: helpers.GetPointer(int32(8080)),
406406
},
407407
{
408408
Name: helpers.GetStringPointer("other-svc-port2"),
409-
Port: helpers.GetInt32Pointer(8081),
409+
Port: helpers.GetPointer(int32(8081)),
410410
},
411411
{
412412
Name: helpers.GetStringPointer("other-svc-port3"),
413-
Port: helpers.GetInt32Pointer(8082),
413+
Port: helpers.GetPointer(int32(8082)),
414414
},
415415
},
416416
svcPort: v1.ServicePort{
@@ -425,15 +425,15 @@ func TestFindPort(t *testing.T) {
425425
ports: []discoveryV1.EndpointPort{
426426
{
427427
Name: helpers.GetStringPointer("other-svc-port"),
428-
Port: helpers.GetInt32Pointer(8080),
428+
Port: helpers.GetPointer(int32(8080)),
429429
},
430430
{
431431
Name: helpers.GetStringPointer("other-svc-port2"),
432-
Port: helpers.GetInt32Pointer(8081),
432+
Port: helpers.GetPointer(int32(8081)),
433433
},
434434
{
435435
Name: &svcPortName, // match
436-
Port: helpers.GetInt32Pointer(8082),
436+
Port: helpers.GetPointer(int32(8082)),
437437
},
438438
},
439439
svcPort: v1.ServicePort{
@@ -449,7 +449,7 @@ func TestFindPort(t *testing.T) {
449449
{
450450
// If a service port is unnamed (empty string), then the endpoint port will also be empty string.
451451
Name: helpers.GetStringPointer(""),
452-
Port: helpers.GetInt32Pointer(8080),
452+
Port: helpers.GetPointer(int32(8080)),
453453
},
454454
},
455455
svcPort: v1.ServicePort{

0 commit comments

Comments
 (0)