@@ -56,6 +56,12 @@ object ResolverSpec {
56
56
val one : Registry .Embedded = embedRef(" com.acme" , 0 )
57
57
val two : Registry .Embedded = embedRef(" de.acompany.snowplow" , 40 )
58
58
val three : Registry .Embedded = embedRef(" de.acompany.snowplow" , 100 )
59
+
60
+ val custom : Registry =
61
+ Registry .Http (
62
+ Registry .Config (" Iglu Custom Repo" , 10 , List (" com.acme" )),
63
+ Registry .HttpConnection (URI .create(" http://iglu.acme.com" ), None )
64
+ )
59
65
}
60
66
}
61
67
@@ -76,6 +82,14 @@ class ResolverSpec extends Specification with CatsEffect {
76
82
a Resolver should cache SchemaLists with different models separately $e11
77
83
a Resolver should use schemaKey provided in SchemaListLike for result validation $e12
78
84
result from SchemaListLike should contain the exact schemaKey provided $e13
85
+ isNotFound should
86
+ return true if custom repo and Iglu Central repos don't have a schema $e14
87
+ return true if one Iglu Central repo returns an error and the other one NotFound $e15
88
+ return false if custom repo returns an error $e16
89
+ return true if there is no custom repo, one Iglu Central repo returns an error and the other one NotFound $e17
90
+ return false if there is no custom repo and Iglu Central ones return an error $e18
91
+ return true if there is just one custom repo that returns NotFound $e19
92
+ return false if there is just one custom repo that returns an error $e20
79
93
"""
80
94
81
95
import ResolverSpec ._
@@ -480,4 +494,154 @@ class ResolverSpec extends Specification with CatsEffect {
480
494
481
495
result must beRight(SchemaList .parseUnsafe(List (schema100, schema101, schema102)))
482
496
}
497
+
498
+ def e14 = {
499
+ val resolver : Resolver [Id ] =
500
+ Resolver
501
+ .init[Id ](0 , None , SpecHelpers .IgluCentral , SpecHelpers .IgluCentralMirror , Repos .custom)
502
+
503
+ val resolutionError = ResolutionError (
504
+ SortedMap (
505
+ SpecHelpers .IgluCentral .config.name -> LookupHistory (
506
+ Set (RegistryError .NotFound ),
507
+ 1 ,
508
+ Instant .now()
509
+ ),
510
+ SpecHelpers .IgluCentralMirror .config.name -> LookupHistory (
511
+ Set (RegistryError .NotFound ),
512
+ 1 ,
513
+ Instant .now()
514
+ ),
515
+ Repos .custom.config.name -> LookupHistory (Set (RegistryError .NotFound ), 1 , Instant .now())
516
+ )
517
+ )
518
+
519
+ resolver.isNotFound(resolutionError) should beTrue
520
+ }
521
+
522
+ def e15 = {
523
+ val resolver : Resolver [Id ] =
524
+ Resolver
525
+ .init[Id ](0 , None , SpecHelpers .IgluCentral , SpecHelpers .IgluCentralMirror , Repos .custom)
526
+
527
+ val resolutionError = ResolutionError (
528
+ SortedMap (
529
+ SpecHelpers .IgluCentral .config.name -> LookupHistory (
530
+ Set (RegistryError .RepoFailure (" Problem" )),
531
+ 1 ,
532
+ Instant .now()
533
+ ),
534
+ SpecHelpers .IgluCentralMirror .config.name -> LookupHistory (
535
+ Set (RegistryError .NotFound ),
536
+ 1 ,
537
+ Instant .now()
538
+ ),
539
+ Repos .custom.config.name -> LookupHistory (Set (RegistryError .NotFound ), 1 , Instant .now())
540
+ )
541
+ )
542
+
543
+ resolver.isNotFound(resolutionError) should beTrue
544
+ }
545
+
546
+ def e16 = {
547
+ val resolver : Resolver [Id ] =
548
+ Resolver
549
+ .init[Id ](0 , None , SpecHelpers .IgluCentral , SpecHelpers .IgluCentralMirror , Repos .custom)
550
+
551
+ val resolutionError = ResolutionError (
552
+ SortedMap (
553
+ SpecHelpers .IgluCentral .config.name -> LookupHistory (
554
+ Set (RegistryError .NotFound ),
555
+ 1 ,
556
+ Instant .now()
557
+ ),
558
+ SpecHelpers .IgluCentralMirror .config.name -> LookupHistory (
559
+ Set (RegistryError .NotFound ),
560
+ 1 ,
561
+ Instant .now()
562
+ ),
563
+ Repos .custom.config.name -> LookupHistory (
564
+ Set (RegistryError .ClientFailure (" Something went wrong" )),
565
+ 1 ,
566
+ Instant .now()
567
+ )
568
+ )
569
+ )
570
+
571
+ resolver.isNotFound(resolutionError) should beFalse
572
+ }
573
+
574
+ def e17 = {
575
+ val resolver : Resolver [Id ] =
576
+ Resolver .init[Id ](0 , None , SpecHelpers .IgluCentral , SpecHelpers .IgluCentralMirror )
577
+
578
+ val resolutionError = ResolutionError (
579
+ SortedMap (
580
+ SpecHelpers .IgluCentral .config.name -> LookupHistory (
581
+ Set (RegistryError .RepoFailure (" Problem" )),
582
+ 1 ,
583
+ Instant .now()
584
+ ),
585
+ SpecHelpers .IgluCentralMirror .config.name -> LookupHistory (
586
+ Set (RegistryError .NotFound ),
587
+ 1 ,
588
+ Instant .now()
589
+ )
590
+ )
591
+ )
592
+
593
+ resolver.isNotFound(resolutionError) should beTrue
594
+ }
595
+
596
+ def e18 = {
597
+ val resolver : Resolver [Id ] =
598
+ Resolver .init[Id ](0 , None , SpecHelpers .IgluCentral , SpecHelpers .IgluCentralMirror )
599
+
600
+ val resolutionError = ResolutionError (
601
+ SortedMap (
602
+ SpecHelpers .IgluCentral .config.name -> LookupHistory (
603
+ Set (RegistryError .RepoFailure (" Problem" )),
604
+ 1 ,
605
+ Instant .now()
606
+ ),
607
+ SpecHelpers .IgluCentralMirror .config.name -> LookupHistory (
608
+ Set (RegistryError .ClientFailure (" Network issue" )),
609
+ 1 ,
610
+ Instant .now()
611
+ )
612
+ )
613
+ )
614
+
615
+ resolver.isNotFound(resolutionError) should beFalse
616
+ }
617
+
618
+ def e19 = {
619
+ val resolver : Resolver [Id ] =
620
+ Resolver .init[Id ](0 , None , Repos .custom)
621
+
622
+ val resolutionError = ResolutionError (
623
+ SortedMap (
624
+ Repos .custom.config.name -> LookupHistory (Set (RegistryError .NotFound ), 1 , Instant .now())
625
+ )
626
+ )
627
+
628
+ resolver.isNotFound(resolutionError) should beTrue
629
+ }
630
+
631
+ def e20 = {
632
+ val resolver : Resolver [Id ] =
633
+ Resolver .init[Id ](0 , None , Repos .custom)
634
+
635
+ val resolutionError = ResolutionError (
636
+ SortedMap (
637
+ Repos .custom.config.name -> LookupHistory (
638
+ Set (RegistryError .ClientFailure (" Boom" )),
639
+ 1 ,
640
+ Instant .now()
641
+ )
642
+ )
643
+ )
644
+
645
+ resolver.isNotFound(resolutionError) should beFalse
646
+ }
483
647
}
0 commit comments