Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
functional: exclude ActiveEnterTimestamp from unit comparison condition
Browse files Browse the repository at this point in the history
Actually it's not necessary to check that both units have the same value
for ActiveEnterTimestamp, as it can vary at any time. So let's exclude
ActiveEnterTimestamp from the condition for unit comparison.
  • Loading branch information
Dongsu Park committed Dec 16, 2016
1 parent f73c0bd commit 63a3b28
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion functional/systemd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,19 @@ func waitForUnitState(mgr unit.UnitManager, name string, want unit.UnitState) er
return err
}

if reflect.DeepEqual(want, *got) {
if isEqualUnitState(want, *got) {
return nil
}
}
}

// isEqualUnitState checks if both units are the same,
// excluding ActiveEnterTimestamp field of each unit state.
func isEqualUnitState(src, dst unit.UnitState) bool {
return src.LoadState == dst.LoadState &&
src.ActiveState == dst.ActiveState &&
src.SubState == dst.SubState &&
src.MachineID == dst.MachineID &&
src.UnitHash == dst.UnitHash &&
src.UnitName == dst.UnitName
}

0 comments on commit 63a3b28

Please sign in to comment.