Skip to content

test: refactor compose_port_linux_test.go to use Tigron#4713

Merged
ChengyuZhu6 merged 2 commits intocontainerd:mainfrom
robertcal:issues_463_compose_port_linux_test.go
Feb 2, 2026
Merged

test: refactor compose_port_linux_test.go to use Tigron#4713
ChengyuZhu6 merged 2 commits intocontainerd:mainfrom
robertcal:issues_463_compose_port_linux_test.go

Conversation

@robertcal
Copy link
Contributor

@robertcal robertcal commented Jan 21, 2026

related : #4613

@@ -40,22 +38,44 @@ services:
- "12346:10001/udp"
Copy link
Member

Choose a reason for hiding this comment

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

Could you please re-write to get host port using portlock package ?

https://github.com/containerd/nerdctl/blob/main/pkg/testutil/portlock/portlock.go

Please correct the affected areas.

Additionally, please verify whether other sections can also be rewritten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review.
I've modified TestComposePort and TestComposePortFailure to use the portlock package.

TestComposeMultiplePorts requires consecutive ports, which is difficult to achieve with the portlock package in parallel execution, so I didn't modify it.

Comment on lines -45 to -46
projectName := comp.ProjectName()
t.Logf("projectName=%q", projectName)
Copy link
Member

Choose a reason for hiding this comment

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

Could you write these in testCase.Setup ?
The same applies to other test functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review.
I've added these in testCase.Setup.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@ChengyuZhu6 ChengyuZhu6 added this to the v2.3.0 milestone Jan 22, 2026
@robertcal robertcal force-pushed the issues_463_compose_port_linux_test.go branch from 2f88384 to 466a0ac Compare January 26, 2026 13:26
@robertcal
Copy link
Contributor Author

@haytok
Could you review this PR again?

@robertcal robertcal requested a review from haytok January 28, 2026 14:09

// TestComposeMultiplePorts tests whether it is possible to allocate a large
// number of ports. (https://github.com/containerd/nerdctl/issues/4027)
func TestComposeMultiplePorts(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for noticing the improvements to the TestComposeMultiplePorts function.
Since this fix (L175 ~ L180 and L191 ~ L192) doesn't involve refactoring the existing tests in Tigron, should we split the commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I've split the commit as suggested.

@robertcal robertcal force-pushed the issues_463_compose_port_linux_test.go branch from 466a0ac to d659d97 Compare January 30, 2026 13:46
@robertcal robertcal requested a review from haytok January 30, 2026 13:50
@ChengyuZhu6
Copy link
Member

Please rebase on main branch to pickup the changes.

Copy link
Member

@haytok haytok left a comment

Choose a reason for hiding this comment

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

LGTM for this PR, Thanks!

When you have time, please rebase 🙏

Signed-off-by: Hajime Ogi <robertcal900@gmail.com>
Signed-off-by: Hajime Ogi <robertcal900@gmail.com>
@robertcal robertcal force-pushed the issues_463_compose_port_linux_test.go branch from d659d97 to 248a714 Compare January 31, 2026 14:15
@robertcal
Copy link
Contributor Author

Thanks for the review.
I've rebased this branch onto the latest main.

Copy link
Member

@ChengyuZhu6 ChengyuZhu6 left a comment

Choose a reason for hiding this comment

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

LGTM

@ChengyuZhu6 ChengyuZhu6 merged commit 2beb456 into containerd:main Feb 2, 2026
189 of 204 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants