Check WaitTimeout return in test, replaced lock initialization in runtime.Register() with call to initLock()

This commit is contained in:
shin- 2013-04-03 10:48:02 -07:00
parent d1767bbf67
commit ad0183e419
2 changed files with 4 additions and 5 deletions

View File

@ -11,7 +11,6 @@ import (
"path"
"sort"
"strings"
"sync"
"time"
)
@ -154,9 +153,7 @@ func (runtime *Runtime) Register(container *Container) error {
container.runtime = runtime
// Setup state lock (formerly in newState()
lock := new(sync.Mutex)
container.State.stateChangeLock = lock
container.State.stateChangeCond = sync.NewCond(lock)
container.State.initLock()
// Attach to stdout and stderr
container.stderr = newWriteBroadcaster()
container.stdout = newWriteBroadcaster()

View File

@ -305,7 +305,9 @@ func TestRestore(t *testing.T) {
// Simulate a crash/manual quit of dockerd: process dies, states stays 'Running'
cStdin, _ := container2.StdinPipe()
cStdin.Close()
container2.WaitTimeout(time.Second)
if err := container2.WaitTimeout(time.Second); err != nil {
t.Fatal(err)
}
container2.State.Running = true
container2.ToDisk()