@@ -36,11 +36,13 @@ func TestClusterSecretUpdater(t *testing.T) {
36
36
var tests = []struct {
37
37
LastCacheSyncTime * time.Time
38
38
SyncError error
39
+ ConnectionStatus clustercache.ConnectionStatus
39
40
ExpectedStatus v1alpha1.ConnectionStatus
40
41
}{
41
- {nil , nil , v1alpha1 .ConnectionStatusUnknown },
42
- {& now , nil , v1alpha1 .ConnectionStatusSuccessful },
43
- {& now , fmt .Errorf ("sync failed" ), v1alpha1 .ConnectionStatusFailed },
42
+ {nil , nil , clustercache .ConnectionStatusUnknown , v1alpha1 .ConnectionStatusUnknown },
43
+ {& now , nil , clustercache .ConnectionStatusSuccessful , v1alpha1 .ConnectionStatusSuccessful },
44
+ {& now , fmt .Errorf ("sync failed" ), clustercache .ConnectionStatusSuccessful , v1alpha1 .ConnectionStatusFailed },
45
+ {& now , nil , clustercache .ConnectionStatusFailed , v1alpha1 .ConnectionStatusFailed },
44
46
}
45
47
46
48
emptyArgoCDConfigMap := & v1.ConfigMap {
@@ -78,12 +80,27 @@ func TestClusterSecretUpdater(t *testing.T) {
78
80
cluster , err := argoDB .CreateCluster (ctx , & v1alpha1.Cluster {Server : "http://minikube" })
79
81
assert .NoError (t , err , "Test prepare test data create cluster failed" )
80
82
83
+ fakeApp := & v1alpha1.Application {
84
+ ObjectMeta : metav1.ObjectMeta {
85
+ Name : "fake-app" ,
86
+ Namespace : fakeNamespace ,
87
+ },
88
+ Spec : v1alpha1.ApplicationSpec {
89
+ Destination : v1alpha1.ApplicationDestination {
90
+ Server : cluster .Server ,
91
+ },
92
+ },
93
+ }
94
+ err = appInformer .GetIndexer ().Add (fakeApp )
95
+ assert .NoError (t , err )
96
+
81
97
for _ , test := range tests {
82
98
info := & clustercache.ClusterInfo {
83
99
Server : cluster .Server ,
84
100
K8SVersion : updatedK8sVersion ,
85
101
LastCacheSyncTime : test .LastCacheSyncTime ,
86
102
SyncError : test .SyncError ,
103
+ ConnectionStatus : test .ConnectionStatus ,
87
104
}
88
105
89
106
lister := applisters .NewApplicationLister (appInformer .GetIndexer ()).Applications (fakeNamespace )
0 commit comments