Named fields in unit test and one more test case
This commit is contained in:
parent
5ee3cdecc5
commit
6fcd9f67a8
|
@ -2429,16 +2429,28 @@ func TestReschedulePolicy_Validate(t *testing.T) {
|
|||
|
||||
testCases := []testCase{
|
||||
{
|
||||
ReschedulePolicy: &ReschedulePolicy{1, 5 * time.Minute},
|
||||
err: nil,
|
||||
ReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: 0,
|
||||
Interval: 0 * time.Second},
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
ReschedulePolicy: &ReschedulePolicy{-1, 5 * time.Minute},
|
||||
err: nil,
|
||||
ReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: 1,
|
||||
Interval: 5 * time.Minute},
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
ReschedulePolicy: &ReschedulePolicy{1, 1 * time.Second},
|
||||
err: fmt.Errorf("Interval cannot be less than %v (got %v)", RestartPolicyMinInterval, time.Second),
|
||||
ReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: -1,
|
||||
Interval: 5 * time.Minute},
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
ReschedulePolicy: &ReschedulePolicy{
|
||||
Attempts: 1,
|
||||
Interval: 1 * time.Second},
|
||||
err: fmt.Errorf("Interval cannot be less than %v (got %v)", RestartPolicyMinInterval, time.Second),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -2701,6 +2713,14 @@ func TestAllocation_ShouldReschedule(t *testing.T) {
|
|||
ReschedulePolicy: nil,
|
||||
ShouldReschedule: false,
|
||||
},
|
||||
{
|
||||
Desc: "Disabled recheduling",
|
||||
ClientStatus: AllocClientStatusFailed,
|
||||
DesiredStatus: AllocDesiredStatusRun,
|
||||
FailTime: fail,
|
||||
ReschedulePolicy: &ReschedulePolicy{0, 1 * time.Minute},
|
||||
ShouldReschedule: false,
|
||||
},
|
||||
{
|
||||
Desc: "Reschedule when client status is complete",
|
||||
ClientStatus: AllocClientStatusComplete,
|
||||
|
|
Loading…
Reference in a new issue