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
2c429367
Commit
2c429367
authored
Oct 18, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix more RS controller flakes
parent
6ea0d05a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
17 deletions
+7
-17
replica_set_test.go
pkg/controller/replicaset/replica_set_test.go
+7
-17
No files found.
pkg/controller/replicaset/replica_set_test.go
View file @
2c429367
...
@@ -52,6 +52,8 @@ import (
...
@@ -52,6 +52,8 @@ import (
func
testNewReplicaSetControllerFromClient
(
client
clientset
.
Interface
,
stopCh
chan
struct
{},
burstReplicas
int
,
lookupCacheSize
int
)
*
ReplicaSetController
{
func
testNewReplicaSetControllerFromClient
(
client
clientset
.
Interface
,
stopCh
chan
struct
{},
burstReplicas
int
,
lookupCacheSize
int
)
*
ReplicaSetController
{
informers
:=
informers
.
NewSharedInformerFactory
(
client
,
controller
.
NoResyncPeriodFunc
())
informers
:=
informers
.
NewSharedInformerFactory
(
client
,
controller
.
NoResyncPeriodFunc
())
ret
:=
NewReplicaSetController
(
informers
.
ReplicaSets
(),
informers
.
Pods
(),
client
,
burstReplicas
,
lookupCacheSize
,
false
)
ret
:=
NewReplicaSetController
(
informers
.
ReplicaSets
(),
informers
.
Pods
(),
client
,
burstReplicas
,
lookupCacheSize
,
false
)
ret
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
ret
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
informers
.
Start
(
stopCh
)
informers
.
Start
(
stopCh
)
return
ret
return
ret
}
}
...
@@ -299,8 +301,6 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
...
@@ -299,8 +301,6 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
// Steady state for the ReplicaSet, no Status.Replicas updates expected
// Steady state for the ReplicaSet, no Status.Replicas updates expected
activePods
:=
5
activePods
:=
5
...
@@ -347,8 +347,6 @@ func TestControllerUpdateReplicas(t *testing.T) {
...
@@ -347,8 +347,6 @@ func TestControllerUpdateReplicas(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
// Insufficient number of pods in the system, and Status.Replicas is wrong;
// Insufficient number of pods in the system, and Status.Replicas is wrong;
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
...
@@ -398,8 +396,7 @@ func TestSyncReplicaSetDormancy(t *testing.T) {
...
@@ -398,8 +396,7 @@ func TestSyncReplicaSetDormancy(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
podControl
=
&
fakePodControl
manager
.
podControl
=
&
fakePodControl
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
...
@@ -524,7 +521,9 @@ func TestWatchControllers(t *testing.T) {
...
@@ -524,7 +521,9 @@ func TestWatchControllers(t *testing.T) {
client
.
AddWatchReactor
(
"replicasets"
,
core
.
DefaultWatchReactor
(
fakeWatch
,
nil
))
client
.
AddWatchReactor
(
"replicasets"
,
core
.
DefaultWatchReactor
(
fakeWatch
,
nil
))
stopCh
:=
make
(
chan
struct
{})
stopCh
:=
make
(
chan
struct
{})
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
informers
:=
informers
.
NewSharedInformerFactory
(
client
,
controller
.
NoResyncPeriodFunc
())
manager
:=
NewReplicaSetController
(
informers
.
ReplicaSets
(),
informers
.
Pods
(),
client
,
BurstReplicas
,
0
,
false
)
informers
.
Start
(
stopCh
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
var
testRSSpec
extensions
.
ReplicaSet
var
testRSSpec
extensions
.
ReplicaSet
...
@@ -567,8 +566,6 @@ func TestWatchPods(t *testing.T) {
...
@@ -567,8 +566,6 @@ func TestWatchPods(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
// Put one ReplicaSet and one pod into the controller's stores
// Put one ReplicaSet and one pod into the controller's stores
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
...
@@ -691,8 +688,6 @@ func TestControllerUpdateRequeue(t *testing.T) {
...
@@ -691,8 +688,6 @@ func TestControllerUpdateRequeue(t *testing.T) {
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
&
registered
.
GroupOrDie
(
api
.
GroupName
)
.
GroupVersion
}})
client
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
testServer
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
&
registered
.
GroupOrDie
(
api
.
GroupName
)
.
GroupVersion
}})
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
rs
:=
newReplicaSet
(
1
,
labelMap
)
rs
:=
newReplicaSet
(
1
,
labelMap
)
...
@@ -1131,8 +1126,7 @@ func setupManagerWithGCEnabled(stopCh chan struct{}, objs ...runtime.Object) (ma
...
@@ -1131,8 +1126,7 @@ func setupManagerWithGCEnabled(stopCh chan struct{}, objs ...runtime.Object) (ma
manager
=
testNewReplicaSetControllerFromClient
(
c
,
stopCh
,
BurstReplicas
,
0
)
manager
=
testNewReplicaSetControllerFromClient
(
c
,
stopCh
,
BurstReplicas
,
0
)
manager
.
garbageCollectorEnabled
=
true
manager
.
garbageCollectorEnabled
=
true
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
podControl
=
fakePodControl
manager
.
podControl
=
fakePodControl
return
manager
,
fakePodControl
return
manager
,
fakePodControl
}
}
...
@@ -1357,8 +1351,6 @@ func TestReadyReplicas(t *testing.T) {
...
@@ -1357,8 +1351,6 @@ func TestReadyReplicas(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
...
@@ -1402,8 +1394,6 @@ func TestAvailableReplicas(t *testing.T) {
...
@@ -1402,8 +1394,6 @@ func TestAvailableReplicas(t *testing.T) {
defer
close
(
stopCh
)
defer
close
(
stopCh
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
:=
testNewReplicaSetControllerFromClient
(
client
,
stopCh
,
BurstReplicas
,
0
)
manager
.
podListerSynced
=
alwaysReady
manager
.
podListerSynced
=
alwaysReady
manager
.
podLister
=
&
cache
.
StoreToPodLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
manager
.
rsLister
=
&
cache
.
StoreToReplicaSetLister
{
Indexer
:
cache
.
NewIndexer
(
cache
.
DeletionHandlingMetaNamespaceKeyFunc
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
})}
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
// Status.Replica should update to match number of pods in system, 1 new pod should be created.
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
labelMap
:=
map
[
string
]
string
{
"foo"
:
"bar"
}
...
...
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