(t *testing.T)
| 403 | } |
| 404 | |
| 405 | func TestUpdateHandler(t *testing.T) { |
| 406 | tests := []struct { |
| 407 | name string |
| 408 | ignoredNamespaces []string |
| 409 | namespaceSelector string |
| 410 | cachedNamespaces []string |
| 411 | oldResource interface{} |
| 412 | newResource interface{} |
| 413 | expectQueueItem bool |
| 414 | }{ |
| 415 | { |
| 416 | name: "Namespace resource - should not queue", |
| 417 | ignoredNamespaces: []string{}, |
| 418 | oldResource: &v1.Namespace{ |
| 419 | ObjectMeta: metav1.ObjectMeta{Name: "test-ns"}, |
| 420 | }, |
| 421 | newResource: &v1.Namespace{ |
| 422 | ObjectMeta: metav1.ObjectMeta{Name: "test-ns"}, |
| 423 | }, |
| 424 | expectQueueItem: false, |
| 425 | }, |
| 426 | { |
| 427 | name: "ConfigMap in ignored namespace", |
| 428 | ignoredNamespaces: []string{"kube-system"}, |
| 429 | oldResource: &v1.ConfigMap{ |
| 430 | ObjectMeta: metav1.ObjectMeta{ |
| 431 | Name: "test-cm", |
| 432 | Namespace: "kube-system", |
| 433 | }, |
| 434 | }, |
| 435 | newResource: &v1.ConfigMap{ |
| 436 | ObjectMeta: metav1.ObjectMeta{ |
| 437 | Name: "test-cm", |
| 438 | Namespace: "kube-system", |
| 439 | }, |
| 440 | }, |
| 441 | expectQueueItem: false, |
| 442 | }, |
| 443 | { |
| 444 | name: "ConfigMap not in selected namespace", |
| 445 | ignoredNamespaces: []string{}, |
| 446 | namespaceSelector: "env=prod", |
| 447 | cachedNamespaces: []string{"prod-ns"}, |
| 448 | oldResource: &v1.ConfigMap{ |
| 449 | ObjectMeta: metav1.ObjectMeta{ |
| 450 | Name: "test-cm", |
| 451 | Namespace: "dev-ns", |
| 452 | }, |
| 453 | }, |
| 454 | newResource: &v1.ConfigMap{ |
| 455 | ObjectMeta: metav1.ObjectMeta{ |
| 456 | Name: "test-cm", |
| 457 | Namespace: "dev-ns", |
| 458 | }, |
| 459 | }, |
| 460 | expectQueueItem: false, |
| 461 | }, |
| 462 | { |
nothing calls this directly
no test coverage detected