Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
3d1263d2
Commit
3d1263d2
authored
Sep 24, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fakeclock in fake docker client.
parent
13126e51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
docker_container_test.go
pkg/kubelet/dockershim/docker_container_test.go
+2
-2
docker_service_test.go
pkg/kubelet/dockershim/docker_service_test.go
+1
-1
No files found.
pkg/kubelet/dockershim/docker_container_test.go
View file @
3d1263d2
...
@@ -123,7 +123,7 @@ func TestContainerStatus(t *testing.T) {
...
@@ -123,7 +123,7 @@ func TestContainerStatus(t *testing.T) {
}
}
// Create the container.
// Create the container.
fClock
.
SetTime
(
time
.
Now
())
fClock
.
SetTime
(
time
.
Now
()
.
Add
(
-
1
*
time
.
Hour
)
)
*
expected
.
CreatedAt
=
fClock
.
Now
()
.
Unix
()
*
expected
.
CreatedAt
=
fClock
.
Now
()
.
Unix
()
id
,
err
:=
ds
.
CreateContainer
(
"sandboxid"
,
config
,
sConfig
)
id
,
err
:=
ds
.
CreateContainer
(
"sandboxid"
,
config
,
sConfig
)
// Set the id manually since we don't know the id until it's created.
// Set the id manually since we don't know the id until it's created.
...
@@ -144,7 +144,7 @@ func TestContainerStatus(t *testing.T) {
...
@@ -144,7 +144,7 @@ func TestContainerStatus(t *testing.T) {
assert
.
Equal
(
t
,
expected
,
status
)
assert
.
Equal
(
t
,
expected
,
status
)
// Advance the clock and stop the container.
// 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
.
FinishedAt
=
fClock
.
Now
()
.
Unix
()
*
expected
.
State
=
runtimeApi
.
ContainerState_EXITED
*
expected
.
State
=
runtimeApi
.
ContainerState_EXITED
*
expected
.
Reason
=
"Completed"
*
expected
.
Reason
=
"Completed"
...
...
pkg/kubelet/dockershim/docker_service_test.go
View file @
3d1263d2
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
)
)
func
newTestDockerSevice
()
(
*
dockerService
,
*
dockertools
.
FakeDockerClient
,
*
clock
.
FakeClock
)
{
func
newTestDockerSevice
()
(
*
dockerService
,
*
dockertools
.
FakeDockerClient
,
*
clock
.
FakeClock
)
{
c
:=
dockertools
.
NewFakeDockerClient
()
fakeClock
:=
clock
.
NewFakeClock
(
time
.
Time
{})
fakeClock
:=
clock
.
NewFakeClock
(
time
.
Time
{})
c
:=
dockertools
.
NewFakeDockerClientWithClock
(
fakeClock
)
return
&
dockerService
{
client
:
c
},
c
,
fakeClock
return
&
dockerService
{
client
:
c
},
c
,
fakeClock
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment