Skip to content

Commit cb2886a

Browse files
committed
add review comments
Signed-off-by: Vamshi Maskuri <[email protected]>
1 parent fab20d6 commit cb2886a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/scheduler/scheduler_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func TestReconcileEstimatorConnection(t *testing.T) {
187187
key util.QueueKey
188188
disableSchedulerEstimatorInPullMode bool
189189
expectedError bool
190+
expectEstablishConnection bool
190191
}{
191192
{
192193
name: "Invalid key",
@@ -203,22 +204,32 @@ func TestReconcileEstimatorConnection(t *testing.T) {
203204
key: clusterName,
204205
disableSchedulerEstimatorInPullMode: true,
205206
expectedError: false,
207+
expectEstablishConnection: false,
206208
},
207209
{
208210
name: "Cluster in pull mode, estimator enabled",
209211
key: clusterName,
210212
disableSchedulerEstimatorInPullMode: false,
211213
expectedError: false,
214+
expectEstablishConnection: true,
212215
},
213216
}
214217

215218
for _, tt := range tests {
216219
t.Run(tt.name, func(t *testing.T) {
217220
scheduler.disableSchedulerEstimatorInPullMode = tt.disableSchedulerEstimatorInPullMode
221+
218222
err := scheduler.reconcileEstimatorConnection(tt.key)
219223
if (err != nil) != tt.expectedError {
220224
t.Errorf("reconcileEstimatorConnection() error = %v, expectedError %v", err, tt.expectedError)
221225
}
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+
}
222233
})
223234
}
224235
}

0 commit comments

Comments
 (0)