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

bugfix: vendor latest libnetwork for connect panic #1556

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions test/cli_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,82 @@ func (suite *PouchNetworkSuite) TestNetworkDisconnect(c *check.C) {
command.PouchRun("stop", "-t", "1", name).Assert(c, icmd.Success)
command.PouchRun("start", name).Assert(c, icmd.Success)
}

// TestNetworkConnectWithRestart is to verify the 'network connect'
// and 'network disconnect' after restart daemon.
func (suite *PouchNetworkSuite) TestNetworkConnectWithRestart(c *check.C) {
// start the test pouch daemon
dcfg, err := StartDefaultDaemonDebug()
if err != nil {
c.Skip("daemon start failed.")
}
defer dcfg.KillDaemon()

// pull image
RunWithSpecifiedDaemon(dcfg, "pull", busyboxImage).Assert(c, icmd.Success)

bridgeName := "p1"
networkName := "net1"
containerName := "TestNetworkConnectWithRestart"

// create bridge device
br, err := createBridge("p1")
c.Assert(err, check.Equals, nil)
defer netlink.LinkDel(br)

// create bridge network
RunWithSpecifiedDaemon(dcfg, "network", "create",
"-d", "bridge",
"--subnet=172.18.0.0/24", "--gateway=172.18.0.1",
"-o", "com.docker.network.bridge.name="+bridgeName, networkName).Assert(c, icmd.Success)
defer func() {
RunWithSpecifiedDaemon(dcfg, "network", "rm", networkName).Assert(c, icmd.Success)
}()

// create container
RunWithSpecifiedDaemon(dcfg, "run", "-d", "--name", containerName, busyboxImage, "top").Assert(c, icmd.Success)
defer func() {
RunWithSpecifiedDaemon(dcfg, "rm", "-f", containerName).Assert(c, icmd.Success)
}()

// restart daemon
err = RestartDaemon(dcfg)
c.Assert(err, check.IsNil)

// connect a network
RunWithSpecifiedDaemon(dcfg, "network", "connect", networkName, containerName).Assert(c, icmd.Success)

// inspect container check result
ret := RunWithSpecifiedDaemon(dcfg, "inspect", containerName).Assert(c, icmd.Success)

out := ret.Stdout()
found := false
for _, line := range strings.Split(out, "\n") {
if strings.Contains(line, "net1") {
found = true
break
}
}
c.Assert(found, check.Equals, true)

// restart daemon
err = RestartDaemon(dcfg)
c.Assert(err, check.IsNil)

// disconnect a network
RunWithSpecifiedDaemon(dcfg, "network", "disconnect", networkName, containerName).Assert(c, icmd.Success)

// inspect container check result
ret = RunWithSpecifiedDaemon(dcfg, "inspect", containerName).Assert(c, icmd.Success)

out = ret.Stdout()
found = false
for _, line := range strings.Split(out, "\n") {
if strings.Contains(line, "net1") {
found = true
break
}
}

c.Assert(found, check.Equals, false)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,11 @@
"revisionTime": "2017-12-19T08:35:33Z"
},
{
"checksumSHA1": "9fs73UF7mj6VtGjZcpYvkfZTgH4=",
"checksumSHA1": "P6rfMC0ECx56UDSrnnb8InINEVc=",
"origin": "github.com/alibaba/libnetwork",
"path": "github.com/docker/libnetwork",
"revision": "04a77bdbfb6f51185791ee3d61e3644f058e6b21",
"revisionTime": "2018-06-11T16:09:43Z",
"version": "=master",
"versionExact": "master"
"revision": "7c0569783f2eea427d5c2ea032856e5d0edc38dd",
"revisionTime": "2018-06-21T03:37:56Z"
},
{
"checksumSHA1": "PjtJFUyEOokrmiBiHmfXrX/lAug=",
Expand Down Expand Up @@ -1912,7 +1910,6 @@
},
{
"checksumSHA1": "o+lVDhZsT+PFILKt5S6CgBmcrMs=",
"origin": "github.com/alibaba/pouch/vendor/k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2",
"path": "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2",
"revision": "86bd9771515c19a8df7128f53b1c1fa4f00d64ee",
"revisionTime": "2018-05-23T02:20:24Z"
Expand Down