(t *testing.T)
| 230 | } |
| 231 | |
| 232 | func TestWatchAddAfterStop(t *testing.T) { |
| 233 | testResource := schema.GroupVersionResource{Group: "", Version: "test_version", Resource: "test_kind"} |
| 234 | testObj := getArbitraryResource(testResource, "test_name", "test_namespace") |
| 235 | accessor, err := meta.Accessor(testObj) |
| 236 | if err != nil { |
| 237 | t.Fatalf("unexpected error: %v", err) |
| 238 | } |
| 239 | |
| 240 | ns := accessor.GetNamespace() |
| 241 | scheme := runtime.NewScheme() |
| 242 | codecs := serializer.NewCodecFactory(scheme) |
| 243 | o := NewObjectTracker(scheme, codecs.UniversalDecoder()) |
| 244 | watch, err := o.Watch(testResource, ns) |
| 245 | if err != nil { |
| 246 | t.Errorf("watch creation failed: %v", err) |
| 247 | } |
| 248 | |
| 249 | // When the watch is stopped it should ignore later events without panicking. |
| 250 | defer func() { |
| 251 | if r := recover(); r != nil { |
| 252 | t.Errorf("Watch panicked when it should have ignored create after stop: %v", r) |
| 253 | } |
| 254 | }() |
| 255 | |
| 256 | watch.Stop() |
| 257 | err = o.Create(testResource, testObj, ns) |
| 258 | if err != nil { |
| 259 | t.Errorf("test resource creation failed: %v", err) |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | func TestPatchWithMissingObject(t *testing.T) { |
| 264 | nodesResource := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"} |
nothing calls this directly
no test coverage detected