MySql: add failing connection test

This test ensure that a connection made to either an invalid host or an
unreachable host fails properly.

Task-number: QTBUG-47452
Change-Id: If31d23d815e496fc21ef2e1e19c34c2723bd3504
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Samuel Gaist 2015-09-28 18:03:02 +02:00
parent c20920fbe1
commit a40ea0948d

View File

@ -146,6 +146,7 @@ private slots:
void mysql_multiselect(); // For task 144331
void mysql_savepointtest_data() { generic_data("QMYSQL"); }
void mysql_savepointtest();
void mysql_connectWithInvalidAddress();
void accessOdbc_strings_data() { generic_data(); }
void accessOdbc_strings();
@ -2192,6 +2193,14 @@ void tst_QSqlDatabase::mysql_savepointtest()
QVERIFY_SQL(q, exec("savepoint foo"));
}
void tst_QSqlDatabase::mysql_connectWithInvalidAddress()
{
// Ensure that giving invalid connection parameters fails correctly
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("invalid.local");
QCOMPARE(db.open(), false);
}
void tst_QSqlDatabase::oci_tables()
{
QSKIP("Requires specific permissions to create a system table");