Skip to content

Commit

Permalink
test/integration: Replace deprecated pointer function
Browse files Browse the repository at this point in the history
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
  • Loading branch information
TommyStarK committed Jan 5, 2023
1 parent 7fd0ff5 commit 9e885bc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions test/integration/auth/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ func TestNodeAuthorizer(t *testing.T) {
Name: "node1",
},
Spec: coordination.LeaseSpec{
HolderIdentity: pointer.StringPtr("node1"),
LeaseDurationSeconds: pointer.Int32Ptr(node1LeaseDurationSeconds),
HolderIdentity: pointer.String("node1"),
LeaseDurationSeconds: pointer.Int32(node1LeaseDurationSeconds),
RenewTime: &metav1.MicroTime{Time: time.Now()},
},
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/controlplane/apiserver_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ func newTestLease(acquireTime time.Time, namespace string) *coordinationv1.Lease
},
},
Spec: coordinationv1.LeaseSpec{
HolderIdentity: pointer.StringPtr(testLeaseName),
LeaseDurationSeconds: pointer.Int32Ptr(3600),
HolderIdentity: pointer.String(testLeaseName),
LeaseDurationSeconds: pointer.Int32(3600),
AcquireTime: &metav1.MicroTime{Time: acquireTime},
RenewTime: &metav1.MicroTime{Time: acquireTime},
},
Expand Down
20 changes: 10 additions & 10 deletions test/integration/service/loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
AllocateLoadBalancerNodePorts: utilpointer.BoolPtr(false),
AllocateLoadBalancerNodePorts: utilpointer.Bool(false),
Ports: []corev1.ServicePort{{
Port: int32(80),
}},
Expand Down Expand Up @@ -113,7 +113,7 @@ func Test_ServiceUpdateLoadBalancerDisableAllocateNodePorts(t *testing.T) {
}

