Skip to content

Commit 79207db

Browse files
committed
Added missing session close in several AdminAPI tests
1 parent f053f07 commit 79207db

18 files changed

+43
-1
lines changed

unittest/scripts/js_devapi/scripts/dba_check_instance_configuration_session.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ session.runSql("SET sql_log_bin = 0");
2323
session.runSql("DROP user 'test_user'@'%'");
2424
session.runSql("SET sql_log_bin = 1");
2525

26+
session.close();
27+
2628
// Remove the sandbox
2729
if (deployed_here)
2830
cleanup_sandbox(__mysql_sandbox_port1);

unittest/scripts/js_devapi/scripts/dba_cluster_misconfigurations.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ var cluster = dba.createCluster('dev');
6868
// Regression for BUG#25974689 : CHECKS ARE MORE STRICT THAN GROUP REPLICATION
6969
cluster.dissolve({force: true});
7070

71+
session.close();
72+
7173
//@ Finalization
7274
// Will delete the sandboxes ONLY if this test was executed standalone
7375
if (deployed_here)

unittest/scripts/js_devapi/scripts/dba_cluster_misconfigurations_interactive.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ if (__have_ssl)
1919
else
2020
var cluster = dba.createCluster('dev');
2121

22+
session.close();
23+
2224
//@ Finalization
2325
// Will delete the sandboxes ONLY if this test was executed standalone
2426
if (deployed_here)

unittest/scripts/js_devapi/scripts/dba_cluster_no_misconfigurations.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if (__have_ssl) {
3535
session.runSql("SET @@global.require_secure_transport = '" + req_sec_trans + "'");
3636
}
3737

38+
session.close();
39+
3840
//@ Finalization
3941
// Will delete the sandboxes ONLY if this test was executed standalone
4042
if (deployed_here)

unittest/scripts/js_devapi/scripts/dba_cluster_no_misconfigurations_interactive.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ if (__have_ssl)
1111
else
1212
var cluster = dba.createCluster('dev');
1313

14+
session.close();
15+
1416
//@ Finalization
1517
// Will delete the sandboxes ONLY if this test was executed standalone
1618
if (deployed_here)

unittest/scripts/js_devapi/scripts/dba_cluster_rejoin_instance.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
99
session.runSql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'');
1010
session.runSql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION');
1111
session.runSql('SET sql_log_bin=1');
12+
session.close();
1213

1314
// Create a new administrative account on instance 2
1415
shell.connect({'host': localhost, 'port': __mysql_sandbox_port2, 'user': 'root', password: 'root'});
@@ -17,6 +18,7 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
1718
session.runSql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'');
1819
session.runSql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION');
1920
session.runSql('SET sql_log_bin=1');
21+
session.close();
2022

2123
// Create a new administrative account on instance 3
2224
shell.connect({'host': localhost, 'port': __mysql_sandbox_port3, 'user': 'root', password: 'root'});
@@ -25,6 +27,7 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
2527
session.runSql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'');
2628
session.runSql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION');
2729
session.runSql('SET sql_log_bin=1');
30+
session.close();
2831

2932
//@ Connect to instance 1
3033
shell.connect({host: localhost, port: __mysql_sandbox_port1, user: 'foo', password: 'bar'});
@@ -93,6 +96,7 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
9396
session.runSql('SET GLOBAL super_read_only = @sro');
9497
session.runSql('SET GLOBAL read_only = @ro');
9598
session.runSql('SET sql_log_bin=1');
99+
session.close();
96100

97101
// Delete the account on instance 2
98102
shell.connect({'host': localhost, 'port': __mysql_sandbox_port2, 'user': 'root', password: 'root'});
@@ -104,6 +108,7 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
104108
session.runSql('SET GLOBAL super_read_only = @sro');
105109
session.runSql('SET GLOBAL read_only = @ro');
106110
session.runSql('SET sql_log_bin=1');
111+
session.close();
107112

