Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #7860 - add time.RFC3339 format #7980

Merged

Conversation

3sky
Copy link

@3sky 3sky commented Oct 9, 2020

I can't find any other usage of this type, also no unit-tests for that. Sample validation below:

# before
$ podman system service -t 5000 &
$ podman run -d -p 8080:8080 localhost/hello-world
$ curl -s --unix-socket /$XDG_RUNTIME_DIR/podman/podman.sock http://localhost/containers/$(podman ps -q)/json | jq .Created
"2020-10-09 16:24:07.309694324 +0200 CEST"

# after
$ make binaries
$ bin/podman system service -t 5000 &
$ bin/podman run -d -p 8080:8080 localhost/hello-world
$ curl -s --unix-socket /$XDG_RUNTIME_DIR/podman/podman.sock http://localhost/containers/$(podman ps -q)/json | jq .Created
"2020-10-09T16:30:58+02:00"

Signed-off-by: 3sky 3sky@protonmail.com

@rhatdan
Copy link
Member

rhatdan commented Oct 9, 2020

Fixes: #7860

@rhatdan
Copy link
Member

rhatdan commented Oct 9, 2020

Thanks @3sky
LGTM
@containers/podman-maintainers PTAL

@mheon
Copy link
Member

mheon commented Oct 9, 2020

The given example string in #7860 was "Created": "2020-09-27T17:01:55.178157437", which is actually RFC3339Nano in Go

@@ -316,7 +317,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,

cb := types.ContainerJSONBase{
ID: l.ID(),
Created: l.CreatedTime().String(),
Created: l.CreatedTime().Format(time.RFC3339),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this should be RFC3339Nano instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch @mheon , I'd to double check, that's what Docker displayes to their logs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mheon! I expected that regular ISO_8601 format can be used. However changed to:

l.CreatedTime().Format(time.RFC3339Nano),

Now output is:

"2020-10-12T08:48:53.855528237+02:00"  

@3sky 3sky force-pushed the compatibility-api-timestamp branch from bd75d89 to b3223de Compare October 12, 2020 06:50
Signed-off-by: 3sky <3sky@protonmail.com>
@3sky 3sky force-pushed the compatibility-api-timestamp branch from b3223de to 1fc64c8 Compare October 12, 2020 06:51
@zhangguanzhang
Copy link
Collaborator

maybe need to add a test?

@3sky
Copy link
Author

3sky commented Oct 12, 2020

@zhangguanzhang something like this tests here
https://github.com/containers/podman/blob/master/test/apiv2/20-containers.at ?

@zhangguanzhang
Copy link
Collaborator

@zhangguanzhang something like this tests here
https://github.com/containers/podman/blob/master/test/apiv2/20-containers.at ?

yes

@rhatdan
Copy link
Member

rhatdan commented Oct 12, 2020

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3sky, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2020
@openshift-merge-robot openshift-merge-robot merged commit dce30de into containers:master Oct 12, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants