Merge pull request #117933 from tenzen-y/replace-deprecated-Prt-utils

Job: Replace deprecated pointer utils with supported ones
This commit is contained in:
Kubernetes Prow Robot
2023-05-11 09:59:14 -07:00
committed by GitHub

View File

@@ -801,7 +801,7 @@ func TestValidateJob(t *testing.T) {
},
Spec: batch.JobSpec{
Selector: validManualSelector,
ManualSelector: pointer.BoolPtr(true),
ManualSelector: pointer.Bool(true),
Template: api.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"y": "z"},
@@ -825,7 +825,7 @@ func TestValidateJob(t *testing.T) {
},
Spec: batch.JobSpec{
Selector: validManualSelector,
ManualSelector: pointer.BoolPtr(true),
ManualSelector: pointer.Bool(true),
Template: api.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"controller-uid": "4d5e6f"},
@@ -849,7 +849,7 @@ func TestValidateJob(t *testing.T) {
},
Spec: batch.JobSpec{
Selector: validManualSelector,
ManualSelector: pointer.BoolPtr(true),
ManualSelector: pointer.Bool(true),
Template: api.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: validManualSelector.MatchLabels,
@@ -873,7 +873,7 @@ func TestValidateJob(t *testing.T) {
},
Spec: batch.JobSpec{
Selector: validManualSelector,
ManualSelector: pointer.BoolPtr(true),
ManualSelector: pointer.Bool(true),
Template: api.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: validManualSelector.MatchLabels,
@@ -929,8 +929,8 @@ func TestValidateJob(t *testing.T) {
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
CompletionMode: completionModePtr(batch.IndexedCompletion),
Completions: pointer.Int32Ptr(2),
Parallelism: pointer.Int32Ptr(100001),
Completions: pointer.Int32(2),
Parallelism: pointer.Int32(100001),
},
},
opts: JobValidationOptions{RequirePrefixedLabels: true},
@@ -1124,7 +1124,7 @@ func TestValidateJobUpdate(t *testing.T) {
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(1)
job.Spec.Completions = pointer.Int32(1)
},
err: &field.Error{
Type: field.ErrorTypeInvalid,
@@ -1284,11 +1284,11 @@ func TestValidateJobUpdate(t *testing.T) {
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
CompletionMode: completionModePtr(batch.NonIndexedCompletion),
Completions: pointer.Int32Ptr(2),
Completions: pointer.Int32(2),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(4)
job.Spec.Completions = pointer.Int32(4)
},
err: &field.Error{
Type: field.ErrorTypeInvalid,
@@ -1538,14 +1538,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(1),
Parallelism: pointer.Int32Ptr(1),
Completions: pointer.Int32(1),
Parallelism: pointer.Int32(1),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(2)
job.Spec.Parallelism = pointer.Int32Ptr(2)
job.Spec.Completions = pointer.Int32(2)
job.Spec.Parallelism = pointer.Int32(2)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,
@@ -1557,14 +1557,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(1),
Parallelism: pointer.Int32Ptr(2),
Completions: pointer.Int32(1),
Parallelism: pointer.Int32(2),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(3)
job.Spec.Parallelism = pointer.Int32Ptr(3)
job.Spec.Completions = pointer.Int32(3)
job.Spec.Parallelism = pointer.Int32(3)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,
@@ -1576,14 +1576,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(1),
Parallelism: pointer.Int32Ptr(1),
Completions: pointer.Int32(1),
Parallelism: pointer.Int32(1),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(2)
job.Spec.Parallelism = pointer.Int32Ptr(3)
job.Spec.Completions = pointer.Int32(2)
job.Spec.Parallelism = pointer.Int32(3)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,
@@ -1599,14 +1599,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(1),
Parallelism: pointer.Int32Ptr(1),
Completions: pointer.Int32(1),
Parallelism: pointer.Int32(1),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = nil
job.Spec.Parallelism = pointer.Int32Ptr(3)
job.Spec.Parallelism = pointer.Int32(3)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,
@@ -1622,14 +1622,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(2),
Parallelism: pointer.Int32Ptr(2),
Completions: pointer.Int32(2),
Parallelism: pointer.Int32(2),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(2)
job.Spec.Parallelism = pointer.Int32Ptr(1)
job.Spec.Completions = pointer.Int32(2)
job.Spec.Parallelism = pointer.Int32(1)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,
@@ -1641,14 +1641,14 @@ func TestValidateJobUpdate(t *testing.T) {
Spec: batch.JobSpec{
Selector: validGeneratedSelector,
Template: validPodTemplateSpecForGenerated,
Completions: pointer.Int32Ptr(2),
Parallelism: pointer.Int32Ptr(2),
Completions: pointer.Int32(2),
Parallelism: pointer.Int32(2),
CompletionMode: completionModePtr(batch.IndexedCompletion),
},
},
update: func(job *batch.Job) {
job.Spec.Completions = pointer.Int32Ptr(2)
job.Spec.Parallelism = pointer.Int32Ptr(3)
job.Spec.Completions = pointer.Int32(2)
job.Spec.Parallelism = pointer.Int32(3)
},
opts: JobValidationOptions{
AllowElasticIndexedJobs: true,