@@ -29,7 +29,6 @@ import (
29
29
"k8s.io/client-go/kubernetes/fake"
30
30
"k8s.io/client-go/tools/record"
31
31
32
- clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
33
32
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
34
33
karmadafake "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/fake"
35
34
"github.com/karmada-io/karmada/pkg/util"
@@ -162,78 +161,6 @@ func TestCreateScheduler(t *testing.T) {
162
161
})
163
162
}
164
163
}
165
-
166
- func TestReconcileEstimatorConnection (t * testing.T ) {
167
- dynamicClient := dynamicfake .NewSimpleDynamicClient (runtime .NewScheme ())
168
- karmadaClient := karmadafake .NewSimpleClientset ()
169
- kubeClient := fake .NewSimpleClientset ()
170
- scheduler , err := NewScheduler (dynamicClient , karmadaClient , kubeClient , WithEnableSchedulerEstimator (true ))
171
- if err != nil {
172
- t .Fatalf ("Failed to create scheduler: %v" , err )
173
- }
174
-
175
- clusterName := "test-cluster"
176
- cluster := & clusterv1alpha1.Cluster {
177
- ObjectMeta : metav1.ObjectMeta {Name : clusterName },
178
- Spec : clusterv1alpha1.ClusterSpec {SyncMode : clusterv1alpha1 .Pull },
179
- }
180
- _ , err = karmadaClient .ClusterV1alpha1 ().Clusters ().Create (context .TODO (), cluster , metav1.CreateOptions {})
181
- if err != nil {
182
- t .Fatalf ("Failed to create cluster: %v" , err )
183
- }
184
-
185
- tests := []struct {
186
- name string
187
- key util.QueueKey
188
- disableSchedulerEstimatorInPullMode bool
189
- expectedError bool
190
- expectEstablishConnection bool
191
- }{
192
- {
193
- name : "Invalid key" ,
194
- key : 123 ,
195
- expectedError : true ,
196
- },
197
- {
198
- name : "Cluster not found" ,
199
- key : "non-existent-cluster" ,
200
- expectedError : false ,
201
- },
202
- {
203
- name : "Cluster in pull mode, estimator disabled" ,
204
- key : clusterName ,
205
- disableSchedulerEstimatorInPullMode : true ,
206
- expectedError : false ,
207
- expectEstablishConnection : false ,
208
- },
209
- {
210
- name : "Cluster in pull mode, estimator enabled" ,
211
- key : clusterName ,
212
- disableSchedulerEstimatorInPullMode : false ,
213
- expectedError : false ,
214
- expectEstablishConnection : true ,
215
- },
216
- }
217
-
218
- for _ , tt := range tests {
219
- t .Run (tt .name , func (t * testing.T ) {
220
- scheduler .disableSchedulerEstimatorInPullMode = tt .disableSchedulerEstimatorInPullMode
221
-
222
- err := scheduler .reconcileEstimatorConnection (tt .key )
223
- if (err != nil ) != tt .expectedError {
224
- t .Errorf ("reconcileEstimatorConnection() error = %v, expectedError %v" , err , tt .expectedError )
225
- }
226
-
227
- // We can't directly assert whether EstablishConnection is called.
228
- // Instead, we'll check for conditions around its invocation.
229
- // If EstablishConnection should be called, the error should be nil, and no early returns should have occurred.
230
- if tt .expectEstablishConnection && err != nil {
231
- t .Errorf ("Expected EstablishConnection to be called, but got error: %v" , err )
232
- }
233
- })
234
- }
235
- }
236
-
237
164
func Test_patchBindingStatusCondition (t * testing.T ) {
238
165
oneHourBefore := time .Now ().Add (- 1 * time .Hour ).Round (time .Second )
239
166
oneHourAfter := time .Now ().Add (1 * time .Hour ).Round (time .Second )
0 commit comments