mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Properly cleanup plugin states which might impact other tests
Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
parent
627bc91727
commit
c5b5b4ea45
1 changed files with 10 additions and 7 deletions
|
@ -496,13 +496,6 @@ func (s *DockerSwarmSuite) TestPsListContainersFilterIsTask(c *check.C) {
|
|||
const globalNetworkPlugin = "global-network-plugin"
|
||||
const globalIPAMPlugin = "global-ipam-plugin"
|
||||
|
||||
func (s *DockerSwarmSuite) SetUpSuite(c *check.C) {
|
||||
mux := http.NewServeMux()
|
||||
s.server = httptest.NewServer(mux)
|
||||
c.Assert(s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
||||
setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin)
|
||||
}
|
||||
|
||||
func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv, ipamDrv string) {
|
||||
|
||||
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -672,6 +665,16 @@ func setupRemoteGlobalNetworkPlugin(c *check.C, mux *http.ServeMux, url, netDrv,
|
|||
}
|
||||
|
||||
func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *check.C) {
|
||||
mux := http.NewServeMux()
|
||||
s.server = httptest.NewServer(mux)
|
||||
c.Assert(s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
||||
setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin)
|
||||
defer func() {
|
||||
s.server.Close()
|
||||
err := os.RemoveAll("/etc/docker/plugins")
|
||||
c.Assert(err, checker.IsNil)
|
||||
}()
|
||||
|
||||
d := s.AddDaemon(c, true, true)
|
||||
|
||||
out, err := d.Cmd("network", "create", "-d", globalNetworkPlugin, "foo")
|
||||
|
|
Loading…
Reference in a new issue