-
Notifications
You must be signed in to change notification settings - Fork 949
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
bugfix: fix container can't ping outside and resolve domain names #2025
Conversation
test/cli_run_network_test.go
Outdated
|
||
"github.com/alibaba/pouch/test/command" | ||
"github.com/alibaba/pouch/test/environment" | ||
"github.com/go-check/check" |
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.
split into next group
test/cli_run_network_test.go
Outdated
} | ||
|
||
// TearDownTest does cleanup work in the end of each test. | ||
func (suite *PouchRunNetworkSuite) TearDownTest(c *check.C) { |
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.
remove the useless code
test/cli_run_network_test.go
Outdated
|
||
// TestRunWithPing is to verify run container with network ping publish website. | ||
func (suite *PouchRunNetworkSuite) TestRunWithPing(c *check.C) { | ||
pc, _, _, _ := runtime.Caller(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.
please use the name instead of complicated hacking function
daemon/mgr/network.go
Outdated
@@ -182,7 +182,7 @@ func (nm *NetworkManager) Remove(ctx context.Context, name string) error { | |||
nw, err := nm.controller.NetworkByName(name) | |||
if err != nil { | |||
if err == libnetwork.ErrNoSuchNetwork(name) { | |||
return errors.Wrap(errtypes.ErrNotfound, err.Error()) |
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 we can keep it the wrap here 😄
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.
Never ever directly return the ErrNotFound, it will be so ambiguous for user to understand.
No one understands the not found
if no context is there. @rudyfly
daemon/mgr/network.go
Outdated
@@ -182,7 +182,7 @@ func (nm *NetworkManager) Remove(ctx context.Context, name string) error { | |||
nw, err := nm.controller.NetworkByName(name) | |||
if err != nil { | |||
if err == libnetwork.ErrNoSuchNetwork(name) { | |||
return errors.Wrap(errtypes.ErrNotfound, err.Error()) |
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.
Never ever directly return the ErrNotFound, it will be so ambiguous for user to understand.
No one understands the not found
if no context is there. @rudyfly
test/cli_run_network_test.go
Outdated
func (suite *PouchRunNetworkSuite) TearDownTest(c *check.C) { | ||
} | ||
|
||
// TestRunWithPing is to verify run container with network ping publish website. |
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.
s/publish/public
Could you also add an integration test to cover the domain name resolving? @rudyfly |
@fuweid PTAL 😄 @allencloud |
ping @rudyfly |
Codecov Report
@@ Coverage Diff @@
## master #2025 +/- ##
=========================================
- Coverage 63.32% 63.3% -0.03%
=========================================
Files 200 200
Lines 15525 15527 +2
=========================================
- Hits 9831 9829 -2
- Misses 4454 4456 +2
- Partials 1240 1242 +2
|
fix container can't ping outside. Signed-off-by: Rudy Zhang <[email protected]>
LGTM, tested very well on my local machine. |
Ⅰ. Describe what this PR did
fix container can't ping outside with nat network.
Ⅱ. Does this pull request fix one issue?
fixes #1920
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
run testcase
TestRunWithPing
Ⅴ. Special notes for reviews
Signed-off-by: Rudy Zhang [email protected]