pkg/controller: Replace deprecated func usage from the k8s.io/utils/pointer pkg

This commit is contained in:
ialidzhikov
2022-08-14 15:05:49 +03:00
parent deba5619ab
commit aede3fbf40
22 changed files with 486 additions and 486 deletions

View File

@@ -22,9 +22,9 @@ import (
"time"
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilpointer "k8s.io/utils/pointer"
"k8s.io/utils/pointer"
)
func newJob(completionTime, failedTime metav1.Time, ttl *int32) *batch.Job {
@@ -91,7 +91,7 @@ func TestTimeLeft(t *testing.T) {
}{
{
name: "Error case: Job unfinished",
ttl: utilpointer.Int32Ptr(100),
ttl: pointer.Int32(100),
since: &now.Time,
expectErr: true,
expectErrStr: "should not be cleaned up",
@@ -106,7 +106,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job completed now, 0s TTL",
completionTime: now,
ttl: utilpointer.Int32Ptr(0),
ttl: pointer.Int32(0),
since: &now.Time,
expectedTimeLeft: durationPointer(0),
expectedExpireAt: now.Time,
@@ -114,7 +114,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job completed now, 10s TTL",
completionTime: now,
ttl: utilpointer.Int32Ptr(10),
ttl: pointer.Int32(10),
since: &now.Time,
expectedTimeLeft: durationPointer(10),
expectedExpireAt: now.Add(10 * time.Second),
@@ -122,7 +122,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job completed 10s ago, 15s TTL",
completionTime: metav1.NewTime(now.Add(-10 * time.Second)),
ttl: utilpointer.Int32Ptr(15),
ttl: pointer.Int32(15),
since: &now.Time,
expectedTimeLeft: durationPointer(5),
expectedExpireAt: now.Add(5 * time.Second),
@@ -137,7 +137,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job failed now, 0s TTL",
failedTime: now,
ttl: utilpointer.Int32Ptr(0),
ttl: pointer.Int32(0),
since: &now.Time,
expectedTimeLeft: durationPointer(0),
expectedExpireAt: now.Time,
@@ -145,7 +145,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job failed now, 10s TTL",
failedTime: now,
ttl: utilpointer.Int32Ptr(10),
ttl: pointer.Int32(10),
since: &now.Time,
expectedTimeLeft: durationPointer(10),
expectedExpireAt: now.Add(10 * time.Second),
@@ -153,7 +153,7 @@ func TestTimeLeft(t *testing.T) {
{
name: "Job failed 10s ago, 15s TTL",
failedTime: metav1.NewTime(now.Add(-10 * time.Second)),
ttl: utilpointer.Int32Ptr(15),
ttl: pointer.Int32(15),
since: &now.Time,
expectedTimeLeft: durationPointer(5),
expectedExpireAt: now.Add(5 * time.Second),