dockershim: add unit tests for sandbox/container status

Also add a fake clock in the FakeDockerClient to allow testing container
CreatedAt, StartedAt, FinishedAt timestamps.
This commit is contained in:
Yu-Ju Hong
2016-08-29 17:40:28 -07:00
parent ac8aae584d
commit d3e1f2c75e
4 changed files with 227 additions and 25 deletions

View File

@@ -17,10 +17,14 @@ limitations under the License.
package dockershim
import (
"time"
"k8s.io/kubernetes/pkg/kubelet/dockertools"
"k8s.io/kubernetes/pkg/util/clock"
)
func newTestDockerSevice() (*dockerService, *dockertools.FakeDockerClient) {
func newTestDockerSevice() (*dockerService, *dockertools.FakeDockerClient, *clock.FakeClock) {
c := dockertools.NewFakeDockerClient()
return &dockerService{client: c}, c
fakeClock := clock.NewFakeClock(time.Time{})
return &dockerService{client: c}, c, fakeClock
}