108113
// Delete the account on instance 3
109114
shell.connect({'host': localhost, 'port': __mysql_sandbox_port3, 'user': 'root', password: 'root'});
@@ -115,7 +120,6 @@ session.runSql('DROP USER IF EXISTS \'foo\'@\'%\'');
115120
session.runSql('SET GLOBAL super_read_only = @sro');
116121
session.runSql('SET GLOBAL read_only = @ro');
117122
session.runSql('SET sql_log_bin=1');
118-
119123
session.close();
120124

121125
//@ Finalization

unittest/scripts/js_devapi/scripts/dba_configure_local_instance.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dba.configureLocalInstance("gr_user@localhost:"+__mysql_sandbox_port1, {mycnfPat
1515
session.runSql("SET sql_log_bin = 0");
1616
session.runSql("GRANT SELECT on *.* TO 'gr_user'@'%'");
1717
session.runSql("SET sql_log_bin = 1");
18+
session.close();
1819

1920
//@ create cluster using cluster admin account (BUG#26523629)
2021
shell.connect({host: localhost, port: __mysql_sandbox_port1, user: 'gr_user', password: 'root'});
@@ -74,3 +75,4 @@ wait_slave_state(cluster, 'third_sandbox', "ONLINE");
7475
//@<OUT> Check saved auto_inc settings are restored
7576
shell.connect({scheme: 'mysql', host: localhost, port: __mysql_sandbox_port3, user: 'root', password: 'root'});
7677
session.runSql("show global variables like 'auto_increment_%'").fetchAll();
78+
session.close();

unittest/scripts/js_devapi/scripts/dba_drop_metadata_no_interactive.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ dba.dropMetadataSchema({force:true});
2727

2828
ensure_schema_does_not_exist(session, 'mysql_innodb_cluster_metadata')
2929

30+
session.close();
31+
3032
// Smart deployment cleanup
3133
if (deployed_here)
3234
cleanup_sandbox(__mysql_sandbox_port1);

unittest/scripts/js_devapi/scripts/dba_interactive.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ dba.configureLocalInstance('someotherhost:' + __mysql_sandbox_port1);
9999
//@<OUT> Dba: configureLocalInstance error 3
100100
dba.configureLocalInstance('localhost:' + __mysql_sandbox_port1);
101101

102+
session.close();
103+
102104
//@ Dba: Create user without all necessary privileges
103105
// create user that has all permissions to admin a cluster but doesn't have
104106
// the grant privileges for them, so it cannot be used to create viable accounts

unittest/scripts/js_devapi/scripts/dba_super_read_only_handling.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,7 @@ var cluster = dba.rebootClusterFromCompleteOutage("sample");
9494
wait_slave_state(cluster, uri2, "ONLINE");
9595
wait_slave_state(cluster, uri3, "ONLINE");
9696

97+
session.close();
98+
9799
if (deployed_here)
98100
cleanup_sandboxes(true);

unittest/scripts/py_devapi/scripts/dba_cluster_misconfigurations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
# Regression for BUG#25974689 : CHECKS ARE MORE STRICT THAN GROUP REPLICATION
6969
cluster.dissolve({"force": True})
7070

71+
session.close()
72+
7173
#@ Finalization
7274
# Will delete the sandboxes ONLY if this test was executed standalone
7375
if (deployed_here):

unittest/scripts/py_devapi/scripts/dba_cluster_misconfigurations_interactive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
else:
2020
cluster = dba.create_cluster('dev')
2121

22+
session.close()
23+
2224
#@ Finalization
2325
# Will delete the sandboxes ONLY if this test was executed standalone
2426
if (deployed_here):

unittest/scripts/py_devapi/scripts/dba_cluster_no_misconfigurations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
else:
1111
cluster = dba.create_cluster('dev')
1212

13+
session.close()
14+
1315
#@ Finalization
1416
# Will delete the sandboxes ONLY if this test was executed standalone
1517
if (deployed_here):

unittest/scripts/py_devapi/scripts/dba_cluster_no_misconfigurations_interactive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
else:
1212
cluster = dba.create_cluster('dev')
1313

14+
session.close()
15+
1416
#@ Finalization
1517
# Will delete the sandboxes ONLY if this test was executed standalone
1618
if (deployed_here):

unittest/scripts/py_devapi/scripts/dba_cluster_rejoin_instance.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
session.run_sql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'')
1010
session.run_sql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION')
1111
session.run_sql('SET sql_log_bin=1')
12+
session.close()
1213

1314
# Create a new administrative account on instance 2
1415
shell.connect({'host': localhost, 'port': __mysql_sandbox_port2, 'user': 'root', 'password': 'root'})
@@ -17,6 +18,7 @@
1718
session.run_sql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'')
1819
session.run_sql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION')
1920
session.run_sql('SET sql_log_bin=1')
21+
session.close()
2022