service.Spec.Type = corev1.ServiceTypeLoadBalancer
service.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(false)
service.Spec.AllocateLoadBalancerNodePorts = utilpointer.Bool(false)
service, err = client.CoreV1().Services(ns.Name).Update(context.TODO(), service, metav1.UpdateOptions{})
if err != nil {
t.Fatalf("Error updating test service: %v", err)
Expand Down Expand Up @@ -144,7 +144,7 @@ func Test_ServiceLoadBalancerEnableThenDisableAllocatedNodePorts(t *testing.T) {
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
AllocateLoadBalancerNodePorts: utilpointer.BoolPtr(true),
AllocateLoadBalancerNodePorts: utilpointer.Bool(true),
Ports: []corev1.ServicePort{{
Port: int32(80),
}},
Expand All @@ -163,7 +163,7 @@ func Test_ServiceLoadBalancerEnableThenDisableAllocatedNodePorts(t *testing.T) {
t.Error("expected node ports but found none")
}

service.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(false)
service.Spec.AllocateLoadBalancerNodePorts = utilpointer.Bool(false)
service, err = client.CoreV1().Services(ns.Name).Update(context.TODO(), service, metav1.UpdateOptions{})
if err != nil {
t.Fatalf("Error updating test service: %v", err)
Expand Down Expand Up @@ -194,7 +194,7 @@ func Test_ServiceLoadBalancerDisableThenEnableAllocatedNodePorts(t *testing.T) {
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
AllocateLoadBalancerNodePorts: utilpointer.BoolPtr(false),
AllocateLoadBalancerNodePorts: utilpointer.Bool(false),
Ports: []corev1.ServicePort{{
Port: int32(80),
}},
Expand All @@ -213,7 +213,7 @@ func Test_ServiceLoadBalancerDisableThenEnableAllocatedNodePorts(t *testing.T) {
t.Error("not expected node ports but found one")
}

service.Spec.AllocateLoadBalancerNodePorts = utilpointer.BoolPtr(true)
service.Spec.AllocateLoadBalancerNodePorts = utilpointer.Bool(true)
service, err = client.CoreV1().Services(ns.Name).Update(context.TODO(), service, metav1.UpdateOptions{})
if err != nil {
t.Fatalf("Error updating test service: %v", err)
Expand Down Expand Up @@ -264,7 +264,7 @@ func Test_ServiceLoadBalancerEnableLoadBalancerClass(t *testing.T) {
Ports: []corev1.ServicePort{{
Port: int32(80),
}},
LoadBalancerClass: utilpointer.StringPtr("test.com/test"),
LoadBalancerClass: utilpointer.String("test.com/test"),
},
}

Expand Down Expand Up @@ -310,7 +310,7 @@ func Test_SetLoadBalancerClassThenUpdateLoadBalancerClass(t *testing.T) {
Ports: []corev1.ServicePort{{
Port: int32(80),
}},
LoadBalancerClass: utilpointer.StringPtr("test.com/test"),
LoadBalancerClass: utilpointer.String("test.com/test"),
},
}

Expand All @@ -319,7 +319,7 @@ func Test_SetLoadBalancerClassThenUpdateLoadBalancerClass(t *testing.T) {
t.Fatalf("Error creating test service: %v", err)
}

service.Spec.LoadBalancerClass = utilpointer.StringPtr("test.com/update")
service.Spec.LoadBalancerClass = utilpointer.String("test.com/update")
_, err = client.CoreV1().Services(ns.Name).Update(ctx, service, metav1.UpdateOptions{})
if err == nil {
t.Fatal("Error: updating test service load balancer class should throw error, field is immutable")
Expand Down Expand Up @@ -369,7 +369,7 @@ func Test_UpdateLoadBalancerWithLoadBalancerClass(t *testing.T) {
t.Fatalf("Error creating test service: %v", err)
}

service.Spec.LoadBalancerClass = utilpointer.StringPtr("test.com/test")
service.Spec.LoadBalancerClass = utilpointer.String("test.com/test")
_, err = client.CoreV1().Services(ns.Name).Update(ctx, service, metav1.UpdateOptions{})
if err == nil {
t.Fatal("Error: updating test service load balancer class should throw error, field is immutable")
Expand Down
10 changes: 5 additions & 5 deletions test/integration/storageversion/gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestStorageVersionGarbageCollection(t *testing.T) {
t.Errorf("unexpected storage version entry id, expected %v, got: %v",
expectedID, sv.Status.StorageVersions[0].APIServerID)
}
assertCommonEncodingVersion(t, kubeclient, pointer.StringPtr(idToVersion(t, idA)))
assertCommonEncodingVersion(t, kubeclient, pointer.String(idToVersion(t, idA)))
if err := kubeclient.InternalV1alpha1().StorageVersions().Delete(
context.TODO(), svName, metav1.DeleteOptions{}); err != nil {
t.Fatalf("failed to cleanup valid storage version: %v", err)
Expand All @@ -108,7 +108,7 @@ func TestStorageVersionGarbageCollection(t *testing.T) {
assertCommonEncodingVersion(t, kubeclient, nil)
deleteTestAPIServerIdentityLease(t, kubeclient, idA)
assertStorageVersionEntries(t, kubeclient, 1, idB)
assertCommonEncodingVersion(t, kubeclient, pointer.StringPtr(idToVersion(t, idB)))
assertCommonEncodingVersion(t, kubeclient, pointer.String(idToVersion(t, idB)))
})

t.Run("deleting an id should delete a storage version object that it owns entirely", func(t *testing.T) {
Expand All @@ -135,7 +135,7 @@ func createTestStorageVersion(t *testing.T, client kubernetes.Interface, ids ...
// every id is unique and creates a different version. We know we have a common encoding
// version when there is only one id. Pick it
if len(ids) == 1 {
sv.Status.CommonEncodingVersion = pointer.StringPtr(sv.Status.StorageVersions[0].EncodingVersion)
sv.Status.CommonEncodingVersion = pointer.String(sv.Status.StorageVersions[0].EncodingVersion)
}

createdSV, err := client.InternalV1alpha1().StorageVersions().Create(context.TODO(), sv, metav1.CreateOptions{})
Expand Down Expand Up @@ -176,8 +176,8 @@ func createTestAPIServerIdentityLease(t *testing.T, client kubernetes.Interface,
},
},
Spec: coordinationv1.LeaseSpec{
HolderIdentity: pointer.StringPtr(name),
LeaseDurationSeconds: pointer.Int32Ptr(3600),
HolderIdentity: pointer.String(name),
LeaseDurationSeconds: pointer.Int32(3600),
// create fresh leases
AcquireTime: &metav1.MicroTime{Time: time.Now()},
RenewTime: &metav1.MicroTime{Time: time.Now()},
Expand Down
2 changes: 1 addition & 1 deletion test/integration/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func InitTestSchedulerWithNS(t *testing.T, nsPrefix string, opts ...scheduler.Op
func InitTestDisablePreemption(t *testing.T, nsPrefix string) *TestContext {
cfg := configtesting.V1beta3ToInternalWithDefaults(t, v1beta3.KubeSchedulerConfiguration{
Profiles: []v1beta3.KubeSchedulerProfile{{
SchedulerName: pointer.StringPtr(v1.DefaultSchedulerName),
SchedulerName: pointer.String(v1.DefaultSchedulerName),
Plugins: &v1beta3.Plugins{
PostFilter: v1beta3.PluginSet{
Disabled: []v1beta3.Plugin{
Expand Down

0 comments on commit 9e885bc

Please sign in to comment.