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

remote events: convert TimeNano properly #12644

Merged

Conversation

leahneukirchen
Copy link
Contributor

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.

Closes #12629.

@mheon
Copy link
Member

mheon commented Dec 17, 2021

PR is complaining about a lack of test coverage. You can look into adding a test (maybe check that the year in the timestamp matches the current year?) or just add [NO NEW TESTS NEEDED] to your commit message and force-push.

@mheon
Copy link
Member

mheon commented Dec 17, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leahneukirchen, mheon

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2021
@leahneukirchen
Copy link
Contributor Author

Note that it only affects remote events, I'm not sure where this can be tested.

@rhatdan
Copy link
Member

rhatdan commented Dec 18, 2021

Thanks @leahneukirchen
LGTM
I guess you could add a test to make sure the year reported in podman events is this century. :^)
Or just add [NO NEW TESTS NEEDED]

@Luap99
Copy link
Member

Luap99 commented Dec 20, 2021

Maybe add a test here:

Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")

I think this should work:

diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 39f495460..0350bf93c 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -62,6 +62,8 @@ var _ = Describe("Podman events", func() {
                result.WaitWithDefaultTimeout()
                Expect(result).Should(Exit(0))
                Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1), "Number of events")
+               date := time.Now().Format("2000-01-01")
+               Expect(result.OutputToStringArray()).To(ConsistOf(HavePrefix(date)))
        })
 
        It("podman events with an event filter and container=cid", func() {
``´

@leahneukirchen
Copy link
Contributor Author

I think this test suite doesn't test for --remote, however.

@mheon
Copy link
Member

mheon commented Dec 20, 2021

It will, we have several suites for the remote client (Any of the tests marked int remote run the integration tests with the remote client using the specified OS - looks like we have F34, F35, and Ubuntu 21.10 enabled).

@leahneukirchen
Copy link
Contributor Author

Ok, I can add this then. Give me a few days, tho.

@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2022

@leahneukirchen friendly ping

@leahneukirchen
Copy link
Contributor Author

There only seems to be a way to test one log line to have the right prefix, but I guess that works too.

@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2022

LGTM
Thanks @leahneukirchen

@leahneukirchen
Copy link
Contributor Author

These failures are unrelated I think?

@mheon
Copy link
Member

mheon commented Jan 10, 2022

Restarted, if they're still red in a few hours I'll look deeper and see if they're related

@vrothberg
Copy link
Member

@leahneukirchen, could you do another rebase? CI should be green now. Apologies!

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 <[email protected]>
@Luap99
Copy link
Member

Luap99 commented Jan 13, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2022
@openshift-merge-robot openshift-merge-robot merged commit 1b970e8 into containers:main Jan 13, 2022
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

podman --remote events prints wrong timestamps
6 participants