@@ -180,12 +180,12 @@ func (b *fakeBatchClient) snapshot() (creates, cancels []string) {
180180// Helpers
181181// =============================================================================
182182
183- // newTestAsyncPlanner builds a AsyncPlanner with the given fakes and worker count
183+ // newTestPlanner builds a Planner with the given fakes and worker count
184184// and registers a cleanup that calls Close so leaked workers can't bleed
185185// across tests.
186- func newTestAsyncPlanner (t * testing.T , bc plannerclient.BatchClient , prov * fakeProvisioner , workers int ) * AsyncPlanner {
186+ func newTestPlanner (t * testing.T , bc plannerclient.BatchClient , prov * fakeProvisioner , workers int ) * Planner {
187187 t .Helper ()
188- q := NewAsyncPlanner (bc , prov , workers )
188+ q := NewPlanner (bc , prov , workers )
189189 t .Cleanup (func () {
190190 _ = q .Close ()
191191 })
@@ -227,7 +227,7 @@ func waitFor(t *testing.T, timeout time.Duration, cond func() bool, msg string)
227227func TestEnqueueValidation (t * testing.T ) {
228228 prov := & fakeProvisioner {}
229229 bc := & fakeBatchClient {}
230- q := newTestAsyncPlanner (t , bc , prov , 1 )
230+ q := newTestPlanner (t , bc , prov , 1 )
231231
232232 cases := []struct {
233233 name string
@@ -263,7 +263,7 @@ func TestEnqueueValidation(t *testing.T) {
263263}
264264
265265func TestEnqueueWithNilProvisioner (t * testing.T ) {
266- q := NewAsyncPlanner (& fakeBatchClient {}, nil , 1 )
266+ q := NewPlanner (& fakeBatchClient {}, nil , 1 )
267267 t .Cleanup (func () { _ = q .Close () })
268268
269269 _ , err := q .Enqueue (context .Background (), validReq ("j1" ))
@@ -284,7 +284,7 @@ func TestDuplicateJobIDRejected(t *testing.T) {
284284 return & rmtypes.ProvisionResult {ProvisionID : "p1" }, nil
285285 },
286286 }
287- q := newTestAsyncPlanner (t , & fakeBatchClient {}, prov , 1 )
287+ q := newTestPlanner (t , & fakeBatchClient {}, prov , 1 )
288288
289289 if _ , err := q .Enqueue (context .Background (), validReq ("j-dup" )); err != nil {
290290 t .Fatalf ("first Enqueue: %v" , err )
@@ -310,7 +310,7 @@ func TestEnqueueReturnsPendingPlaceholder(t *testing.T) {
310310 return nil , errors .New ("provision aborted by test" )
311311 },
312312 }
313- q := newTestAsyncPlanner (t , & fakeBatchClient {}, prov , 1 )
313+ q := newTestPlanner (t , & fakeBatchClient {}, prov , 1 )
314314
315315 job , err := q .Enqueue (context .Background (), validReq ("j1" ))
316316 if err != nil {
@@ -328,7 +328,7 @@ func TestEnqueueReturnsPendingPlaceholder(t *testing.T) {
328328func TestHappyPathReachesSubmitted (t * testing.T ) {
329329 prov := & fakeProvisioner {} // default success
330330 bc := & fakeBatchClient {} // default success, batch.ID = "batch-<JobID>"
331- q := newTestAsyncPlanner (t , bc , prov , 1 )
331+ q := newTestPlanner (t , bc , prov , 1 )
332332
333333 if _ , err := q .Enqueue (context .Background (), validReq ("j1" )); err != nil {
334334 t .Fatalf ("Enqueue: %v" , err )
@@ -372,7 +372,7 @@ func TestSlowProvisionDoesNotBlockEnqueue(t *testing.T) {
372372 return & rmtypes.ProvisionResult {ProvisionID : "p-" + req .IdempotencyKey }, nil
373373 },
374374 }
375- q := newTestAsyncPlanner (t , & fakeBatchClient {}, prov , 1 )
375+ q := newTestPlanner (t , & fakeBatchClient {}, prov , 1 )
376376
377377 start := time .Now ()
378378 _ , err := q .Enqueue (context .Background (), validReq ("j-slow" ))
@@ -412,7 +412,7 @@ func TestWorkerPoolReachesConcurrency(t *testing.T) {
412412 return & rmtypes.ProvisionResult {ProvisionID : "p-" + req .IdempotencyKey }, nil
413413 },
414414 }
415- q := newTestAsyncPlanner (t , & fakeBatchClient {}, prov , workers )
415+ q := newTestPlanner (t , & fakeBatchClient {}, prov , workers )
416416
417417 for i := 0 ; i < submitted ; i ++ {
418418 if _ , err := q .Enqueue (context .Background (), validReq (fmt .Sprintf ("j%d" , i ))); err != nil {
@@ -462,7 +462,7 @@ func TestProvisionFailureMarksFailed(t *testing.T) {
462462 },
463463 }
464464 bc := & fakeBatchClient {}
465- q := newTestAsyncPlanner (t , bc , prov , 1 )
465+ q := newTestPlanner (t , bc , prov , 1 )
466466
467467 if _ , err := q .Enqueue (context .Background (), validReq ("j-bad" )); err != nil {
468468 t .Fatalf ("Enqueue j-bad: %v" , err )
@@ -521,7 +521,7 @@ func TestWaitsForProvisionRunningBeforeCreateBatch(t *testing.T) {
521521 },
522522 }
523523 bc := & fakeBatchClient {}
524- q := newTestAsyncPlanner (t , bc , prov , 1 )
524+ q := newTestPlanner (t , bc , prov , 1 )
525525 q .provPollInterval = 10 * time .Millisecond // fast polling for the test
526526
527527 if _ , err := q .Enqueue (context .Background (), validReq ("j-wait" )); err != nil {
@@ -558,7 +558,7 @@ func TestProvisionFailedDuringPollingMarksFailed(t *testing.T) {
558558 },
559559 }
560560 bc := & fakeBatchClient {}
561- q := newTestAsyncPlanner (t , bc , prov , 1 )
561+ q := newTestPlanner (t , bc , prov , 1 )
562562 q .provPollInterval = 10 * time .Millisecond
563563
564564 if _ , err := q .Enqueue (context .Background (), validReq ("j-prov-fail" )); err != nil {
@@ -596,7 +596,7 @@ func TestCreateBatchFailureReleasesResource(t *testing.T) {
596596 return nil , errors .New ("mds 503" )
597597 },
598598 }
599- q := newTestAsyncPlanner (t , bc , prov , 1 )
599+ q := newTestPlanner (t , bc , prov , 1 )
600600
601601 if _ , err := q .Enqueue (context .Background (), validReq ("j-fail" )); err != nil {
602602 t .Fatalf ("Enqueue: %v" , err )
@@ -631,7 +631,7 @@ func TestCreateBatchFailureReleaseErrorIsLoggedNotSurfaced(t *testing.T) {
631631 return nil , errors .New ("mds 503" )
632632 },
633633 }
634- q := newTestAsyncPlanner (t , bc , prov , 1 )
634+ q := newTestPlanner (t , bc , prov , 1 )
635635
636636 if _ , err := q .Enqueue (context .Background (), validReq ("j-rfail" )); err != nil {
637637 t .Fatalf ("Enqueue: %v" , err )
@@ -664,7 +664,7 @@ func TestCancelQueuedJobBeforeWorkerPicksUp(t *testing.T) {
664664 },
665665 }
666666 bc := & fakeBatchClient {}
667- q := newTestAsyncPlanner (t , bc , prov , 1 )
667+ q := newTestPlanner (t , bc , prov , 1 )
668668
669669 // Job A occupies the single worker; job B sits in the channel.
670670 if _ , err := q .Enqueue (context .Background (), validReq ("j-A" )); err != nil {
@@ -714,7 +714,7 @@ func TestCancelQueuedJobBeforeWorkerPicksUp(t *testing.T) {
714714func TestCancelSubmittedJobForwardsToMDS (t * testing.T ) {
715715 prov := & fakeProvisioner {}
716716 bc := & fakeBatchClient {}
717- q := newTestAsyncPlanner (t , bc , prov , 1 )
717+ q := newTestPlanner (t , bc , prov , 1 )
718718
719719 if _ , err := q .Enqueue (context .Background (), validReq ("j-sub" )); err != nil {
720720 t .Fatalf ("Enqueue: %v" , err )
@@ -740,7 +740,7 @@ func TestCancelSubmittedJobForwardsToMDS(t *testing.T) {
740740}
741741
742742func TestCancelUnknownJobReturnsNotFound (t * testing.T ) {
743- q := newTestAsyncPlanner (t , & fakeBatchClient {}, & fakeProvisioner {}, 1 )
743+ q := newTestPlanner (t , & fakeBatchClient {}, & fakeProvisioner {}, 1 )
744744 _ , err := q .Cancel (context .Background (), "j-ghost" )
745745 if ! errors .Is (err , plannerapi .ErrJobNotFound ) {
746746 t .Errorf ("want ErrJobNotFound; got %v" , err )
@@ -762,7 +762,7 @@ func TestCancelDuringProvisioningHonoredAfterCreateBatch(t *testing.T) {
762762 },
763763 }
764764 bc := & fakeBatchClient {}
765- q := newTestAsyncPlanner (t , bc , prov , 1 )
765+ q := newTestPlanner (t , bc , prov , 1 )
766766
767767 if _ , err := q .Enqueue (context .Background (), validReq ("j-mid-prov" )); err != nil {
768768 t .Fatalf ("Enqueue: %v" , err )
@@ -804,7 +804,7 @@ func TestCancelDuringCreateBatchHonored(t *testing.T) {
804804 },
805805 }
806806 prov := & fakeProvisioner {} // default returns ProvisionID="prov-<JobID>"
807- q := newTestAsyncPlanner (t , bc , prov , 1 )
807+ q := newTestPlanner (t , bc , prov , 1 )
808808
809809 if _ , err := q .Enqueue (context .Background (), validReq ("j-mid-create" )); err != nil {
810810 t .Fatalf ("Enqueue: %v" , err )
@@ -859,7 +859,7 @@ func TestCloseCancelsInflightProvision(t *testing.T) {
859859 return nil , ctx .Err ()
860860 },
861861 }
862- q := NewAsyncPlanner (& fakeBatchClient {}, prov , workers )
862+ q := NewPlanner (& fakeBatchClient {}, prov , workers )
863863
864864 for i := 0 ; i < workers ; i ++ {
865865 if _ , err := q .Enqueue (context .Background (), validReq (fmt .Sprintf ("j%d" , i ))); err != nil {
@@ -892,7 +892,7 @@ func TestCloseCancelsInflightProvision(t *testing.T) {
892892}
893893
894894func TestCloseIsIdempotent (t * testing.T ) {
895- q := NewAsyncPlanner (& fakeBatchClient {}, & fakeProvisioner {}, 2 )
895+ q := NewPlanner (& fakeBatchClient {}, & fakeProvisioner {}, 2 )
896896 if err := q .Close (); err != nil {
897897 t .Fatalf ("first Close: %v" , err )
898898 }
@@ -916,7 +916,7 @@ func TestCloseIsIdempotent(t *testing.T) {
916916func TestWorkerCountFloor (t * testing.T ) {
917917 prov := & fakeProvisioner {}
918918 bc := & fakeBatchClient {}
919- q := newTestAsyncPlanner (t , bc , prov , 0 ) // explicitly degenerate
919+ q := newTestPlanner (t , bc , prov , 0 ) // explicitly degenerate
920920
921921 if _ , err := q .Enqueue (context .Background (), validReq ("j1" )); err != nil {
922922 t .Fatalf ("Enqueue: %v" , err )
@@ -934,7 +934,7 @@ func TestWorkerCountFloor(t *testing.T) {
934934// =============================================================================
935935
936936func TestGetJobUnknownReturnsNotFound (t * testing.T ) {
937- q := newTestAsyncPlanner (t , & fakeBatchClient {}, & fakeProvisioner {}, 1 )
937+ q := newTestPlanner (t , & fakeBatchClient {}, & fakeProvisioner {}, 1 )
938938 _ , err := q .GetJob (context .Background (), "j-ghost" )
939939 if ! errors .Is (err , plannerapi .ErrJobNotFound ) {
940940 t .Errorf ("want ErrJobNotFound; got %v" , err )
@@ -949,7 +949,7 @@ func TestGetJobUnknownReturnsNotFound(t *testing.T) {
949949// Provision and is blocked on the fake), so its status is "provisioning".
950950// The pending window — between Enqueue and the worker picking the JobID
951951// off the submit channel — is too narrow to assert on deterministically;
952- // it's exercised by other tests that use a 0-worker AsyncPlanner .
952+ // it's exercised by other tests that use a 0-worker Planner .
953953func TestListJobsMergesProvisioningAndMDS (t * testing.T ) {
954954 // Block Provision so the local job stays unsubmitted while ListJobs
955955 // runs — that's how unsubmittedJobs picks it up.
@@ -974,7 +974,7 @@ func TestListJobsMergesProvisioningAndMDS(t *testing.T) {
974974 }, nil
975975 },
976976 }
977- q := newTestAsyncPlanner (t , bc , prov , 1 )
977+ q := newTestPlanner (t , bc , prov , 1 )
978978
979979 if _ , err := q .Enqueue (context .Background (), validReq ("j-provisioning" )); err != nil {
980980 t .Fatalf ("Enqueue: %v" , err )
@@ -1024,7 +1024,7 @@ func TestListJobsMergesProvisioningAndMDS(t *testing.T) {
10241024func TestConcurrentEnqueuesNoRace (t * testing.T ) {
10251025 prov := & fakeProvisioner {}
10261026 bc := & fakeBatchClient {}
1027- q := newTestAsyncPlanner (t , bc , prov , 4 )
1027+ q := newTestPlanner (t , bc , prov , 4 )
10281028
10291029 const N = 50
10301030 var wg sync.WaitGroup
0 commit comments