integration/internal/swarm: rename max/min as it collides with go1.21 builtin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fa13b0715f
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
4e11c149d1
commit
51dc5fb58f
1 changed files with 8 additions and 12 deletions
|
@ -95,12 +95,8 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
|
|||
jobIteration = service.JobStatus.JobIteration
|
||||
}
|
||||
|
||||
maxRaw := service.Spec.Mode.ReplicatedJob.MaxConcurrent
|
||||
totalRaw := service.Spec.Mode.ReplicatedJob.TotalCompletions
|
||||
|
||||
max := int(*maxRaw)
|
||||
total := int(*totalRaw)
|
||||
|
||||
maxConcurrent := int(*service.Spec.Mode.ReplicatedJob.MaxConcurrent)
|
||||
totalCompletions := int(*service.Spec.Mode.ReplicatedJob.TotalCompletions)
|
||||
previousResult := ""
|
||||
|
||||
return func(log poll.LogT) poll.Result {
|
||||
|
@ -134,16 +130,16 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
|
|||
}
|
||||
|
||||
switch {
|
||||
case running > max:
|
||||
case running > maxConcurrent:
|
||||
return poll.Error(fmt.Errorf(
|
||||
"number of running tasks (%v) exceeds max (%v)", running, max,
|
||||
"number of running tasks (%v) exceeds max (%v)", running, maxConcurrent,
|
||||
))
|
||||
case (completed + running) > total:
|
||||
case (completed + running) > totalCompletions:
|
||||
return poll.Error(fmt.Errorf(
|
||||
"number of tasks exceeds total (%v), %v running and %v completed",
|
||||
total, running, completed,
|
||||
totalCompletions, running, completed,
|
||||
))
|
||||
case completed == total && running == 0:
|
||||
case completed == totalCompletions && running == 0:
|
||||
return poll.Success()
|
||||
default:
|
||||
newRes := fmt.Sprintf(
|
||||
|
@ -157,7 +153,7 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
|
|||
|
||||
return poll.Continue(
|
||||
"Job not yet finished, %v completed and %v running out of %v total",
|
||||
completed, running, total,
|
||||
completed, running, totalCompletions,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue