(t *testing.T)
| 309 | } |
| 310 | |
| 311 | func TestAddHandler(t *testing.T) { |
| 312 | tests := []struct { |
| 313 | name string |
| 314 | reloadOnCreate string |
| 315 | ignoredNamespaces []string |
| 316 | resource interface{} |
| 317 | controllersInit bool |
| 318 | expectQueueItem bool |
| 319 | }{ |
| 320 | { |
| 321 | name: "Namespace resource - should not queue", |
| 322 | reloadOnCreate: "true", |
| 323 | ignoredNamespaces: []string{}, |
| 324 | resource: &v1.Namespace{ |
| 325 | ObjectMeta: metav1.ObjectMeta{Name: "test-ns"}, |
| 326 | }, |
| 327 | controllersInit: true, |
| 328 | expectQueueItem: false, |
| 329 | }, |
| 330 | { |
| 331 | name: "ReloadOnCreate disabled", |
| 332 | reloadOnCreate: "false", |
| 333 | ignoredNamespaces: []string{}, |
| 334 | resource: &v1.ConfigMap{ |
| 335 | ObjectMeta: metav1.ObjectMeta{ |
| 336 | Name: "test-cm", |
| 337 | Namespace: "default", |
| 338 | }, |
| 339 | }, |
| 340 | controllersInit: true, |
| 341 | expectQueueItem: false, |
| 342 | }, |
| 343 | { |
| 344 | name: "ConfigMap in ignored namespace", |
| 345 | reloadOnCreate: "true", |
| 346 | ignoredNamespaces: []string{"kube-system"}, |
| 347 | resource: &v1.ConfigMap{ |
| 348 | ObjectMeta: metav1.ObjectMeta{ |
| 349 | Name: "test-cm", |
| 350 | Namespace: "kube-system", |
| 351 | }, |
| 352 | }, |
| 353 | controllersInit: true, |
| 354 | expectQueueItem: false, |
| 355 | }, |
| 356 | { |
| 357 | name: "Controllers not initialized", |
| 358 | reloadOnCreate: "true", |
| 359 | ignoredNamespaces: []string{}, |
| 360 | resource: &v1.ConfigMap{ |
| 361 | ObjectMeta: metav1.ObjectMeta{ |
| 362 | Name: "test-cm", |
| 363 | Namespace: "default", |
| 364 | }, |
| 365 | }, |
| 366 | controllersInit: false, |
| 367 | expectQueueItem: false, |
| 368 | }, |
nothing calls this directly
no test coverage detected