From ad0183e41978b3b156234f801750034912915223 Mon Sep 17 00:00:00 2001 From: shin- Date: Wed, 3 Apr 2013 10:48:02 -0700 Subject: [PATCH] Check WaitTimeout return in test, replaced lock initialization in runtime.Register() with call to initLock() --- runtime.go | 5 +---- runtime_test.go | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime.go b/runtime.go index e096202c61..950ea404a1 100644 --- a/runtime.go +++ b/runtime.go @@ -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() diff --git a/runtime_test.go b/runtime_test.go index d9d4e91cb5..9ae5a5835f 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -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()