Added a RestartPolicy to some mocks

This commit is contained in:
Diptanu Choudhury 2015-10-30 21:28:56 -07:00
parent 8133aa413a
commit c80f0e38d1
3 changed files with 16 additions and 4 deletions

View File

@ -69,6 +69,7 @@ func TestCompose(t *testing.T) {
Operand: "=",
},
},
RestartPolicy: NewRestartPolicy(),
Tasks: []*Task{
&Task{
Name: "task1",

View File

@ -12,6 +12,14 @@ type RestartPolicy struct {
Delay time.Duration
}
func NewRestartPolicy() *RestartPolicy {
return &RestartPolicy{
Attempts: 10,
Interval: 3 * time.Minute,
Delay: 5 * time.Second,
}
}
// TaskGroup is the unit of scheduling.
type TaskGroup struct {
Name string
@ -24,9 +32,11 @@ type TaskGroup struct {
// NewTaskGroup creates a new TaskGroup.
func NewTaskGroup(name string, count int) *TaskGroup {
restartPolicy := NewRestartPolicy()
return &TaskGroup{
Name: name,
Count: count,
RestartPolicy: restartPolicy,
}
}

View File

@ -10,6 +10,7 @@ func TestTaskGroup_NewTaskGroup(t *testing.T) {
expect := &TaskGroup{
Name: "grp1",
Count: 2,
RestartPolicy: NewRestartPolicy(),
}
if !reflect.DeepEqual(grp, expect) {
t.Fatalf("expect: %#v, got: %#v", expect, grp)