TestAutoSyncIndicateError verifies we skip auto-sync and return error condition if previous sync failed
(t *testing.T)
| 890 | |
| 891 | // TestAutoSyncIndicateError verifies we skip auto-sync and return error condition if previous sync failed |
| 892 | func TestAutoSyncIndicateError(t *testing.T) { |
| 893 | app := newFakeApp() |
| 894 | app.Spec.Source.Helm = &v1alpha1.ApplicationSourceHelm{ |
| 895 | Parameters: []v1alpha1.HelmParameter{ |
| 896 | { |
| 897 | Name: "a", |
| 898 | Value: "1", |
| 899 | }, |
| 900 | }, |
| 901 | } |
| 902 | ctrl := newFakeController(t.Context(), &fakeData{apps: []runtime.Object{app}}, nil) |
| 903 | syncStatus := v1alpha1.SyncStatus{ |
| 904 | Status: v1alpha1.SyncStatusCodeOutOfSync, |
| 905 | Revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 906 | } |
| 907 | app.Status.OperationState = &v1alpha1.OperationState{ |
| 908 | Operation: v1alpha1.Operation{ |
| 909 | Sync: &v1alpha1.SyncOperation{ |
| 910 | Source: app.Spec.Source.DeepCopy(), |
| 911 | }, |
| 912 | }, |
| 913 | Phase: synccommon.OperationFailed, |
| 914 | SyncResult: &v1alpha1.SyncOperationResult{ |
| 915 | Revision: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 916 | Source: *app.Spec.Source.DeepCopy(), |
| 917 | }, |
| 918 | } |
| 919 | cond, _ := ctrl.autoSync(app, &syncStatus, []v1alpha1.ResourceStatus{{Name: "guestbook", Kind: kube.DeploymentKind, Status: v1alpha1.SyncStatusCodeOutOfSync}}, true) |
| 920 | assert.NotNil(t, cond) |
| 921 | app, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(test.FakeArgoCDNamespace).Get(t.Context(), "my-app", metav1.GetOptions{}) |
| 922 | require.NoError(t, err) |
| 923 | assert.Nil(t, app.Operation) |
| 924 | } |
| 925 | |
| 926 | // TestAutoSyncParameterOverrides verifies we auto-sync if revision is same but parameter overrides are different |
| 927 | func TestAutoSyncParameterOverrides(t *testing.T) { |
nothing calls this directly
no test coverage detected