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

Move setRunningLocking to test code

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-09-28 13:48:12 -07:00
parent 17062aea21
commit eff253dfaf
2 changed files with 7 additions and 9 deletions

View file

@ -121,7 +121,7 @@ func wait(waitChan <-chan struct{}, timeout time.Duration) error {
// waitRunning waits until state is running. If state is already
// running it returns immediately. If you want wait forever you must
// supply negative timeout. Returns pid, that was passed to
// setRunningLocking.
// setRunning.
func (s *State) waitRunning(timeout time.Duration) (int, error) {
s.Lock()
if s.Running {
@ -178,12 +178,6 @@ func (s *State) getExitCode() int {
return res
}
func (s *State) setRunningLocking(pid int) {
s.Lock()
s.setRunning(pid)
s.Unlock()
}
func (s *State) setRunning(pid int) {
s.Error = ""
s.Running = true

View file

@ -18,7 +18,9 @@ func TestStateRunStop(t *testing.T) {
atomic.StoreInt64(&pid, int64(runPid))
close(started)
}()
s.setRunningLocking(i + 100)
s.Lock()
s.setRunning(i + 100)
s.Unlock()
if !s.IsRunning() {
t.Fatal("State not running")
@ -90,7 +92,9 @@ func TestStateTimeoutWait(t *testing.T) {
t.Log("Start callback fired")
}
s.setRunningLocking(42)
s.Lock()
s.setRunning(49)
s.Unlock()
stopped := make(chan struct{})
go func() {