mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Use fakeclock in fake docker client.
This commit is contained in:
parent
13126e51dd
commit
3d1263d2cf
@ -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"
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user