MCPcopy Create free account
hub / github.com/stakater/Reloader / TestDeleteHandler

Function TestDeleteHandler

internal/pkg/controller/controller_test.go:526–623  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

524}
525
526func TestDeleteHandler(t *testing.T) {
527 tests := []struct {
528 name string
529 reloadOnDelete string
530 ignoredNamespaces []string
531 resource interface{}
532 controllersInit bool
533 expectQueueItem bool
534 }{
535 {
536 name: "ReloadOnDelete disabled",
537 reloadOnDelete: "false",
538 ignoredNamespaces: []string{},
539 resource: &v1.ConfigMap{
540 ObjectMeta: metav1.ObjectMeta{
541 Name: "test-cm",
542 Namespace: "default",
543 },
544 },
545 controllersInit: true,
546 expectQueueItem: false,
547 },
548 {
549 name: "ConfigMap in ignored namespace",
550 reloadOnDelete: "true",
551 ignoredNamespaces: []string{"kube-system"},
552 resource: &v1.ConfigMap{
553 ObjectMeta: metav1.ObjectMeta{
554 Name: "test-cm",
555 Namespace: "kube-system",
556 },
557 },
558 controllersInit: true,
559 expectQueueItem: false,
560 },
561 {
562 name: "Controllers not initialized",
563 reloadOnDelete: "true",
564 ignoredNamespaces: []string{},
565 resource: &v1.ConfigMap{
566 ObjectMeta: metav1.ObjectMeta{
567 Name: "test-cm",
568 Namespace: "default",
569 },
570 },
571 controllersInit: false,
572 expectQueueItem: false,
573 },
574 {
575 name: "Valid ConfigMap delete - should queue",
576 reloadOnDelete: "true",
577 ignoredNamespaces: []string{},
578 resource: &v1.ConfigMap{
579 ObjectMeta: metav1.ObjectMeta{
580 Name: "test-cm",
581 Namespace: "default",
582 },
583 },

Callers

nothing calls this directly

Calls 5

resetGlobalStateFunction · 0.85
newTestControllerFunction · 0.85
GetMethod · 0.80
RunMethod · 0.65
DeleteMethod · 0.65

Tested by

no test coverage detected