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

Function TestUpdateHandler

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

Source from the content-addressed store, hash-verified

403}
404
405func 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 {

Callers

nothing calls this directly

Calls 6

resetGlobalStateFunction · 0.85
storeSelectedNamespacesFunction · 0.85
newTestControllerFunction · 0.85
UpdateMethod · 0.80
GetMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected