@@ -23,7 +23,6 @@ import {
2323 mockLastDeploymentRequest ,
2424 mockPatchScriptSettings ,
2525 mockPostConsumerById ,
26- mockPostQueueHTTPConsumer ,
2726 mockPutQueueConsumerById ,
2827} from "./helpers" ;
2928import type { QueueResponse } from "../../queues/client" ;
@@ -433,124 +432,24 @@ describe("deploy", () => {
433432 ` ) ;
434433 } ) ;
435434
436- it ( "should post queue http consumers on deploy" , async ( { expect } ) => {
437- writeWranglerConfig ( {
438- queues : {
439- consumers : [
440- {
441- queue : queueName ,
442- type : "http_pull" ,
443- dead_letter_queue : "myDLQ" ,
444- max_batch_size : 5 ,
445- visibility_timeout_ms : 4000 ,
446- max_retries : 10 ,
447- retry_delay : 1 ,
448- } ,
449- ] ,
450- } ,
451- } ) ;
452- await fs . promises . writeFile ( "index.js" , `export default {};` ) ;
453- mockSubDomainRequest ( ) ;
454- mockUploadWorkerRequest ( ) ;
455- const existingQueue : QueueResponse = {
456- queue_id : queueId ,
457- queue_name : queueName ,
458- created_on : "" ,
459- producers : [ ] ,
460- consumers : [ ] ,
461- producers_total_count : 0 ,
462- consumers_total_count : 0 ,
463- modified_on : "" ,
464- } ;
465- mockGetQueueByName ( queueName , existingQueue ) ;
466- mockPostQueueHTTPConsumer ( queueId , {
467- type : "http_pull" ,
468- dead_letter_queue : "myDLQ" ,
469- settings : {
470- batch_size : 5 ,
471- max_retries : 10 ,
472- visibility_timeout_ms : 4000 ,
473- retry_delay : 1 ,
474- } ,
475- } ) ;
476- await runWrangler ( "deploy index.js" ) ;
477- expect ( std . out ) . toMatchInlineSnapshot ( `
478- "
479- ⛅️ wrangler x.x.x
480- ──────────────────
481- Total Upload: xx KiB / gzip: xx KiB
482- Worker Startup Time: 100 ms
483- Uploaded test-name (TIMINGS)
484- Deployed test-name triggers (TIMINGS)
485- https://test-name.test-sub-domain.workers.dev
486- Consumer for queue1
487- Current Version ID: Galaxy-Class"
488- ` ) ;
489- } ) ;
490-
491- it ( "should update queue http consumers when one already exists for queue" , async ( {
435+ it ( "should reject http_pull consumer type in config" , async ( {
492436 expect,
493437 } ) => {
494438 writeWranglerConfig ( {
495439 queues : {
496440 consumers : [
497441 {
498442 queue : queueName ,
499- type : "http_pull" ,
443+ // Cast needed to simulate invalid user input that bypasses static type checking; runtime validation is what this test exercises
444+ type : "http_pull" as "worker" ,
500445 } ,
501446 ] ,
502447 } ,
503448 } ) ;
504449 await fs . promises . writeFile ( "index.js" , `export default {};` ) ;
505- mockSubDomainRequest ( ) ;
506- mockUploadWorkerRequest ( ) ;
507- const existingQueue : QueueResponse = {
508- queue_id : queueId ,
509- queue_name : queueName ,
510- created_on : "" ,
511- producers : [ ] ,
512- consumers : [
513- {
514- type : "http_pull" ,
515- consumer_id : "queue1-consumer-id" ,
516- settings : { } ,
517- } ,
518- ] ,
519- producers_total_count : 0 ,
520- consumers_total_count : 0 ,
521- modified_on : "" ,
522- } ;
523- mockGetQueueByName ( queueName , existingQueue ) ;
524-
525- msw . use (
526- http . put (
527- `*/accounts/:accountId/queues/:queueId/consumers/:consumerId` ,
528- async ( { params } ) => {
529- expect ( params . queueId ) . toEqual ( queueId ) ;
530- expect ( params . consumerId ) . toEqual ( "queue1-consumer-id" ) ;
531- expect ( params . accountId ) . toEqual ( "some-account-id" ) ;
532- return HttpResponse . json ( {
533- success : true ,
534- errors : [ ] ,
535- messages : [ ] ,
536- result : null ,
537- } ) ;
538- }
539- )
450+ await expect ( runWrangler ( "deploy index.js" ) ) . rejects . toThrowError (
451+ / O n l y " w o r k e r " c o n s u m e r s c a n b e c o n f i g u r e d i n y o u r W r a n g l e r c o n f i g u r a t i o n /
540452 ) ;
541- await runWrangler ( "deploy index.js" ) ;
542- expect ( std . out ) . toMatchInlineSnapshot ( `
543- "
544- ⛅️ wrangler x.x.x
545- ──────────────────
546- Total Upload: xx KiB / gzip: xx KiB
547- Worker Startup Time: 100 ms
548- Uploaded test-name (TIMINGS)
549- Deployed test-name triggers (TIMINGS)
550- https://test-name.test-sub-domain.workers.dev
551- Consumer for queue1
552- Current Version ID: Galaxy-Class"
553- ` ) ;
554453 } ) ;
555454
556455 it ( "should support queue consumer concurrency with a max concurrency specified" , async ( {
0 commit comments