@@ -20,6 +20,11 @@ import { awaitJobCompleted } from './utils/operations.mjs';
2020// Resolve the CSV fixture path relative to this file so Harper can read it.
2121const SUPPLIERS_CSV = path . join ( path . dirname ( fileURLToPath ( import . meta. url ) ) , 'data/Suppliers.csv' ) ;
2222
23+ // On Bun shard 2, embed-directive tear-down (HNSW flush) starves the job processor,
24+ // so csv_data_load can sit IN_PROGRESS past the default 30s. Same pattern as northwind.
25+ const isBunRuntime = process . env . HARPER_RUNTIME === 'bun' ;
26+ const JOB_TIMEOUT_SECONDS = isBunRuntime ? 120 : 30 ;
27+
2328suite ( 'Terminology aliases (database / primary_key)' , ( ctx ) => {
2429 let client ;
2530
@@ -421,7 +426,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
421426 } )
422427 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
423428 . expect ( 200 ) ;
424- await awaitJobCompleted ( client , r . body . job_id ) ;
429+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
425430 } ) ;
426431
427432 test ( 'delete_records_before without database starts job' , async ( ) => {
@@ -430,7 +435,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
430435 . send ( { operation : 'delete_records_before' , table : 'friends' , date : '2050-01-25T23:05:27.464' } )
431436 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
432437 . expect ( 200 ) ;
433- await awaitJobCompleted ( client , r . body . job_id ) ;
438+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
434439 } ) ;
435440
436441 test ( 'delete_audit_logs_before with database param starts job' , async ( ) => {
@@ -444,7 +449,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
444449 } )
445450 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
446451 . expect ( 200 ) ;
447- await awaitJobCompleted ( client , r . body . job_id ) ;
452+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
448453 } ) ;
449454
450455 test ( 'delete_audit_logs_before without database starts job' , async ( ) => {
@@ -453,7 +458,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
453458 . send ( { operation : 'delete_audit_logs_before' , table : 'friends' , timestamp : 1690553291764 } )
454459 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
455460 . expect ( 200 ) ;
456- await awaitJobCompleted ( client , r . body . job_id ) ;
461+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
457462 } ) ;
458463
459464 test ( 'csv_file_load with database param starts job' , async ( ) => {
@@ -467,7 +472,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
467472 } )
468473 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
469474 . expect ( 200 ) ;
470- await awaitJobCompleted ( client , r . body . job_id ) ;
475+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
471476 } ) ;
472477
473478 test ( 'csv_file_load without database for non-existent table returns error' , async ( ) => {
@@ -484,7 +489,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
484489 . send ( { operation : 'csv_file_load' , table : 'friends' , file_path : SUPPLIERS_CSV } )
485490 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
486491 . expect ( 200 ) ;
487- await awaitJobCompleted ( client , r . body . job_id ) ;
492+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
488493 } ) ;
489494
490495 test ( 'csv_data_load without database starts job' , async ( ) => {
@@ -498,7 +503,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
498503 . send ( { operation : 'csv_data_load' , table : 'friends' , data } )
499504 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
500505 . expect ( 200 ) ;
501- await awaitJobCompleted ( client , r . body . job_id ) ;
506+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
502507 } ) ;
503508
504509 test ( 'csv_data_load with database param starts job' , async ( ) => {
@@ -510,7 +515,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
510515 . send ( { operation : 'csv_data_load' , database : 'job_guy' , table : 'working' , data } )
511516 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
512517 . expect ( 200 ) ;
513- await awaitJobCompleted ( client , r . body . job_id ) ;
518+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
514519 } ) ;
515520
516521 test ( 'export_local starts job' , async ( ) => {
@@ -525,7 +530,7 @@ suite('Terminology aliases (database / primary_key)', (ctx) => {
525530 } )
526531 . expect ( ( r ) => assert . ok ( r . body . message . includes ( 'Starting job with id' ) , r . text ) )
527532 . expect ( 200 ) ;
528- await awaitJobCompleted ( client , r . body . job_id ) ;
533+ await awaitJobCompleted ( client , r . body . job_id , { timeoutSeconds : JOB_TIMEOUT_SECONDS } ) ;
529534 } ) ;
530535
531536 // ── final teardown ──────────────────────────────────────────────────────
0 commit comments