Skip to content

Commit 2c9dcaa

Browse files
committed
Fixed AdminAPI test failures in windows:
In windows platforms some tests were failing due of an error in dba.deleteSandboxInstance() calls as the directories were still being accessed. As dba.stopSandboxInstance() returns without full guarantee that the mysqld process if stopped leading to a possible failure in deleting the sandbox dir aftewards. The fix was to include a retry method with a 60 seconds timeout for the deleteSandboxInstance calls in the cleanup_sandbox() function. Reverted commit 6b2190ebbce76edc354e06169fcee8f488aa5006 and included patch to disable by default the Shell_py_dba_tests
1 parent e4e5a80 commit 2c9dcaa

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

unittest/scripts/js_devapi/setup/setup.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ function start_sandbox(params) {
226226
}
227227

228228
function cleanup_sandbox(port) {
229-
230229
println ('Stopping the sandbox at ' + port + ' to delete it...');
231230
try {
232231
stop_options = {}
@@ -239,17 +238,30 @@ function cleanup_sandbox(port) {
239238
println(err.message);
240239
}
241240

242-
println ('Deleting the sandbox at ' + port);
243-
try {
244-
options = {}
245-
if (__sandbox_dir != '')
246-
options['sandboxDir'] = __sandbox_dir;
241+
options = {}
242+
if (__sandbox_dir != '')
243+
options['sandboxDir'] = __sandbox_dir;
247244

248-
dba.deleteSandboxInstance(port, options);
249-
} catch (err) {
250-
println(err.message);
245+
var deleted = false;
251246

247+
print('Try deleting sandbox at: ' + port);
248+
deleted = wait(10, 1, function() {
249+
try {
250+
dba.deleteSandboxInstance(port, options);
251+
252+
println(' succeeded');
253+
return true;
254+
} catch (err) {
255+
println(' failed: ' + err.message);
256+
return false;
257+
}
258+
});
259+
if (deleted) {
260+
println('Delete succeeded at: ' + port);
261+
} else {
262+
println('Delete failed at: ' + port);
252263
}
264+
253265
}
254266

255267
// Smart deployment routines

unittest/scripts/py_devapi/setup/setup.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,24 @@ def cleanup_sandbox(port):
227227
print err.message
228228
pass
229229

230-
print 'Deleting the sandbox at %s' % port
231-
try:
232230
options = {}
233231
if __sandbox_dir != '':
234232
options['sandboxDir'] = __sandbox_dir
235233

236-
dba.delete_sandbox_instance(port, options)
237-
except Exception, err:
238-
print err.message
239-
pass
234+
print 'Try deleting sandbox at: %s' % port
235+
def try_delete():
236+
try:
237+
dba.delete_sandbox_instance(port, options)
238+
print "succeeded"
239+
return True
240+
except Exception, err:
241+
print "failed: %s" % str(err)
242+
return False
243+
244+
if wait(10, 1, try_delete):
245+
print 'Delete succeeded at: %s' % port
246+
else:
247+
print 'Delete failed at: %s' % port
240248

241249
def reset_or_deploy_sandbox(port):
242250
deployed_here = False

unittest/test_main.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ int main(int argc, char **argv) {
103103
new_flags = "Shell_py_dba_tests.no_interactive_deploy*:Shell_py_dba_tests.interactive_classic_*";
104104
else if (flags == "ALLBUTDBA")
105105
new_flags = "*:-Shell_py_dba_tests.*:Shell_js_dba_tests.*";
106+
else if (flags == "*")
107+
new_flags = "*:-Shell_py_dba_tests.*"; // Exclude DBAPY tests by default
106108

107-
new_flags = "*:-Shell_py_dba_tests.*";
108109
if (!new_flags.empty())
109110
::testing::GTEST_FLAG(filter) = new_flags.c_str();
110111
}

0 commit comments

Comments
 (0)