mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
remote events: convert TimeNano properly
e.TimeNano contains nanoseconds since epoch, not just the nanoseconds after e.Time. time.Unix supports nanoseconds > 999999999 and converts them to seconds, so just passing e.TimeNano is enough. Signed-off-by: Leah Neukirchen <leah@vuxu.org>
This commit is contained in:
@ -42,7 +42,7 @@ func ConvertToLibpodEvent(e Event) *libpodEvents.Event {
|
|||||||
Image: image,
|
Image: image,
|
||||||
Name: name,
|
Name: name,
|
||||||
Status: status,
|
Status: status,
|
||||||
Time: time.Unix(e.Time, e.TimeNano),
|
Time: time.Unix(0, e.TimeNano),
|
||||||
Type: t,
|
Type: t,
|
||||||
Details: libpodEvents.Details{
|
Details: libpodEvents.Details{
|
||||||
Attributes: details,
|
Attributes: details,
|
||||||
|
@ -62,6 +62,8 @@ var _ = Describe("Podman events", func() {
|
|||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")
|
Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")
|
||||||
|
date := time.Now().Format("2006-01-02")
|
||||||
|
Expect(result.OutputToStringArray()).To(ContainElement(HavePrefix(date)), "event log has correct timestamp")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman events with an event filter and container=cid", func() {
|
It("podman events with an event filter and container=cid", func() {
|
||||||
|
Reference in New Issue
Block a user