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

ps: fix display of exposed ports #24337

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Oct 22, 2024

This fixes two problems, first if a port is published and exposed it
should not be shown twice. It is enough to show the published one.

Second, if there is a huge range the ports were no grouped causing the
output to be unreadable basically. Now we group exposed ports like we do
with the normal published ports.

Fixes #23317

Does this PR introduce a user-facing change?

Exposed ports in the output of podman ps are now correctly group and not duplicated when they are already published,

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 22, 2024
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.

Tests LGTM.

@@ -396,12 +396,20 @@ var _ = Describe("Podman run networking", func() {
name := "testctr"
session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-p", "80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
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

Copy link
Contributor

openshift-ci bot commented Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, Luap99

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

session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
// This must use Equal() to ensure we do not see the extra ", 80/tcp" from the exposed port
Expect(session.OutputToString()).To(Equal("0.0.0.0:" + hostPort + "->80/tcp"))
Copy link
Member

Choose a reason for hiding this comment

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

Should we have a test with a port range?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added sufficient unit tests IMO, but I can add more int test if wanted. I do agree that expose with ranges seems to have very little e2e tests (one, two if we could the ones form the image)

Copy link
Member Author

Choose a reason for hiding this comment

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

added more tests

This can never included a comma in the protocol so it just complicated
things for no reason, we never needed this and commit edc3dc5 already
ensures this cannot happen.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This fixes two problems, first if a port is published and exposed it
should not be shown twice. It is enough to show the published one.

Second, if there is a huge range the ports were no grouped causing the
output to be unreadable basically. Now we group exposed ports like we do
with the normal published ports.

Fixes containers#23317

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@mheon
Copy link
Member

mheon commented Oct 23, 2024

LGTM

@edsantiago
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 0712c18 into containers:main Oct 23, 2024
78 checks passed
@Luap99 Luap99 deleted the expose-ports-ps branch October 23, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman ps: output unreadable with many exposed ports
3 participants