Skip to content

Commit

Permalink
bugfix: vendor newest libnetwork for connect panic
Browse files Browse the repository at this point in the history
It seems a bug of libnetwork. When libnetwork restores the sandbox,
it forgets to initialize the epPriority map. So the Join panic. The
latest alibaba/libnetwork has fixed the bug. We will vendor the newest
libnetwork and add some test cases

alibaba/libnetwork@655f08f

Signed-off-by: Eric Li <[email protected]>
  • Loading branch information
shaloulcy committed Jun 20, 2018
1 parent 196943d commit 446f5f4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 6 deletions.
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

0 comments on commit 446f5f4

Please sign in to comment.