From a46cfe5d1ee2732644b945d7f1922379129d762c Mon Sep 17 00:00:00 2001 From: TommyStarK Date: Thu, 5 Jan 2023 11:31:49 +0100 Subject: [PATCH] test/e2e: Replace deprecated pointer function Signed-off-by: TommyStarK --- .../apimachinery/crd_conversion_webhook.go | 8 +++---- test/e2e/common/node/lease.go | 24 +++++++++---------- test/e2e/framework/pod/utils.go | 10 ++++---- test/e2e/network/ingressclass.go | 6 ++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/e2e/apimachinery/crd_conversion_webhook.go b/test/e2e/apimachinery/crd_conversion_webhook.go index 431278f5eb3..9e309e9f89f 100644 --- a/test/e2e/apimachinery/crd_conversion_webhook.go +++ b/test/e2e/apimachinery/crd_conversion_webhook.go @@ -149,8 +149,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Privileged:ClusterAdmin]", Service: &apiextensionsv1.ServiceReference{ Namespace: f.Namespace.Name, Name: serviceCRDName, - Path: pointer.StringPtr("/crdconvert"), - Port: pointer.Int32Ptr(servicePort), + Path: pointer.String("/crdconvert"), + Port: pointer.Int32(servicePort), }, }, ConversionReviewVersions: []string{"v1", "v1beta1"}, @@ -184,8 +184,8 @@ var _ = SIGDescribe("CustomResourceConversionWebhook [Privileged:ClusterAdmin]", Service: &apiextensionsv1.ServiceReference{ Namespace: f.Namespace.Name, Name: serviceCRDName, - Path: pointer.StringPtr("/crdconvert"), - Port: pointer.Int32Ptr(servicePort), + Path: pointer.String("/crdconvert"), + Port: pointer.Int32(servicePort), }, }, ConversionReviewVersions: []string{"v1", "v1beta1"}, diff --git a/test/e2e/common/node/lease.go b/test/e2e/common/node/lease.go index b3f3a6250b6..2582339704d 100644 --- a/test/e2e/common/node/lease.go +++ b/test/e2e/common/node/lease.go @@ -78,11 +78,11 @@ var _ = SIGDescribe("Lease", func() { Name: name, }, Spec: coordinationv1.LeaseSpec{ - HolderIdentity: pointer.StringPtr("holder"), - LeaseDurationSeconds: pointer.Int32Ptr(30), + HolderIdentity: pointer.String("holder"), + LeaseDurationSeconds: pointer.Int32(30), AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(2 * time.Second)}, RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(5 * time.Second)}, - LeaseTransitions: pointer.Int32Ptr(0), + LeaseTransitions: pointer.Int32(0), }, } @@ -96,11 +96,11 @@ var _ = SIGDescribe("Lease", func() { } createdLease.Spec = coordinationv1.LeaseSpec{ - HolderIdentity: pointer.StringPtr("holder2"), - LeaseDurationSeconds: pointer.Int32Ptr(30), + HolderIdentity: pointer.String("holder2"), + LeaseDurationSeconds: pointer.Int32(30), AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(20 * time.Second)}, RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(50 * time.Second)}, - LeaseTransitions: pointer.Int32Ptr(1), + LeaseTransitions: pointer.Int32(1), } _, err = leaseClient.Update(ctx, createdLease, metav1.UpdateOptions{}) @@ -114,11 +114,11 @@ var _ = SIGDescribe("Lease", func() { patchedLease := readLease.DeepCopy() patchedLease.Spec = coordinationv1.LeaseSpec{ - HolderIdentity: pointer.StringPtr("holder3"), - LeaseDurationSeconds: pointer.Int32Ptr(60), + HolderIdentity: pointer.String("holder3"), + LeaseDurationSeconds: pointer.Int32(60), AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(50 * time.Second)}, RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(70 * time.Second)}, - LeaseTransitions: pointer.Int32Ptr(2), + LeaseTransitions: pointer.Int32(2), } patchBytes, err := getPatchBytes(readLease, patchedLease) framework.ExpectNoError(err, "creating patch failed") @@ -139,11 +139,11 @@ var _ = SIGDescribe("Lease", func() { Labels: map[string]string{"deletecollection": "true"}, }, Spec: coordinationv1.LeaseSpec{ - HolderIdentity: pointer.StringPtr("holder"), - LeaseDurationSeconds: pointer.Int32Ptr(30), + HolderIdentity: pointer.String("holder"), + LeaseDurationSeconds: pointer.Int32(30), AcquireTime: &metav1.MicroTime{Time: time.Time{}.Add(2 * time.Second)}, RenewTime: &metav1.MicroTime{Time: time.Time{}.Add(5 * time.Second)}, - LeaseTransitions: pointer.Int32Ptr(0), + LeaseTransitions: pointer.Int32(0), }, } _, err = leaseClient.Create(ctx, lease2, metav1.CreateOptions{}) diff --git a/test/e2e/framework/pod/utils.go b/test/e2e/framework/pod/utils.go index a62c29a62d7..371d601fa8c 100644 --- a/test/e2e/framework/pod/utils.go +++ b/test/e2e/framework/pod/utils.go @@ -141,14 +141,14 @@ const DefaultNonRootUserName = "ContainerUser" // Tests that require a specific user ID should override this. func GetRestrictedPodSecurityContext() *v1.PodSecurityContext { psc := &v1.PodSecurityContext{ - RunAsNonRoot: pointer.BoolPtr(true), + RunAsNonRoot: pointer.Bool(true), RunAsUser: GetDefaultNonRootUser(), SeccompProfile: &v1.SeccompProfile{Type: v1.SeccompProfileTypeRuntimeDefault}, } if NodeOSDistroIs("windows") { psc.WindowsOptions = &v1.WindowsSecurityContextOptions{} - psc.WindowsOptions.RunAsUserName = pointer.StringPtr(DefaultNonRootUserName) + psc.WindowsOptions.RunAsUserName = pointer.String(DefaultNonRootUserName) } return psc @@ -157,7 +157,7 @@ func GetRestrictedPodSecurityContext() *v1.PodSecurityContext { // GetRestrictedContainerSecurityContext returns a minimal restricted container security context. func GetRestrictedContainerSecurityContext() *v1.SecurityContext { return &v1.SecurityContext{ - AllowPrivilegeEscalation: pointer.BoolPtr(false), + AllowPrivilegeEscalation: pointer.Bool(false), Capabilities: &v1.Capabilities{Drop: []v1.Capability{"ALL"}}, } } @@ -181,7 +181,7 @@ func MixinRestrictedPodSecurity(pod *v1.Pod) error { pod.Spec.SecurityContext = GetRestrictedPodSecurityContext() } else { if pod.Spec.SecurityContext.RunAsNonRoot == nil { - pod.Spec.SecurityContext.RunAsNonRoot = pointer.BoolPtr(true) + pod.Spec.SecurityContext.RunAsNonRoot = pointer.Bool(true) } if pod.Spec.SecurityContext.RunAsUser == nil { pod.Spec.SecurityContext.RunAsUser = GetDefaultNonRootUser() @@ -191,7 +191,7 @@ func MixinRestrictedPodSecurity(pod *v1.Pod) error { } if NodeOSDistroIs("windows") && pod.Spec.SecurityContext.WindowsOptions == nil { pod.Spec.SecurityContext.WindowsOptions = &v1.WindowsSecurityContextOptions{} - pod.Spec.SecurityContext.WindowsOptions.RunAsUserName = pointer.StringPtr(DefaultNonRootUserName) + pod.Spec.SecurityContext.WindowsOptions.RunAsUserName = pointer.String(DefaultNonRootUserName) } } for i := range pod.Spec.Containers { diff --git a/test/e2e/network/ingressclass.go b/test/e2e/network/ingressclass.go index 393116ae2a3..5bfeebf5410 100644 --- a/test/e2e/network/ingressclass.go +++ b/test/e2e/network/ingressclass.go @@ -176,11 +176,11 @@ var _ = common.SIGDescribe("IngressClass [Feature:Ingress]", func() { Spec: networkingv1.IngressClassSpec{ Controller: "example.com/controller", Parameters: &networkingv1.IngressClassParametersReference{ - Scope: utilpointer.StringPtr("Namespace"), - Namespace: utilpointer.StringPtr("foo-ns"), + Scope: utilpointer.String("Namespace"), + Namespace: utilpointer.String("foo-ns"), Kind: "fookind", Name: "fooname", - APIGroup: utilpointer.StringPtr("example.com"), + APIGroup: utilpointer.String("example.com"), }, }, }