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

fix podman system df format error #7156

Merged
merged 1 commit into from
Jul 30, 2020

Conversation

zhangguanzhang
Copy link
Collaborator

@zhangguanzhang zhangguanzhang commented Jul 30, 2020

Signed-off-by: zhangguanzhang [email protected]
Fixes: #7149

root@develop:~/zgz/podman# podman  system df --format  "{{.Type}}\t{{.Total}}"
Images\t4Containers\t2Local Volumes\t0root@develop:~/zgz/podman# ^C
root@develop:~/zgz/podman# ./bin/podman  system df --format  "{{.Type}}\t{{.Total}}"
Images         4
Containers     2
Local Volumes  0

@zhangguanzhang
Copy link
Collaborator Author

zhangguanzhang commented Jul 30, 2020

/assign @rhatdan @mheon

@edsantiago
Copy link
Member

Nice work! Please apply this patch and resubmit. Don't bother waiting for CI, it will fail without this patch.

index a96507448..217357b37 100644
--- a/test/system/320-system-df.bats
+++ b/test/system/320-system-df.bats
@@ -24,9 +24,10 @@ function teardown() {
     run_podman run -d -v /myvol2 --name c2 $IMAGE \
                sh -c 'while ! test -e /stop; do sleep 0.1;done'

-    run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}--'
-    # FIXME: if/when #7149 gets fixed, split this into three tests (i.e. test "${lines[0]}", [1], [2] )
-    is "$output" "Images:1:1--Containers:2:1--Local Volumes:2:1--"
+    run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}'
+    is "${lines[0]}" "Images:1:1"        "system df : Images line"
+    is "${lines[1]}" "Containers:2:1"    "system df : Containers line"
+    is "${lines[2]}" "Local Volumes:2:1" "system df : Volumes line"

     # Try -v. (Grrr. No way to specify individual formats)
     #

@edsantiago
Copy link
Member

Oh, and you have to use exact syntax for github to understand that this fixes an existing issue. In your PR description, change "fix" to "Fixes:". Thanks again!

@zhangguanzhang
Copy link
Collaborator Author

all has be done

session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
// if userFmt is set, so there is no header, it will be 3
Expect(len(session.OutputToStringArray())).To(Equal(3))
Copy link
Member

Choose a reason for hiding this comment

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

I know everyone is tired of hearing me say it, but this is not really a test. "Number of lines of output" is really pretty useless and just gives false confidence. Worse, there is no point to creating a volume or container here because none of that is checked. It just adds to test run time needlessly.

I would recommend scratching this and just relying on the system test. If there is a strong need to stick with e2e tests, please at least add actual validation of the output.

Copy link
Member

Choose a reason for hiding this comment

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

Tend to agree, given this is just a duplication of the system test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all has be done

@zhangguanzhang zhangguanzhang force-pushed the master branch 2 times, most recently from adf412f to 4df4da4 Compare July 30, 2020 17:32
Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

LGTM - it has the desired effect, including with \t and -- should anyone ever need this in circumstances beyond my imagination -- \a. I don't want to give the final slash-lgtm though.

Thank you so much for taking this on and for your quick response on my feedback!

@rhatdan
Copy link
Member

rhatdan commented Jul 30, 2020

/approve
/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Jul 30, 2020
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, rhatdan, zhangguanzhang

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 Jul 30, 2020
@edsantiago
Copy link
Member

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 30, 2020
@openshift-merge-robot openshift-merge-robot merged commit 4132b71 into containers:master Jul 30, 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.

podman system df: not interpreting backslash format codes, no newlines
6 participants