@@ -52,11 +52,19 @@ class AbstractDeltaCatalogClientRoutingSuite extends QueryTest with DeltaSQLComm
5252
5353 test(" deltaRestApi.enabled=false leaves deltaCatalogClient empty" ) {
5454 val catalog = new AbstractDeltaCatalog
55- catalog.initialize(" test_cat" , options())
55+ catalog.initialize(" test_cat" , options(" deltaRestApi.enabled " -> " false " ))
5656 assert(catalog.deltaCatalogClient.isEmpty,
5757 " UC Delta API client should not be constructed when the catalog opts out" )
5858 }
5959
60+ test(" deltaRestApi.enabled defaults to true: requires uri when flag absent" ) {
61+ val catalog = new AbstractDeltaCatalog
62+ val e = intercept[IllegalArgumentException ] {
63+ catalog.initialize(" test_cat" , options())
64+ }
65+ assert(e.getMessage.contains(" 'uri' is required" ))
66+ }
67+
6068 test(" deltaRestApi.enabled=true requires uri" ) {
6169 val catalog = new AbstractDeltaCatalog
6270 val e = intercept[IllegalArgumentException ] {
@@ -97,7 +105,7 @@ class AbstractDeltaCatalogClientRoutingSuite extends QueryTest with DeltaSQLComm
97105
98106 test(" AbstractDeltaCatalogClient.fromCatalogOptionsIfEnabled returns None when flag is off" ) {
99107 val result = AbstractDeltaCatalogClient .fromCatalogOptionsIfEnabled(
100- " test_cat" , options(), noFallback)
108+ " test_cat" , options(" deltaRestApi.enabled " -> " false " ), noFallback)
101109 assert(result.isEmpty)
102110 }
103111
@@ -109,6 +117,16 @@ class AbstractDeltaCatalogClientRoutingSuite extends QueryTest with DeltaSQLComm
109117 assert(result.isDefined)
110118 }
111119
120+ test(" AbstractDeltaCatalogClient.fromCatalogOptionsIfEnabled returns Some when flag absent " +
121+ " (default is on)" ) {
122+ val result = AbstractDeltaCatalogClient .fromCatalogOptionsIfEnabled(
123+ " test_cat" ,
124+ options(" uri" -> " http://uc" , " token" -> " tok" ),
125+ noFallback)
126+ assert(result.isDefined,
127+ " absent deltaRestApi.enabled should default to true and construct the client" )
128+ }
129+
112130 private val noFallback : Identifier => Table =
113131 _ => throw new UnsupportedOperationException (" fallback not expected in this test" )
114132
0 commit comments