test added and removed
This commit is contained in:
parent
0d550049e9
commit
3b8afce9e6
|
@ -226,12 +226,12 @@ func (tg *TaskGroup) Diff(other *TaskGroup, contextual bool) (*TaskGroupDiff, er
|
|||
|
||||
// ShutdownDelay diff
|
||||
if tg.ShutdownDelay == nil {
|
||||
oldPrimitiveFlat["ShutdownDelay"] = "nil"
|
||||
oldPrimitiveFlat["ShutdownDelay"] = ""
|
||||
} else {
|
||||
oldPrimitiveFlat["ShutdownDelay"] = fmt.Sprintf("%d", *tg.ShutdownDelay)
|
||||
}
|
||||
if other.ShutdownDelay == nil {
|
||||
newPrimitiveFlat["ShutdownDelay"] = "nil"
|
||||
newPrimitiveFlat["ShutdownDelay"] = ""
|
||||
} else {
|
||||
newPrimitiveFlat["ShutdownDelay"] = fmt.Sprintf("%d", *other.ShutdownDelay)
|
||||
}
|
||||
|
|
|
@ -3050,6 +3050,42 @@ func TestTaskGroupDiff(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
TestCase: "TaskGroup shutdown_delay removed",
|
||||
Old: &TaskGroup{
|
||||
ShutdownDelay: helper.TimeToPtr(30 * time.Second),
|
||||
},
|
||||
New: &TaskGroup{},
|
||||
Expected: &TaskGroupDiff{
|
||||
Type: DiffTypeEdited,
|
||||
Fields: []*FieldDiff{
|
||||
{
|
||||
Type: DiffTypeDeleted,
|
||||
Name: "ShutdownDelay",
|
||||
Old: "30000000000",
|
||||
New: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
TestCase: "TaskGroup shutdown_delay added",
|
||||
Old: &TaskGroup{},
|
||||
New: &TaskGroup{
|
||||
ShutdownDelay: helper.TimeToPtr(30 * time.Second),
|
||||
},
|
||||
Expected: &TaskGroupDiff{
|
||||
Type: DiffTypeEdited,
|
||||
Fields: []*FieldDiff{
|
||||
{
|
||||
Type: DiffTypeAdded,
|
||||
Name: "ShutdownDelay",
|
||||
Old: "",
|
||||
New: "30000000000",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, c := range cases {
|
||||
|
|
Loading…
Reference in New Issue