@@ -32,6 +32,36 @@ def __connect_and_generate_error(self):
32
32
self .assertRaises (oracledb .DatabaseError , cursor .execute ,
33
33
"select 1 / 0 from dual" )
34
34
35
+ def __perform_reconfigure_test (self , parameter_name , parameter_value ,
36
+ min = 3 , max = 30 , increment = 4 , timeout = 5 ,
37
+ wait_timeout = 5000 , stmtcachesize = 25 ,
38
+ max_lifetime_session = 1000 ,
39
+ max_sessions_per_shard = 3 , ping_interval = 30 ,
40
+ getmode = oracledb .SPOOL_ATTRVAL_WAIT ):
41
+ creation_args = dict (min = min , max = max , increment = increment ,
42
+ timeout = timeout , wait_timeout = wait_timeout ,
43
+ stmtcachesize = stmtcachesize ,
44
+ max_lifetime_session = max_lifetime_session ,
45
+ max_sessions_per_shard = max_sessions_per_shard ,
46
+ ping_interval = ping_interval , getmode = getmode )
47
+ reconfigure_args = {}
48
+ reconfigure_args [parameter_name ] = parameter_value
49
+
50
+ pool = test_env .get_pool (** creation_args )
51
+ connection = pool .acquire ()
52
+ pool .reconfigure (** reconfigure_args )
53
+ actual_args = dict (min = pool .min , max = pool .max ,
54
+ increment = pool .increment , timeout = pool .timeout ,
55
+ wait_timeout = pool .wait_timeout ,
56
+ stmtcachesize = pool .stmtcachesize ,
57
+ max_lifetime_session = pool .max_lifetime_session ,
58
+ max_sessions_per_shard = pool .max_sessions_per_shard ,
59
+ ping_interval = pool .ping_interval ,
60
+ getmode = pool .getmode )
61
+ expected_args = creation_args .copy ()
62
+ expected_args .update (reconfigure_args )
63
+ self .assertEqual (actual_args , expected_args )
64
+
35
65
def __verify_connection (self , connection , expected_user ,
36
66
expected_proxy_user = None ):
37
67
cursor = connection .cursor ()
@@ -376,37 +406,40 @@ def test_2415_reconfigure_pool(self):
376
406
self .assertEqual (pool .stmtcachesize , 30 , "stmtcachesize (30)" )
377
407
self .assertEqual (pool .ping_interval , 30 , "ping_interval (30)" )
378
408
379
- def test_2416_reconfigure_pool_with_missing_params (self ):
380
- "2416 - test to ensure reconfigure uses initial values if unspecified"
381
- pool = test_env .get_pool (min = 1 , max = 2 , increment = 1 )
409
+ def test_2416_test_reconfigure_pool_with_missing_values (self ):
410
+ "2416 - test the reconfigure values are changed and rest unchanged"
411
+ self .__perform_reconfigure_test ("min" , 5 )
412
+ self .__perform_reconfigure_test ("max" , 20 )
413
+ self .__perform_reconfigure_test ("increment" , 5 )
414
+ self .__perform_reconfigure_test ("timeout" , 10 )
415
+ self .__perform_reconfigure_test ("wait_timeout" , 8000 )
416
+ self .__perform_reconfigure_test ("stmtcachesize" , 40 )
417
+ self .__perform_reconfigure_test ("max_lifetime_session" , 2000 )
418
+ self .__perform_reconfigure_test ("max_sessions_per_shard" , 5 )
419
+ self .__perform_reconfigure_test ("ping_interval" , 50 )
420
+ self .__perform_reconfigure_test ("getmode" ,
421
+ oracledb .SPOOL_ATTRVAL_NOWAIT )
422
+
423
+ def test_2417_setting_each_pool_param (self ):
424
+ "2417 - test to see if specified parameters are set during creation"
425
+ pool = test_env .get_pool (min = 1 , max = 2 , increment = 1 , timeout = 10 ,
426
+ wait_timeout = 10 , max_lifetime_session = 20 ,
427
+ max_sessions_per_shard = 1 , stmtcachesize = 25 ,
428
+ ping_interval = 25 ,
429
+ getmode = oracledb .SPOOL_ATTRVAL_WAIT )
382
430
self .assertEqual (pool .min , 1 , "min (1)" )
383
431
self .assertEqual (pool .max , 2 , "max (2)" )
384
432
self .assertEqual (pool .increment , 1 , "increment (1)" )
385
- self .assertEqual (pool .getmode , oracledb .SPOOL_ATTRVAL_NOWAIT ,
386
- "getmode differs" )
387
- self .assertEqual (pool .timeout , 0 , "timeout (0)" )
388
- self .assertEqual (pool .wait_timeout , 5000 , "wait_timeout (5000)" )
389
- self .assertEqual (pool .max_lifetime_session , 0 ,
390
- "max_lifetime_sessionmeout (0)" )
391
- self .assertEqual (pool .max_sessions_per_shard , 0 ,
392
- "max_sessions_per_shard (0)" )
393
- self .assertEqual (pool .stmtcachesize , 20 , "stmtcachesize (20)" )
394
- self .assertEqual (pool .ping_interval , 60 , "ping_interval (60)" )
395
-
396
- pool .reconfigure (min = 2 , max = 5 , increment = 2 )
397
- self .assertEqual (pool .min , 2 , "min (2)" )
398
- self .assertEqual (pool .max , 5 , "max (5)" )
399
- self .assertEqual (pool .increment , 2 , "increment (2)" )
400
- self .assertEqual (pool .getmode , oracledb .SPOOL_ATTRVAL_NOWAIT ,
433
+ self .assertEqual (pool .getmode , oracledb .SPOOL_ATTRVAL_WAIT ,
401
434
"getmode differs" )
402
- self .assertEqual (pool .timeout , 0 , "timeout (0 )" )
403
- self .assertEqual (pool .wait_timeout , 5000 , "wait_timeout (5000 )" )
404
- self .assertEqual (pool .max_lifetime_session , 0 ,
405
- "max_lifetime_sessionmeout (0 )" )
406
- self .assertEqual (pool .max_sessions_per_shard , 0 ,
407
- "max_sessions_per_shard (0 )" )
408
- self .assertEqual (pool .stmtcachesize , 20 , "stmtcachesize (20 )" )
409
- self .assertEqual (pool .ping_interval , 60 , "ping_interval (60 )" )
435
+ self .assertEqual (pool .timeout , 10 , "timeout (10 )" )
436
+ self .assertEqual (pool .wait_timeout , 10 , "wait_timeout (10 )" )
437
+ self .assertEqual (pool .max_lifetime_session , 20 ,
438
+ "max_lifetime_sessionmeout (20 )" )
439
+ self .assertEqual (pool .max_sessions_per_shard , 1 ,
440
+ "max_sessions_per_shard (1 )" )
441
+ self .assertEqual (pool .stmtcachesize , 25 , "stmtcachesize (25 )" )
442
+ self .assertEqual (pool .ping_interval , 25 , "ping_interval (25 )" )
410
443
411
444
if __name__ == "__main__" :
412
445
test_env .run_test_cases ()
0 commit comments