Remove start/die event when fail to start container
| ... | ... |
@@ -107,10 +107,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error) |
| 107 | 107 |
} |
| 108 | 108 |
container.ToDisk() |
| 109 | 109 |
daemon.Cleanup(container) |
| 110 |
- attributes := map[string]string{
|
|
| 111 |
- "exitCode": fmt.Sprintf("%d", container.ExitCode),
|
|
| 112 |
- } |
|
| 113 |
- daemon.LogContainerEventWithAttributes(container, "die", attributes) |
|
| 114 | 110 |
} |
| 115 | 111 |
}() |
| 116 | 112 |
|
| ... | ... |
@@ -149,8 +145,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error) |
| 149 | 149 |
|
| 150 | 150 |
container.Reset(false) |
| 151 | 151 |
|
| 152 |
- // start event is logged even on error |
|
| 153 |
- daemon.LogContainerEvent(container, "start") |
|
| 154 | 152 |
return err |
| 155 | 153 |
} |
| 156 | 154 |
|
| ... | ... |
@@ -93,8 +93,16 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
|
| 93 | 93 |
dieEvent = true |
| 94 | 94 |
} |
| 95 | 95 |
} |
| 96 |
- c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
|
|
| 97 |
- c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
|
|
| 96 |
+ |
|
| 97 |
+ // Windows platform is different from Linux, it will start container whatever |
|
| 98 |
+ // so Windows can get start/die event but Linux can't |
|
| 99 |
+ if daemonPlatform == "windows" {
|
|
| 100 |
+ c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
|
|
| 101 |
+ c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
|
|
| 102 |
+ } else {
|
|
| 103 |
+ c.Assert(startEvent, checker.False, check.Commentf("Start event not expected: %v\n%v", actions, events))
|
|
| 104 |
+ c.Assert(dieEvent, checker.False, check.Commentf("Die event not expected: %v\n%v", actions, events))
|
|
| 105 |
+ } |
|
| 98 | 106 |
} |
| 99 | 107 |
|
| 100 | 108 |
func (s *DockerSuite) TestEventsLimit(c *check.C) {
|