2123
# Create a new administrative account on instance 3
2224
shell.connect({'host': localhost, 'port': __mysql_sandbox_port3, 'user': 'root', 'password': 'root'})
@@ -25,6 +27,7 @@
2527
session.run_sql('CREATE USER \'foo\'@\'%\' IDENTIFIED BY \'bar\'')
2628
session.run_sql('GRANT ALL PRIVILEGES ON *.* TO \'foo\'@\'%\' WITH GRANT OPTION')
2729
session.run_sql('SET sql_log_bin=1')
30+
session.close()
2831

2932
#@ Connect to instance 1
3033
shell.connect({'host': localhost, 'port': __mysql_sandbox_port1, 'user': 'foo', 'password': 'bar'})
@@ -91,6 +94,7 @@
9194
session.run_sql('SET GLOBAL super_read_only = @sro')
9295
session.run_sql('SET GLOBAL read_only = @ro')
9396
session.run_sql('SET sql_log_bin=1')
97+
session.close()
9498

9599
# Delete the account on instance 2
96100
shell.connect({'host': localhost, 'port': __mysql_sandbox_port2, 'user': 'root', 'password': 'root'})
@@ -102,6 +106,7 @@
102106
session.run_sql('SET GLOBAL super_read_only = @sro')
103107
session.run_sql('SET GLOBAL read_only = @ro')
104108
session.run_sql('SET sql_log_bin=1')
109+
session.close()
105110

106111
# Delete the account on instance 3
107112
shell.connect({'host': localhost, 'port': __mysql_sandbox_port3, 'user': 'root', 'password': 'root'})
@@ -113,6 +118,7 @@
113118
session.run_sql('SET GLOBAL super_read_only = @sro')
114119
session.run_sql('SET GLOBAL read_only = @ro')
115120
session.run_sql('SET sql_log_bin=1')
121+
session.close()
116122

117123
#@ Finalization
118124
# Will delete the sandboxes ONLY if this test was executed standalone

unittest/scripts/py_devapi/scripts/dba_configure_local_instance.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
dba.start_sandbox_instance(__mysql_sandbox_port3, {'sandboxDir': __sandbox_dir})
6464
wait_slave_state(cluster, 'third_sandbox', "ONLINE")
6565

66+
session.close()
67+
6668
#@ Finalization
6769
shell.connect({'host': localhost, 'port': __mysql_sandbox_port1, 'user': 'root', 'password': 'root'})
6870
session.run_sql("DROP USER 'gr_user'@'%'")
6971
cleanup_sandboxes(deployed_here)
72+
session.close()

unittest/scripts/py_devapi/scripts/dba_interactive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
#@<OUT> Dba: configure_local_instance error 3
109109
dba.configure_local_instance('localhost:' + str(__mysql_sandbox_port1));
110110

111+
session.close()
112+
111113
#@ Dba: Create user without all necessary privileges
112114
# create user that has all permissions to admin a cluster but doesn't have
113115
# the grant privileges for them, so it cannot be used to create viable accounts

unittest/shell_js_dba_t.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ TEST_F(Shell_js_dba_tests, configure_local_instance_errors) {
528528
#endif
529529
// Cleans up the used sandbox
530530
execute("cleanup_sandbox(__mysql_sandbox_port1)");
531+
execute("session.close();");
531532
}
532533

533534

0 commit comments

Comments
 (0)