@@ -73,12 +73,9 @@ pub fn load_index_config_from_user_config(
73
73
pub fn load_index_config_update (
74
74
config_format : ConfigFormat ,
75
75
index_config_bytes : & [ u8 ] ,
76
+ current_index_parent_dir : & Uri ,
76
77
current_index_config : & IndexConfig ,
77
78
) -> anyhow:: Result < IndexConfig > {
78
- let current_index_parent_dir = & current_index_config
79
- . index_uri
80
- . parent ( )
81
- . expect ( "index URI should have a parent" ) ;
82
79
let mut new_index_config = load_index_config_from_user_config (
83
80
config_format,
84
81
index_config_bytes,
@@ -355,10 +352,11 @@ mod test {
355
352
index_id: hdfs-logs
356
353
doc_mapping: {}
357
354
"# ;
355
+ let default_root = Uri :: for_test ( "s3://mybucket" ) ;
358
356
let original_config: IndexConfig = load_index_config_from_user_config (
359
357
ConfigFormat :: Yaml ,
360
358
original_config_yaml. as_bytes ( ) ,
361
- & Uri :: for_test ( "s3://mybucket" ) ,
359
+ & default_root ,
362
360
)
363
361
. unwrap ( ) ;
364
362
{
@@ -371,6 +369,7 @@ mod test {
371
369
let updated_config = load_index_config_update (
372
370
ConfigFormat :: Yaml ,
373
371
updated_config_yaml. as_bytes ( ) ,
372
+ & default_root,
374
373
& original_config,
375
374
)
376
375
. unwrap ( ) ;
@@ -387,6 +386,7 @@ mod test {
387
386
let updated_config = load_index_config_update (
388
387
ConfigFormat :: Yaml ,
389
388
updated_config_yaml. as_bytes ( ) ,
389
+ & default_root,
390
390
& original_config,
391
391
)
392
392
. unwrap ( ) ;
@@ -403,6 +403,7 @@ mod test {
403
403
let load_error = load_index_config_update (
404
404
ConfigFormat :: Yaml ,
405
405
updated_config_yaml. as_bytes ( ) ,
406
+ & default_root,
406
407
& original_config,
407
408
)
408
409
. unwrap_err ( ) ;
@@ -432,10 +433,11 @@ mod test {
432
433
period: 90 days
433
434
schedule: daily
434
435
"# ;
436
+ let default_root = Uri :: for_test ( "s3://mybucket" ) ;
435
437
let original_config: IndexConfig = load_index_config_from_user_config (
436
438
ConfigFormat :: Yaml ,
437
439
original_config_yaml. as_bytes ( ) ,
438
- & Uri :: for_test ( "s3://mybucket" ) ,
440
+ & default_root ,
439
441
)
440
442
. unwrap ( ) ;
441
443
@@ -452,6 +454,7 @@ mod test {
452
454
let updated_config = load_index_config_update (
453
455
ConfigFormat :: Yaml ,
454
456
updated_config_yaml. as_bytes ( ) ,
457
+ & default_root,
455
458
& original_config,
456
459
)
457
460
. unwrap ( ) ;
@@ -473,10 +476,11 @@ mod test {
473
476
index_id: hdfs-logs
474
477
doc_mapping: {}
475
478
"# ;
479
+ let default_root = Uri :: for_test ( "s3://mybucket" ) ;
476
480
let original_config: IndexConfig = load_index_config_from_user_config (
477
481
ConfigFormat :: Yaml ,
478
482
original_config_yaml. as_bytes ( ) ,
479
- & Uri :: for_test ( "s3://mybucket" ) ,
483
+ & default_root ,
480
484
)
481
485
. unwrap ( ) ;
482
486
@@ -493,6 +497,7 @@ mod test {
493
497
let updated_config = load_index_config_update (
494
498
ConfigFormat :: Yaml ,
495
499
updated_config_yaml. as_bytes ( ) ,
500
+ & default_root,
496
501
& original_config,
497
502
)
498
503
. unwrap ( ) ;
@@ -513,10 +518,11 @@ mod test {
513
518
type: datetime
514
519
fast: true
515
520
"# ;
521
+ let default_root = Uri :: for_test ( "s3://mybucket" ) ;
516
522
let original_config: IndexConfig = load_index_config_from_user_config (
517
523
ConfigFormat :: Yaml ,
518
524
original_config_yaml. as_bytes ( ) ,
519
- & Uri :: for_test ( "s3://mybucket" ) ,
525
+ & default_root ,
520
526
)
521
527
. unwrap ( ) ;
522
528
@@ -539,6 +545,7 @@ mod test {
539
545
load_index_config_update (
540
546
ConfigFormat :: Yaml ,
541
547
updated_config_yaml. as_bytes ( ) ,
548
+ & default_root,
542
549
& original_config,
543
550
)
544
551
. expect_err ( "mapping changed but uid fixed should error" ) ;
@@ -556,6 +563,7 @@ mod test {
556
563
load_index_config_update (
557
564
ConfigFormat :: Yaml ,
558
565
updated_config_yaml. as_bytes ( ) ,
566
+ & default_root,
559
567
& original_config,
560
568
)
561
569
. expect_err ( "timestamp field removed should error" ) ;
@@ -575,6 +583,7 @@ mod test {
575
583
load_index_config_update (
576
584
ConfigFormat :: Yaml ,
577
585
updated_config_yaml. as_bytes ( ) ,
586
+ & default_root,
578
587
& original_config,
579
588
)
580
589
. expect_err ( "field required for timestamp is absent" ) ;
@@ -595,6 +604,7 @@ mod test {
595
604
load_index_config_update (
596
605
ConfigFormat :: Yaml ,
597
606
updated_config_yaml. as_bytes ( ) ,
607
+ & default_root,
598
608
& original_config,
599
609
)
600
610
. expect_err ( "field required for default search is absent" ) ;
0 commit comments