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

Function TestHandleAppUpdated

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

Source from the content-addressed store, hash-verified

1714}
1715
1716func 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
1735func TestHandleOrphanedResourceUpdated(t *testing.T) {
1736 app1 := newFakeApp()

Callers

nothing calls this directly

Calls 8

newFakeControllerFunction · 0.85
handleObjectUpdatedMethod · 0.80
InstanceNameMethod · 0.80
isRefreshRequestedMethod · 0.80
newFakeAppFunction · 0.70
ContextMethod · 0.65
DeepCopyMethod · 0.45
QualifiedNameMethod · 0.45

Tested by

no test coverage detected