mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
Address code review comments
This commit is contained in:
@@ -92,12 +92,12 @@ type Allocation struct {
|
||||
DeploymentStatus *AllocDeploymentStatus
|
||||
PreviousAllocation string
|
||||
NextAllocation string
|
||||
RescheduleTracker *RescheduleTracker
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
AllocModifyIndex uint64
|
||||
CreateTime int64
|
||||
ModifyTime int64
|
||||
RescheduleTracker *RescheduleTracker
|
||||
}
|
||||
|
||||
// AllocationMetric is used to deserialize allocation metrics.
|
||||
@@ -132,11 +132,11 @@ type AllocationListStub struct {
|
||||
ClientDescription string
|
||||
TaskStates map[string]*TaskState
|
||||
DeploymentStatus *AllocDeploymentStatus
|
||||
RescheduleTracker *RescheduleTracker
|
||||
CreateIndex uint64
|
||||
ModifyIndex uint64
|
||||
CreateTime int64
|
||||
ModifyTime int64
|
||||
RescheduleTracker *RescheduleTracker
|
||||
}
|
||||
|
||||
// AllocDeploymentStatus captures the status of the allocation as part of the
|
||||
|
||||
@@ -321,7 +321,7 @@ func (g *TaskGroup) Canonicalize(job *Job) {
|
||||
jobReschedule := job.Reschedule.Copy()
|
||||
jobReschedule.Merge(g.ReschedulePolicy)
|
||||
g.ReschedulePolicy = jobReschedule
|
||||
} else if jr && !job.Reschedule.Empty() {
|
||||
} else if jr {
|
||||
jobReschedule := job.Reschedule.Copy()
|
||||
g.ReschedulePolicy = jobReschedule
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ func TestTaskGroup_Canonicalize_ReschedulePolicy(t *testing.T) {
|
||||
},
|
||||
taskReschedulePolicy: nil,
|
||||
expected: &ReschedulePolicy{
|
||||
Attempts: helper.IntToPtr(structs.DefaultBatchJobReschedulePolicy.Attempts),
|
||||
Interval: helper.TimeToPtr(structs.DefaultBatchJobReschedulePolicy.Interval),
|
||||
Attempts: helper.IntToPtr(0),
|
||||
Interval: helper.TimeToPtr(0),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -337,6 +337,19 @@ func TestTaskGroup_Canonicalize_ReschedulePolicy(t *testing.T) {
|
||||
Interval: helper.TimeToPtr(5 * time.Minute),
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "Override from group",
|
||||
jobReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: helper.IntToPtr(1),
|
||||
},
|
||||
taskReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: helper.IntToPtr(5),
|
||||
},
|
||||
expected: &ReschedulePolicy{
|
||||
Attempts: helper.IntToPtr(5),
|
||||
Interval: helper.TimeToPtr(structs.DefaultBatchJobReschedulePolicy.Interval),
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "Attempts from job, default interval",
|
||||
jobReschedulePolicy: &ReschedulePolicy{
|
||||
|
||||
Reference in New Issue
Block a user