mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-25 14:42:33 +00:00
Use a single deep copied object between all reactors in fake client
Kubernetes-commit: 41ebb22011cb79aed2241417249e824cdfcda5fc
This commit is contained in:
committed by
Kubernetes Publisher
parent
0c67a1f23f
commit
711082b69f
@@ -131,13 +131,14 @@ func (c *Fake) Invokes(action Action, defaultReturnObj runtime.Object) (runtime.
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
actionCopy := action.DeepCopy()
|
||||
c.actions = append(c.actions, action.DeepCopy())
|
||||
for _, reactor := range c.ReactionChain {
|
||||
if !reactor.Handles(action) {
|
||||
if !reactor.Handles(actionCopy) {
|
||||
continue
|
||||
}
|
||||
|
||||
handled, ret, err := reactor.React(action.DeepCopy())
|
||||
handled, ret, err := reactor.React(actionCopy)
|
||||
if !handled {
|
||||
continue
|
||||
}
|
||||
@@ -154,13 +155,14 @@ func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
actionCopy := action.DeepCopy()
|
||||
c.actions = append(c.actions, action.DeepCopy())
|
||||
for _, reactor := range c.WatchReactionChain {
|
||||
if !reactor.Handles(action) {
|
||||
if !reactor.Handles(actionCopy) {
|
||||
continue
|
||||
}
|
||||
|
||||
handled, ret, err := reactor.React(action.DeepCopy())
|
||||
handled, ret, err := reactor.React(actionCopy)
|
||||
if !handled {
|
||||
continue
|
||||
}
|
||||
@@ -177,13 +179,14 @@ func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
actionCopy := action.DeepCopy()
|
||||
c.actions = append(c.actions, action.DeepCopy())
|
||||
for _, reactor := range c.ProxyReactionChain {
|
||||
if !reactor.Handles(action) {
|
||||
if !reactor.Handles(actionCopy) {
|
||||
continue
|
||||
}
|
||||
|
||||
handled, ret, err := reactor.React(action.DeepCopy())
|
||||
handled, ret, err := reactor.React(actionCopy)
|
||||
if !handled || err != nil {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user