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
f12a6c16
Commit
f12a6c16
authored
Jan 06, 2017
by
zhouhaibing089
Committed by
haibzhou
Jan 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use fake clock in lruexpiration cache test
parent
7841d57b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
BUILD
pkg/util/cache/BUILD
+4
-1
lruexpirecache_test.go
pkg/util/cache/lruexpirecache_test.go
+7
-2
No files found.
pkg/util/cache/BUILD
View file @
f12a6c16
...
...
@@ -26,7 +26,10 @@ go_test(
],
library = ":go_default_library",
tags = ["automanaged"],
deps = ["//vendor:github.com/golang/groupcache/lru"],
deps = [
"//pkg/util/clock:go_default_library",
"//vendor:github.com/golang/groupcache/lru",
],
)
filegroup(
...
...
pkg/util/cache/lruexpirecache_test.go
View file @
f12a6c16
...
...
@@ -20,6 +20,8 @@ import (
"testing"
"time"
"k8s.io/kubernetes/pkg/util/clock"
"github.com/golang/groupcache/lru"
)
...
...
@@ -43,8 +45,11 @@ func TestSimpleGet(t *testing.T) {
}
func
TestExpiredGet
(
t
*
testing
.
T
)
{
c
:=
NewLRUExpireCache
(
10
)
c
.
Add
(
"short-lived"
,
"12345"
,
0
*
time
.
Second
)
fakeClock
:=
clock
.
NewFakeClock
(
time
.
Now
())
c
:=
NewLRUExpireCacheWithClock
(
10
,
fakeClock
)
c
.
Add
(
"short-lived"
,
"12345"
,
1
*
time
.
Millisecond
)
// ensure the entry expired
fakeClock
.
Step
(
2
*
time
.
Millisecond
)
expectNotEntry
(
t
,
c
,
"short-lived"
)
}
...
...
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