Skip to content

Commit 2c0d5b2

Browse files
committed
test: mysql compatibility test
1 parent 7d9c7c6 commit 2c0d5b2

File tree

9 files changed

+303
-80
lines changed

9 files changed

+303
-80
lines changed

.github/workflows/compatibility_test.yaml

Lines changed: 257 additions & 53 deletions
Large diffs are not rendered by default.

driver/util/init_plugin_helper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "rds_utils.h"
2020

2121
#include "../dialect/dialect.h"
22-
#include "../dialect/dialect_aurora_postgres.h"
2322
#include "../dialect/dialect_aurora_mysql.h"
23+
#include "../dialect/dialect_aurora_postgres.h"
2424

2525
std::shared_ptr<Dialect> InitDialect(std::map<std::string, std::string> conn_info)
2626
{

scripts/init_local_mysql_query.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE DATABASE IF NOT EXISTS test_database;
2+
CREATE USER 'test_username'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'test_password';
3+
GRANT ALL on *.* TO 'test_username'@'localhost';
4+
FLUSH PRIVILEGES;

test/common/base_connection_test.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class BaseConnectionTest : public testing::Test {
4141
int test_port = TEST_UTILS::StrToInt(TEST_UTILS::GetEnvVar("TEST_PORT", "5432"));
4242
std::string test_region = TEST_UTILS::GetEnvVar("TEST_REGION", "us-west-1");
4343
std::string test_server = TEST_UTILS::GetEnvVar("TEST_SERVER");
44+
std::string test_dialect = TEST_UTILS::GetEnvVar("TEST_DIALECT");
4445

4546
std::string conn_str = "";
4647

test/compatibility/CMakeLists.txt

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,17 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${EXTERNAL_LIBRARIES})
102102
# ODBC Unix DSN ---------------------------------------------------------------------------------------------
103103
SET(ODBC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../resources/)
104104

105-
# Common Settings
105+
# DSN Settings
106106
SET(THREADING "0")
107-
SET(TEST_SERVER ${TEST_SERVER},${TEST_PORT})
108-
SET(TEST_DATABASE ${TEST_DATABASE})
109-
110-
# Test Driver
111-
SET(TEST_DSN "wrapper-dsn")
112-
SET(TEST_DRIVER_NAME "aws-odbc-wrapper")
113-
SET(TEST_DRIVER_PATH ${TEST_DRIVER_PATH})
114-
115-
# Base PG Driver
116-
SET(BASE_PG_DSN "pg-dsn")
117-
SET(BASE_PG_DRIVER_NAME "community-pg")
118-
SET(BASE_PG_DRIVER_PATH ${BASE_PG_DRIVER_PATH})
107+
108+
# To be set via flags
109+
# -D TEST_DRIVER_PATH
110+
# -D PG_DRIVER_PATH
111+
# -D PG_SERVER
112+
# -D PG_DATABASE
113+
# -D MYSQL_DRIVER_PATH
114+
# -D MYSQL_SERVER
115+
# -D MYSQL_DATABASE
119116

120117
CONFIGURE_FILE(
121118
${ODBC_PATH}/odbcinst.ini.in

test/integration/failover_integration_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class FailoverIntegrationTest : public BaseFailoverIntegrationTest {
6262
.withPWD(test_pwd)
6363
.withDatabase(test_db)
6464
.withEnableClusterFailover(true)
65+
.withDatabaseDialect(test_dialect)
6566
.getString();
6667

6768
// Check to see if cluster is available.

test/integration/iam_authentication_integration_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class IamAuthenticationIntegrationTest : public BaseConnectionTest {
4646

4747
void SetUp() override {
4848
BaseConnectionTest::SetUp();
49+
if (test_dialect == "AURORA_MYSQL") {
50+
GTEST_SKIP() << "MySQL ODBC Connector does not support IAM with session tokens due to limitations on connection key-value pairs.";
51+
}
4952
}
5053

5154
void TearDown() override {

test/resources/odbc.ini.in

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
[ODBC Data Sources]
2-
data_source_name = @TEST_DSN@
1+
[wrapper-pg-dsn]
2+
Driver = @TEST_DRIVER_PATH@
3+
DATABASE = @PG_DATABASE@
4+
SERVER = @PG_SERVER@
5+
BASE_DRIVER = @PG_DRIVER_PATH@
36

4-
[@TEST_DSN@]
7+
[wrapper-mysql-dsn]
58
Driver = @TEST_DRIVER_PATH@
6-
DATABASE = @TEST_DATABASE@
7-
SERVER = @TEST_SERVER@
8-
BASE_DRIVER = @BASE_PG_DRIVER_PATH@
9+
DATABASE = @MYSQL_DATABASE@
10+
SERVER = @MYSQL_SERVER@
11+
BASE_DRIVER = @MYSQL_DRIVER_PATH@
12+
13+
[pg-dsn]
14+
Driver = @PG_DRIVER_PATH@
15+
DATABASE = @PG_DATABASE@
16+
SERVER = @PG_SERVER@
917

10-
[@BASE_PG_DSN@]
11-
Driver = @BASE_PG_DRIVER_PATH@
12-
DATABASE = @TEST_DATABASE@
13-
SERVER = @TEST_SERVER@
18+
[mysql-dsn]
19+
Driver = @MYSQL_DRIVER_PATH@
20+
DATABASE = @MYSQL_DATABASE@
21+
SERVER = @MYSQL_SERVER@

test/resources/odbcinst.ini.in

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
[ODBC Drivers]
22
@TEST_DRIVER_NAME@ = Installed
3-
@BASE_PG_DRIVER_NAME@ = Installed
3+
community-pg = Installed
4+
community-mysql = Installed
45

56
[@TEST_DRIVER_NAME@]
67
Driver = @TEST_DRIVER_PATH@
78
Threading = @THREADING@
89

9-
[@BASE_PG_DRIVER_NAME@]
10-
Driver = @BASE_PG_DRIVER_PATH@
10+
[community-pg]
11+
Driver = @PG_DRIVER_PATH@
12+
Threading = @THREADING@
13+
14+
[community-mysql]
15+
Driver = @MYSQL_DRIVER_PATH@
1116
Threading = @THREADING@

0 commit comments

Comments
 (0)