mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 21:51:33 +00:00
Allow duration strings as --since/--until
Fixes #13107. This change enables Go duration strings computed relative to the client machine’s time to be used as input parameters to `docker events --since/--until` and `docker logs --since` arguments. Added unit tests for pkg/timeutils.GetTimestamp as well. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
@@ -28,9 +28,10 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
||||
// List of available time formats to --since
|
||||
unixTs := func(t time.Time) string { return fmt.Sprintf("%v", t.Unix()) }
|
||||
rfc3339 := func(t time.Time) string { return t.Format(time.RFC3339) }
|
||||
duration := func(t time.Time) string { return time.Now().Sub(t).String() }
|
||||
|
||||
// --since=$start must contain only the 'untag' event
|
||||
for _, f := range []func(time.Time) string{unixTs, rfc3339} {
|
||||
for _, f := range []func(time.Time) string{unixTs, rfc3339, duration} {
|
||||
since, until := f(start), f(end)
|
||||
cmd := exec.Command(dockerBinary, "events", "--since="+since, "--until="+until)
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
|
||||
Reference in New Issue
Block a user