Skip to content

Commit 1c237d8

Browse files
committed
Merge JDBC UT fixes
2 parents 0309b81 + c7c2f2d commit 1c237d8

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

test/unit/bugs/bugs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,12 +1182,12 @@ void bugs::bug32695580()
11821182
logMsg("bugs::bug32695580");
11831183
sql::ConnectOptionsMap opt;
11841184
opt[OPT_HOSTNAME] = "127.0.0.1";
1185-
opt[OPT_PORT] = 111;
1185+
opt[OPT_PORT] = 65000;
11861186

11871187
try {
11881188
Connection con2(getConnection(&opt));
11891189
} catch (const sql::SQLException &e) {
1190-
ASSERT_EQUALS(2003,e.getErrorCode());
1190+
ASSERT_GT(2000,e.getErrorCode());
11911191
}
11921192
}
11931193

test/unit/classes/connection.cpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,9 +2457,6 @@ void connection::connectAttrAdd()
24572457
{
24582458
logMsg("connection::connectAttr - MYSQL_OPT_CONNECT_ATTR_ADD|MYSQL_OPT_CONNECT_ATTR_DELETE");
24592459

2460-
//TODO: Enable it after fixing
2461-
SKIP("Removed untill fixed");
2462-
24632460
int serverVersion=getMySQLVersion(con);
24642461
if ( serverVersion < 56006)
24652462
{
@@ -2628,11 +2625,11 @@ void connection::connectAttrAdd()
26282625
if (perf_conn_attr_size < 512) {
26292626
SKIP("The performance_schema_session_connect_attrs_size is less then 512");
26302627
} else if (perf_conn_attr_size >= 512 && perf_conn_attr_size < 1024) {
2631-
max_count= 32;
2628+
max_count= 20;
26322629
} else if (perf_conn_attr_size >= 1024 && perf_conn_attr_size < 2048) {
2633-
max_count= 64;
2630+
max_count= 50;
26342631
} else if (perf_conn_attr_size >= 2048) {
2635-
max_count= 128;
2632+
max_count= 100;
26362633
}
26372634

26382635
try
@@ -2645,7 +2642,7 @@ void connection::connectAttrAdd()
26452642

26462643
for (i=1; i <= max_count; ++i) {
26472644
skey.str("");
2648-
skey << "keymu" << i;
2645+
skey << "keymu" << std::setw(3) << std::setfill('0') << i;
26492646
connectAttrMap[skey.str()] = "value";
26502647
}
26512648

@@ -2659,12 +2656,12 @@ void connection::connectAttrAdd()
26592656
stmt.reset(conn2->createStatement());
26602657
res.reset(stmt->executeQuery("SELECT ATTR_NAME, ATTR_VALUE FROM "
26612658
"performance_schema.session_account_connect_attrs WHERE "
2662-
"ATTR_NAME LIKE '%keymu%' ORDER BY SUBSTRING(ATTR_NAME, 6)+0 ASC;"));
2659+
"ATTR_NAME LIKE '%keymu%' ORDER BY SUBSTRING(ATTR_NAME, 6) ASC;"));
26632660

26642661
i=0;
26652662
while (res->next()) {
26662663
skey.str("");
2667-
skey << "keymu" << ++i;
2664+
skey << "keymu" << std::setw(3) << std::setfill('0') << ++i;
26682665
ASSERT_EQUALS(res->getString("ATTR_NAME"), skey.str());
26692666
ASSERT_EQUALS(res->getString("ATTR_VALUE"), "value");
26702667
}
@@ -3078,7 +3075,7 @@ void connection::localInfile()
30783075

30793076
sql::SQLString orig_dir_path = load_data_path;
30803077
sql::SQLString dir_path = conn->getClientOption(OPT_LOAD_DATA_LOCAL_DIR);
3081-
ASSERT_EQUALS(orig_dir_path, dir_path);
3078+
ASSERT( dir_path->find(orig_dir_path) != sql::SQLString::npos);
30823079

30833080
conn->setClientOption(OPT_LOAD_DATA_LOCAL_DIR, nullptr);
30843081

@@ -3239,19 +3236,25 @@ void connection::localInfile()
32393236
temp_dir = "/tmp/";
32403237
#endif
32413238

