InvokesWatch records the provided Action and then invokes the ReactionFunc that handles the action if one exists.
(action Action)
| 152 | // InvokesWatch records the provided Action and then invokes the ReactionFunc |
| 153 | // that handles the action if one exists. |
| 154 | func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) { |
| 155 | c.Lock() |
| 156 | defer c.Unlock() |
| 157 | |
| 158 | actionCopy := action.DeepCopy() |
| 159 | c.actions = append(c.actions, action.DeepCopy()) |
| 160 | for _, reactor := range c.WatchReactionChain { |
| 161 | if !reactor.Handles(actionCopy) { |
| 162 | continue |
| 163 | } |
| 164 | |
| 165 | handled, ret, err := reactor.React(actionCopy) |
| 166 | if !handled { |
| 167 | continue |
| 168 | } |
| 169 | |
| 170 | return ret, err |
| 171 | } |
| 172 | |
| 173 | return nil, fmt.Errorf("unhandled watch: %#v", action) |
| 174 | } |
| 175 | |
| 176 | // InvokesProxy records the provided Action and then invokes the ReactionFunc |
| 177 | // that handles the action if one exists. |