-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Implemented Until Query Parameter for Containers/logs #10868
Conversation
@@ -39,6 +39,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) { | |||
return | |||
} | |||
|
|||
fmt.Println(query.Stdout, query.Stderr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover debug, make sure this is removed before you convert from draft
payload = r.json() | ||
container_id = payload["Id"] | ||
self.assertIsNotNone(container_id) | ||
r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/logs?follow=false&stdout=true&until=0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you set this up to actually test a log file with entries before and after the until?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what I just changed gets the job done. I call logs
twice once with until=0
and another time with until=1
(arbitrary small value) and compare the length of the logs asserting that 0 should be longer showing that it is working. I am unsure of how to capture and compare the log output more than just the length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually after messing around with it today I do not think we can parse the logs in these tests since they aren't in the response.
31ffda4
to
153b32a
Compare
LGTM |
@containers/podman-maintainers PTAL |
@vrothberg PTAL |
utils.BadRequest(w, "until", query.Until, err) | ||
return | ||
if query.Until != "0" { | ||
// FIXME: until != since but the logs backend does not yet support until. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop the comment above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, forgot about that. Fixed now @vrothberg
compat containers/logs was missing actual usage of until query param. fixes containers#10859 Signed-off-by: cdoern <cdoern@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work, @cdoern, thank you!
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cdoern, 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 |
compat containers/logs was missing actual usage of until query param.
fixes #10859
Signed-off-by: cdoern cdoern@redhat.com