mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #22043 from WeiZhang555/remove-start-event-failed-start
Remove start/die event when fail to start container
This commit is contained in:
commit
bb91bd3a89
2 changed files with 10 additions and 8 deletions
|
@ -107,10 +107,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
|
||||||
}
|
}
|
||||||
container.ToDisk()
|
container.ToDisk()
|
||||||
daemon.Cleanup(container)
|
daemon.Cleanup(container)
|
||||||
attributes := map[string]string{
|
|
||||||
"exitCode": fmt.Sprintf("%d", container.ExitCode),
|
|
||||||
}
|
|
||||||
daemon.LogContainerEventWithAttributes(container, "die", attributes)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -149,8 +145,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
|
||||||
|
|
||||||
container.Reset(false)
|
container.Reset(false)
|
||||||
|
|
||||||
// start event is logged even on error
|
|
||||||
daemon.LogContainerEvent(container, "start")
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,16 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
|
||||||
dieEvent = true
|
dieEvent = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows platform is different from Linux, it will start container whatever
|
||||||
|
// so Windows can get start/die event but Linux can't
|
||||||
|
if daemonPlatform == "windows" {
|
||||||
c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
|
c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
|
||||||
c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
|
c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
|
||||||
|
} else {
|
||||||
|
c.Assert(startEvent, checker.False, check.Commentf("Start event not expected: %v\n%v", actions, events))
|
||||||
|
c.Assert(dieEvent, checker.False, check.Commentf("Die event not expected: %v\n%v", actions, events))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue