Use fakeclock in fake docker client.

This commit is contained in:
Random-Liu 2016-09-24 22:43:39 -07:00
parent 13126e51dd
commit 3d1263d2cf
2 changed files with 3 additions and 3 deletions

View File

@ -123,7 +123,7 @@ func TestContainerStatus(t *testing.T) {
}
// Create the container.
fClock.SetTime(time.Now())
fClock.SetTime(time.Now().Add(-1 * time.Hour))
*expected.CreatedAt = fClock.Now().Unix()
id, err := ds.CreateContainer("sandboxid", config, sConfig)
// Set the id manually since we don't know the id until it's created.
@ -144,7 +144,7 @@ func TestContainerStatus(t *testing.T) {
assert.Equal(t, expected, status)
// Advance the clock and stop the container.
fClock.SetTime(time.Now())
fClock.SetTime(time.Now().Add(1 * time.Hour))
*expected.FinishedAt = fClock.Now().Unix()
*expected.State = runtimeApi.ContainerState_EXITED
*expected.Reason = "Completed"

View File

@ -24,7 +24,7 @@ import (
)
func newTestDockerSevice() (*dockerService, *dockertools.FakeDockerClient, *clock.FakeClock) {
c := dockertools.NewFakeDockerClient()
fakeClock := clock.NewFakeClock(time.Time{})
c := dockertools.NewFakeDockerClientWithClock(fakeClock)
return &dockerService{client: c}, c, fakeClock
}