3242-
dir = temp_dir + "test/";
3239+
#ifndef _WIN32
3240+
std::string pid = std::to_string(getpid());
3241+
#else
3242+
std::string pid = std::to_string(GetCurrentProcessId());
3243+
#endif
3244+
3245+
dir = temp_dir + std::string("test")+pid+"/";
32433246
file_path = dir + "infile.txt";
32443247

32453248
dataDir dir_test(dir);
3246-
dataDir dir_link(temp_dir + "test_link/");
3247-
dataDir dir_subdir_link(temp_dir + "test_subdir_link/");
3249+
dataDir dir_link(temp_dir + "test_link" + pid +"/");
3250+
dataDir dir_subdir_link(temp_dir + "test_subdir_link" + pid + "/");
32483251

32493252
dataFile infile(dir, "infile.txt");
32503253

32513254
#ifndef _WIN32
3252-
dataFile infile_wo("/tmp/test/", "infile_wo.txt", true);
3253-
dataSymlink sl(file_path, temp_dir + "test_link/link_infile.txt");
3254-
dataSymlink sld(dir, temp_dir + "test_subdir_link/subdir");
3255+
dataFile infile_wo(dir, "infile_wo.txt", true);
3256+
dataSymlink sl(file_path, temp_dir + "test_link"+ pid + "/link_infile.txt");
3257+
dataSymlink sld(dir, temp_dir + "test_subdir_link"+ pid + "/subdir");
32553258
std::string sld_file = sld.path();
32563259
sld_file.append("/infile.txt");
32573260
#endif

test/unit/classes/resultsetmetadata.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ void resultsetmetadata::doGetColumnDisplaySize(bool is_ps)
201201
ASSERT_EQUALS((unsigned int) 1, meta->getColumnDisplaySize(2));
202202
ASSERT_EQUALS((unsigned int) 5, meta->getColumnDisplaySize(3));
203203
ASSERT_EQUALS((unsigned int) 1, meta->getColumnDisplaySize(4));
204-
ASSERT_EQUALS((unsigned int) 3, meta->getColumnDisplaySize(5));
204+
// Integer now adds +1 for sign
205+
ASSERT_EQUALS((unsigned int) 4, meta->getColumnDisplaySize(5));
205206

206207
try
207208
{
@@ -1286,9 +1287,6 @@ void resultsetmetadata::isSigned()
12861287
{
12871288
logMsg("resultsetmetadata::isSigned() - MySQL_ResultSetMetaData::isSigned");
12881289

1289-
//TODO: Enable it after fixing
1290-
SKIP("Removed untill fixed");
1291-
12921290
std::stringstream sql;
12931291
std::vector<columndefinition>::iterator it;
12941292
ResultSetMetaData * meta_st;

test/unit/unit_fixture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void unit_fixture::init()
130130
columns.push_back(columndefinition("DATETIME", "DATETIME NOT NULL DEFAULT '2009-02-12 21:36:54'", sql::DataType::TIMESTAMP, "2009-02-12 17:49:21", true, 19, 0, false, "2009-02-12 21:36:54", 0, "NO", false));
131131
// TODO this might be server dependent!
132132

133-
columns.push_back(columndefinition("TIMESTAMP", "TIMESTAMP", sql::DataType::TIMESTAMP, "2038-01-09 03:14:07", false, 19, 0, true, "", 0, "NO", false));
133+
columns.push_back(columndefinition("TIMESTAMP", "TIMESTAMP", sql::DataType::TIMESTAMP, "2038-01-09 03:14:07", true, 19, 0, true, "", 0, "NO", false));
134134
columns.push_back(columndefinition("TIME", "TIME", sql::DataType::TIME, "-838:59:59", true, 8, 0, true, "", 0, "NO", true));
135135
columns.push_back(columndefinition("TIME", "TIME NOT NULL", sql::DataType::TIME, "838:59:59", true, 8, 0, false, "", 0, "NO", false));
136136
columns.push_back(columndefinition("TIME", "TIME DEFAULT '12:39:41'", sql::DataType::TIME, "-838:59:59", true, 8, 0, true, "12:39:41", 0, "NO", true));

0 commit comments

Comments
 (0)