(t *testing.T)
| 3458 | } |
| 3459 | |
| 3460 | func TestAddControllerNamespace(t *testing.T) { |
| 3461 | t.Run("set controllerNamespace when the app is in the controller namespace", func(t *testing.T) { |
| 3462 | app := newFakeApp() |
| 3463 | ctrl := newFakeController(t.Context(), &fakeData{ |
| 3464 | apps: []runtime.Object{app, &defaultProj}, |
| 3465 | manifestResponse: &apiclient.ManifestResponse{}, |
| 3466 | }, nil) |
| 3467 | |
| 3468 | ctrl.processAppRefreshQueueItem() |
| 3469 | |
| 3470 | updatedApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(ctrl.namespace).Get(t.Context(), app.Name, metav1.GetOptions{}) |
| 3471 | require.NoError(t, err) |
| 3472 | assert.Equal(t, test.FakeArgoCDNamespace, updatedApp.Status.ControllerNamespace) |
| 3473 | }) |
| 3474 | t.Run("set controllerNamespace when the app is in another namespace than the controller", func(t *testing.T) { |
| 3475 | appNamespace := "app-namespace" |
| 3476 | |
| 3477 | app := newFakeApp() |
| 3478 | app.Namespace = appNamespace |
| 3479 | proj := defaultProj |
| 3480 | proj.Spec.SourceNamespaces = []string{appNamespace} |
| 3481 | ctrl := newFakeController(t.Context(), &fakeData{ |
| 3482 | apps: []runtime.Object{app, &proj}, |
| 3483 | manifestResponse: &apiclient.ManifestResponse{}, |
| 3484 | applicationNamespaces: []string{appNamespace}, |
| 3485 | }, nil) |
| 3486 | |
| 3487 | ctrl.processAppRefreshQueueItem() |
| 3488 | |
| 3489 | updatedApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(appNamespace).Get(t.Context(), app.Name, metav1.GetOptions{}) |
| 3490 | require.NoError(t, err) |
| 3491 | assert.Equal(t, test.FakeArgoCDNamespace, updatedApp.Status.ControllerNamespace) |
| 3492 | }) |
| 3493 | } |
| 3494 | |
| 3495 | func TestHelmValuesObjectHasReplaceStrategy(t *testing.T) { |
| 3496 | app := v1alpha1.Application{ |
nothing calls this directly
no test coverage detected