(t *testing.T)
| 1714 | } |
| 1715 | |
| 1716 | func TestHandleAppUpdated(t *testing.T) { |
| 1717 | app := newFakeApp() |
| 1718 | app.Spec.Destination.Namespace = test.FakeArgoCDNamespace |
| 1719 | app.Spec.Destination.Server = v1alpha1.KubernetesInternalAPIServerAddr |
| 1720 | proj := defaultProj.DeepCopy() |
| 1721 | proj.Spec.SourceNamespaces = []string{test.FakeArgoCDNamespace} |
| 1722 | ctrl := newFakeController(t.Context(), &fakeData{apps: []runtime.Object{app, proj}}, nil) |
| 1723 | |
| 1724 | ctrl.handleObjectUpdated(map[string]bool{app.InstanceName(ctrl.namespace): true}, kube.GetObjectRef(kube.MustToUnstructured(app))) |
| 1725 | isRequested, level := ctrl.isRefreshRequested(app.QualifiedName()) |
| 1726 | assert.False(t, isRequested) |
| 1727 | assert.Equal(t, ComparisonWithNothing, level) |
| 1728 | |
| 1729 | ctrl.handleObjectUpdated(map[string]bool{app.InstanceName(ctrl.namespace): true}, corev1.ObjectReference{UID: "test", Kind: kube.DeploymentKind, Name: "test", Namespace: "default"}) |
| 1730 | isRequested, level = ctrl.isRefreshRequested(app.QualifiedName()) |
| 1731 | assert.True(t, isRequested) |
| 1732 | assert.Equal(t, CompareWithRecent, level) |
| 1733 | } |
| 1734 | |
| 1735 | func TestHandleOrphanedResourceUpdated(t *testing.T) { |
| 1736 | app1 := newFakeApp() |
nothing calls this directly
no test coverage detected