MCPcopy
hub / github.com/argoproj/argo-cd / TestAddControllerNamespace

Function TestAddControllerNamespace

controller/appcontroller_test.go:3460–3493  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3458}
3459
3460func 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
3495func TestHelmValuesObjectHasReplaceStrategy(t *testing.T) {
3496 app := v1alpha1.Application{

Callers

nothing calls this directly

Calls 8

newFakeControllerFunction · 0.85
newFakeAppFunction · 0.70
RunMethod · 0.65
ContextMethod · 0.65
GetMethod · 0.65
ApplicationsMethod · 0.65
ArgoprojV1alpha1Method · 0.65

Tested by

no test coverage detected