1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #28668 from anusha-ragunathan/fix_teardown

Check for valid daemon in TearDownTest.
This commit is contained in:
Brian Goff 2016-11-22 13:26:08 -05:00 committed by GitHub
commit 39e2e07567
6 changed files with 30 additions and 18 deletions

View file

@ -302,14 +302,16 @@ func (s *DockerSwarmSuite) TearDownTest(c *check.C) {
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
s.daemonsLock.Lock() s.daemonsLock.Lock()
for _, d := range s.daemons { for _, d := range s.daemons {
d.Stop() if d != nil {
// raft state file is quite big (64MB) so remove it after every test d.Stop()
walDir := filepath.Join(d.root, "swarm/raft/wal") // raft state file is quite big (64MB) so remove it after every test
if err := os.RemoveAll(walDir); err != nil { walDir := filepath.Join(d.root, "swarm/raft/wal")
c.Logf("error removing %v: %v", walDir, err) if err := os.RemoveAll(walDir); err != nil {
} c.Logf("error removing %v: %v", walDir, err)
}
cleanupExecRoot(c, d.execRoot) cleanupExecRoot(c, d.execRoot)
}
} }
s.daemons = nil s.daemons = nil
s.daemonsLock.Unlock() s.daemonsLock.Unlock()

View file

@ -36,8 +36,10 @@ func (s *DockerAuthzV2Suite) SetUpTest(c *check.C) {
} }
func (s *DockerAuthzV2Suite) TearDownTest(c *check.C) { func (s *DockerAuthzV2Suite) TearDownTest(c *check.C) {
s.d.Stop() if s.d != nil {
s.ds.TearDownTest(c) s.d.Stop()
s.ds.TearDownTest(c)
}
} }
func (s *DockerAuthzV2Suite) TestAuthZPluginAllowNonVolumeRequest(c *check.C) { func (s *DockerAuthzV2Suite) TestAuthZPluginAllowNonVolumeRequest(c *check.C) {

View file

@ -68,9 +68,11 @@ func (s *DockerAuthzSuite) SetUpTest(c *check.C) {
} }
func (s *DockerAuthzSuite) TearDownTest(c *check.C) { func (s *DockerAuthzSuite) TearDownTest(c *check.C) {
s.d.Stop() if s.d != nil {
s.ds.TearDownTest(c) s.d.Stop()
s.ctrl = nil s.ds.TearDownTest(c)
s.ctrl = nil
}
} }
func (s *DockerAuthzSuite) SetUpSuite(c *check.C) { func (s *DockerAuthzSuite) SetUpSuite(c *check.C) {

View file

@ -55,8 +55,10 @@ func (s *DockerExternalGraphdriverSuite) SetUpTest(c *check.C) {
} }
func (s *DockerExternalGraphdriverSuite) TearDownTest(c *check.C) { func (s *DockerExternalGraphdriverSuite) TearDownTest(c *check.C) {
s.d.Stop() if s.d != nil {
s.ds.TearDownTest(c) s.d.Stop()
s.ds.TearDownTest(c)
}
} }
func (s *DockerExternalGraphdriverSuite) SetUpSuite(c *check.C) { func (s *DockerExternalGraphdriverSuite) SetUpSuite(c *check.C) {

View file

@ -54,8 +54,10 @@ func (s *DockerExternalVolumeSuite) SetUpTest(c *check.C) {
} }
func (s *DockerExternalVolumeSuite) TearDownTest(c *check.C) { func (s *DockerExternalVolumeSuite) TearDownTest(c *check.C) {
s.d.Stop() if s.d != nil {
s.ds.TearDownTest(c) s.d.Stop()
s.ds.TearDownTest(c)
}
} }
func (s *DockerExternalVolumeSuite) SetUpSuite(c *check.C) { func (s *DockerExternalVolumeSuite) SetUpSuite(c *check.C) {

View file

@ -51,8 +51,10 @@ func (s *DockerNetworkSuite) SetUpTest(c *check.C) {
} }
func (s *DockerNetworkSuite) TearDownTest(c *check.C) { func (s *DockerNetworkSuite) TearDownTest(c *check.C) {
s.d.Stop() if s.d != nil {
s.ds.TearDownTest(c) s.d.Stop()
s.ds.TearDownTest(c)
}
} }
func (s *DockerNetworkSuite) SetUpSuite(c *check.C) { func (s *DockerNetworkSuite) SetUpSuite(c *check.C) {