StopContainer should block unless client context is canceled
A call to StopContainer should only return if the client context is canceled or its deadline was exceeded. The Timeout parameter on StopContainerRequest is now used as the time AFTER sending the stop signal before the SIGKILL is delivered. The call will remain until the container has exited or the client context has finished. Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
@@ -74,7 +74,12 @@ func TestWaitContainerStop(t *testing.T) {
|
||||
cancel()
|
||||
ctx = cancelledCtx
|
||||
}
|
||||
err = c.waitContainerStop(ctx, container, test.timeout)
|
||||
if test.timeout > 0 {
|
||||
timeoutCtx, cancel := context.WithTimeout(ctx, test.timeout)
|
||||
defer cancel()
|
||||
ctx = timeoutCtx
|
||||
}
|
||||
err = c.waitContainerStop(ctx, container)
|
||||
assert.Equal(t, test.expectErr, err != nil, desc)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user