@@ -256,57 +256,30 @@ public void testGetTokenSourceWithOAuth() {
256256 public void testOAuthBrowserAuthTimeout () {
257257 DatabricksConfig config = new DatabricksConfig ();
258258
259- // Test default value (should be null)
260259 assertNull (config .getOAuthBrowserAuthTimeout ());
261260
262- // Test setting the timeout using Duration
263261 config .setOAuthBrowserAuthTimeout (Duration .ofSeconds (30 ));
264262 assertEquals (Duration .ofSeconds (30 ), config .getOAuthBrowserAuthTimeout ());
265263
266- // Test setting the timeout using int (backward compatibility)
267264 config .setOAuthBrowserAuthTimeout (60 );
268265 assertEquals (Duration .ofSeconds (60 ), config .getOAuthBrowserAuthTimeout ());
269266
270- // Test setting to 0 (should be null for indefinite wait)
271267 config .setOAuthBrowserAuthTimeout (0 );
272268 assertNull (config .getOAuthBrowserAuthTimeout ());
273269 }
274270
275271 @ Test
276272 public void testEnvironmentVariableLoading () {
277- // Test that environment variables are now loaded properly for Duration and Integer
278- DatabricksConfig config = new DatabricksConfig ();
279-
280- // Set environment variable
281273 Map <String , String > env = new HashMap <>();
282274 env .put ("DATABRICKS_OAUTH_BROWSER_AUTH_TIMEOUT" , "30" );
283275 env .put ("DATABRICKS_DEBUG_TRUNCATE_BYTES" , "100" );
284276 env .put ("DATABRICKS_RATE_LIMIT" , "50" );
285277
286- // Resolve config with environment
287- Environment environment = new Environment (env , new ArrayList <>(), "Linux" );
288- config .resolve (environment );
278+ DatabricksConfig config = new DatabricksConfig ();
279+ config .resolve (new Environment (env , new ArrayList <>(), System .getProperty ("os.name" )));
289280
290- // These should now be loaded properly
291281 assertEquals (Duration .ofSeconds (30 ), config .getOAuthBrowserAuthTimeout ());
292282 assertEquals (Integer .valueOf (100 ), config .getDebugTruncateBytes ());
293283 assertEquals (Integer .valueOf (50 ), config .getRateLimit ());
294284 }
295-
296- @ Test
297- public void testEnvironmentVariableLoadingZeroTimeout () {
298- // Test that environment variable with value 0 results in null Duration
299- DatabricksConfig config = new DatabricksConfig ();
300-
301- // Set environment variable to 0
302- Map <String , String > env = new HashMap <>();
303- env .put ("DATABRICKS_OAUTH_BROWSER_AUTH_TIMEOUT" , "0" );
304-
305- // Resolve config with environment
306- Environment environment = new Environment (env , new ArrayList <>(), "Linux" );
307- config .resolve (environment );
308-
309- // Should be null for indefinite wait
310- assertNull (config .getOAuthBrowserAuthTimeout ());
311- }
312285}
0 commit comments