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

Implemented Until Query Parameter for Containers/logs #10868

Merged
merged 1 commit into from
Jul 10, 2021

Conversation

cdoern
Copy link
Contributor

@cdoern cdoern commented Jul 6, 2021

compat containers/logs was missing actual usage of until query param.

fixes #10859

Signed-off-by: cdoern cdoern@redhat.com

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 6, 2021
@@ -39,6 +39,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
return
}

fmt.Println(query.Stdout, query.Stderr)
Copy link
Member

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")
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@cdoern cdoern force-pushed the untilLog branch 6 times, most recently from 31ffda4 to 153b32a Compare July 7, 2021 21:36
@cdoern cdoern marked this pull request as ready for review July 8, 2021 14:02
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 8, 2021
@cdoern cdoern requested a review from mheon July 8, 2021 16:29
@rhatdan
Copy link
Member

rhatdan commented Jul 9, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jul 9, 2021

@containers/podman-maintainers PTAL
@Luap99 PTAL

@rhatdan
Copy link
Member

rhatdan commented Jul 9, 2021

@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.
Copy link
Member

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?

Copy link
Contributor Author

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>
Copy link
Member

@vrothberg vrothberg left a 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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2021
@rhatdan
Copy link
Member

rhatdan commented Jul 10, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 10, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@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.

docker REST API: logs: until=0 does not return any log
6 participants