Skip to content

Commit

Permalink
test: run integration tests that rely on Linux (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq authored Jul 9, 2024
1 parent 836b2a3 commit fa252ae
Show file tree
Hide file tree
Showing 26 changed files with 137 additions and 134 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/dockerized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ on:
push:
branches:
- main
# pull_request:
# branches:
# - '*'
# paths-ignore:
# - '**/*.md'
# - '**/*.jpg'
# - '**/README.txt'
# - '**/LICENSE.txt'
# - 'docs/**'
# - 'ISSUE_TEMPLATE/**'
# - '**/remove-old-artifacts.yml'
pull_request:
branches:
- '*'
paths-ignore:
- '**/*.md'
- '**/*.jpg'
- '**/README.txt'
- '**/LICENSE.txt'
- 'docs/**'
- 'ISSUE_TEMPLATE/**'
- '**/remove-old-artifacts.yml'

env:
BUILD_TYPE: Release
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/failover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ jobs:
# -DCONNECTOR_PLATFORM=linux
# -DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.28-x86_64/
# -DENABLE_UNIT_TESTS=TRUE
# -DENABLE_INTEGRATION_TESTS=FALSE
#
# - name: copy AWS SDK libraries to driver library
# run: |
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: Integration Tests

on:
workflow_dispatch:
# push:
# branches:
# - main
# pull_request:
# branches:
# - '*'
# paths-ignore:
# - '**/*.md'
# - '**/*.jpg'
# - '**/README.txt'
# - '**/LICENSE.txt'
# - 'docs/**'
# - 'ISSUE_TEMPLATE/**'
# - '**/remove-old-artifacts.yml'
push:
branches:
- main
pull_request:
branches:
- '*'
paths-ignore:
- '**/*.md'
- '**/*.jpg'
- '**/README.txt'
- '**/LICENSE.txt'
- 'docs/**'
- 'ISSUE_TEMPLATE/**'
- '**/remove-old-artifacts.yml'

env:
BUILD_TYPE: Release
Expand All @@ -28,7 +28,7 @@ jobs:
integration-tests:
strategy:
matrix:
engine_version: ["latest", "lts"]
engine_version: ["lts", "latest"]
name: Integration Tests
runs-on: ubuntu-latest
env:
Expand Down
4 changes: 2 additions & 2 deletions driver/catalog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,10 @@ int add_name_condition_pv_id(HSTMT hstmt, std::string &query, SQLCHAR * name,
return an error if they were.
*/
#define CHECK_CATALOG_SCHEMA(ST, CN, CL, SN, SL) \
if (ST->dbc->ds.opt_NO_CATALOG && CN && *CN && CL) \
if (ST->dbc->ds->opt_NO_CATALOG && CN && *CN && CL) \
return ST->set_error("HY000", "Support for catalogs is disabled by " \
"NO_CATALOG option, but non-empty catalog is specified.", 0); \
if (ST->dbc->ds.opt_NO_SCHEMA && SN && *SN && SL) \
if (ST->dbc->ds->opt_NO_SCHEMA && SN && *SN && SL) \
return ST->set_error("HY000", "Support for schemas is disabled by " \
"NO_SCHEMA option, but non-empty schema is specified.", 0); \
if (CN && *CN && CL && SN && *SN && SL) \
Expand Down
6 changes: 3 additions & 3 deletions driver/catalog_no_i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ std::string get_database_name(STMT *stmt,
bool try_reget)
{
std::string db;
if (!stmt->dbc->ds.opt_NO_CATALOG && catalog && catalog_len)
if (!stmt->dbc->ds->opt_NO_CATALOG && catalog && catalog_len)
{
// Catalog parameter can be used
db = (catalog_len != SQL_NTS ? std::string((char *)catalog, catalog_len) :
std::string((char *)catalog));
}
else if(!stmt->dbc->ds.opt_NO_SCHEMA && schema && schema_len)
else if(!stmt->dbc->ds->opt_NO_SCHEMA && schema && schema_len)
{
// Schema parameter can be used
db = (schema_len != SQL_NTS ? std::string((char*)schema, schema_len) :
std::string((char *)schema));
}
else if (!stmt->dbc->ds.opt_NO_CATALOG || !stmt->dbc->ds.opt_NO_SCHEMA)
else if (!stmt->dbc->ds->opt_NO_CATALOG || !stmt->dbc->ds->opt_NO_SCHEMA)
{
if (!try_reget)
return db;
Expand Down
22 changes: 11 additions & 11 deletions driver/connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1022,12 +1022,12 @@ SQLRETURN DBC::connect(DataSource *dsrc, bool failover_enabled, bool is_monitor_
return SQL_ERROR;
}

ds = *dsrc;
ds = dsrc;
/* init all needed UTF-8 strings */
const char *opt_db = ds.opt_DATABASE;
const char *opt_db = ds->opt_DATABASE;
database = opt_db ? opt_db : "";

if (ds.opt_LOG_QUERY && !log_file)
if (ds->opt_LOG_QUERY && !log_file)
log_file = init_log_file();

/* Set the statement error prefix based on the server version. */
Expand All @@ -1042,7 +1042,7 @@ SQLRETURN DBC::connect(DataSource *dsrc, bool failover_enabled, bool is_monitor_
int set_reconnect_result = 0;
#if MYSQL_VERSION_ID < 80300
/* This needs to be set after connection, or it doesn't stick. */
if (ds.opt_AUTO_RECONNECT)
if (ds->opt_AUTO_RECONNECT)
{
connection_proxy->options(MYSQL_OPT_RECONNECT, (char *)&on);
}
Expand All @@ -1054,7 +1054,7 @@ SQLRETURN DBC::connect(DataSource *dsrc, bool failover_enabled, bool is_monitor_
/* Make sure autocommit is set as configured. */
if (commit_flag == CHECK_AUTOCOMMIT_OFF)
{
if (!transactions_supported() || ds.opt_NO_TRANSACTIONS)
if (!transactions_supported() || ds->opt_NO_TRANSACTIONS)
{
commit_flag = CHECK_AUTOCOMMIT_ON;
rc = set_error(MYERR_01S02,
Expand Down Expand Up @@ -1130,7 +1130,7 @@ SQLRETURN DBC::connect(DataSource *dsrc, bool failover_enabled, bool is_monitor_
new old new reconnect option ignored with warning
new new * reconnect option ignored with warning
*/
if (ds.opt_AUTO_RECONNECT && set_reconnect_result)
if (ds->opt_AUTO_RECONNECT && set_reconnect_result)
{
set_error("HY000",
"The option AUTO_RECONNECT is not supported "
Expand Down Expand Up @@ -1596,20 +1596,20 @@ void DBC::free_connection_stmts()
SQLRETURN SQL_API SQLDisconnect(SQLHDBC hdbc)
{
DBC *dbc= (DBC *) hdbc;
DataSource ds = dbc->ds;
DataSource* ds = dbc->ds;

if (ds.opt_GATHER_PERF_METRICS) {
if (ds->opt_GATHER_PERF_METRICS) {
std::string cluster_id_str = "";
if (dbc->fh) {
cluster_id_str = dbc->fh->cluster_id;
}

if (((cluster_id_str == DEFAULT_CLUSTER_ID) || ds.opt_GATHER_PERF_METRICS_PER_INSTANCE) && dbc->connection_proxy) {
if (((cluster_id_str == DEFAULT_CLUSTER_ID) || ds->opt_GATHER_PERF_METRICS_PER_INSTANCE) && dbc->connection_proxy) {
cluster_id_str = dbc->connection_proxy->get_host();
cluster_id_str.append(":").append(std::to_string(dbc->connection_proxy->get_port()));
}

CLUSTER_AWARE_METRICS_CONTAINER::report_metrics(cluster_id_str, dbc->ds.opt_GATHER_PERF_METRICS_PER_INSTANCE, dbc->log_file, dbc->id);
CLUSTER_AWARE_METRICS_CONTAINER::report_metrics(cluster_id_str, dbc->ds->opt_GATHER_PERF_METRICS_PER_INSTANCE, dbc->log_file, dbc->id);
}

CHECK_HANDLE(hdbc);
Expand All @@ -1618,7 +1618,7 @@ SQLRETURN SQL_API SQLDisconnect(SQLHDBC hdbc)

dbc->close();

if (ds.opt_LOG_QUERY)
if (ds->opt_LOG_QUERY)
end_log_file();

/* free allocated packet buffer */
Expand Down
4 changes: 2 additions & 2 deletions driver/connection_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CONNECTION_PROXY* CONNECTION_HANDLER::connect(std::shared_ptr<HOST_INFO> host_in
}

DataSource* ds_to_use = new DataSource();
ds_to_use->copy(ds ? ds : &dbc->ds);
ds_to_use->copy(ds ? ds : dbc->ds);
const auto new_host = to_sqlwchar_string(host_info->get_host());

DBC* dbc_clone = clone_dbc(dbc, ds_to_use);
Expand Down Expand Up @@ -100,7 +100,7 @@ void CONNECTION_HANDLER::update_connection(

// Update original ds to reflect change in host/server.

dbc->ds.opt_SERVER.set_remove_brackets((SQLWCHAR*) new_host_name_wstr.c_str(), new_host_name_wstr.size());
dbc->ds->opt_SERVER.set_remove_brackets((SQLWCHAR*) new_host_name_wstr.c_str(), new_host_name_wstr.size());
}
}

Expand Down
8 changes: 4 additions & 4 deletions driver/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ extern std::mutex global_fido_mutex;
/* data-at-exec handling done for current SQLSetPos() call */
#define DAE_SETPOS_DONE 10

#define DONT_USE_LOCALE_CHECK(STMT) if (!STMT->dbc->ds.opt_NO_LOCALE)
#define DONT_USE_LOCALE_CHECK(STMT) if (!STMT->dbc->ds->opt_NO_LOCALE)

#if defined _WIN32

Expand Down Expand Up @@ -614,7 +614,7 @@ struct DBC
*cxn_charset_info = nullptr;
MY_SYNTAX_MARKERS *syntax = nullptr;
// data source used to connect (parsed or stored)
DataSource ds;
DataSource *ds = nullptr;
// value of the sql_select_limit currently set for a session
// (SQLULEN)(-1) if wasn't set
SQLULEN sql_select_limit = -1;
Expand Down Expand Up @@ -731,13 +731,13 @@ enum OUT_PARAM_STATE

#define CAT_SCHEMA_SET_FULL(STMT, C, S, V, CZ, SZ, CL, SL) { \
bool cat_is_set = false; \
if (!STMT->dbc->ds.opt_NO_CATALOG && (CL || !SL)) \
if (!STMT->dbc->ds->opt_NO_CATALOG && (CL || !SL)) \
{ \
C = V;\
S = nullptr; \
cat_is_set = true; \
} \
if (!STMT->dbc->ds.opt_NO_SCHEMA && !cat_is_set && SZ) \
if (!STMT->dbc->ds->opt_NO_SCHEMA && !cat_is_set && SZ) \
{ \
S = V; \
C = nullptr; \
Expand Down
12 changes: 6 additions & 6 deletions driver/error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,11 @@ MySQLGetDiagField(SQLSMALLINT handle_type, SQLHANDLE handle, SQLSMALLINT record,
return SQL_ERROR;

if (handle_type == SQL_HANDLE_DESC)
ds= &desc->stmt->dbc->ds;
ds= desc->stmt->dbc->ds;
else if (handle_type == SQL_HANDLE_STMT)
ds= &stmt->dbc->ds;
ds= stmt->dbc->ds;
else if (handle_type == SQL_HANDLE_DBC)
ds= &dbc->ds;
ds= dbc->ds;
else
*char_value= (SQLCHAR*)"";

Expand Down Expand Up @@ -579,11 +579,11 @@ MySQLGetDiagField(SQLSMALLINT handle_type, SQLHANDLE handle, SQLSMALLINT record,
if (record <= 0)
return SQL_ERROR;
if (handle_type == SQL_HANDLE_DESC)
ds = &desc->stmt->dbc->ds;
ds = desc->stmt->dbc->ds;
else if (handle_type == SQL_HANDLE_STMT)
ds = &stmt->dbc->ds;
ds = stmt->dbc->ds;
else if (handle_type == SQL_HANDLE_DBC)
ds = &dbc->ds;
ds = dbc->ds;
else
*char_value= (SQLCHAR *)"";

Expand Down
18 changes: 9 additions & 9 deletions driver/execute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ SQLRETURN do_query(STMT *stmt, std::string query)
* and when no musltiple statements is allowed - we can't now parse query
* that well to detect multiple queries.
*/
if (stmt->dbc->ds.opt_PREFETCH > 0
&& !stmt->dbc->ds.opt_MULTI_STATEMENTS
if (stmt->dbc->ds->opt_PREFETCH > 0
&& !stmt->dbc->ds->opt_MULTI_STATEMENTS
&& stmt->stmt_options.cursor_type == SQL_CURSOR_FORWARD_ONLY
&& scrollable(stmt, query.c_str(), query.c_str() + query_length)
&& !ssps_used(stmt))
Expand All @@ -112,7 +112,7 @@ SQLRETURN do_query(STMT *stmt, std::string query)
stmt->scroller.reset();

stmt->scroller.row_count= calc_prefetch_number(
stmt->dbc->ds.opt_PREFETCH,
stmt->dbc->ds->opt_PREFETCH,
stmt->ard->array_size,
stmt->stmt_options.max_rows);

Expand Down Expand Up @@ -664,7 +664,7 @@ SQLRETURN convert_c_type2str(STMT *stmt, SQLSMALLINT ctype, DESCREC *iprec,
case SQL_C_TYPE_DATE:
{
DATE_STRUCT *date= (DATE_STRUCT*) *res;
if (stmt->dbc->ds.opt_MIN_DATE_TO_ZERO && !date->year
if (stmt->dbc->ds->opt_MIN_DATE_TO_ZERO && !date->year
&& (date->month == date->day == 1))
{
*length = myodbc_snprintf(buff, buff_max, "0000-00-00");
Expand Down Expand Up @@ -697,7 +697,7 @@ SQLRETURN convert_c_type2str(STMT *stmt, SQLSMALLINT ctype, DESCREC *iprec,
{
TIMESTAMP_STRUCT *time= (TIMESTAMP_STRUCT*) *res;

if (stmt->dbc->ds.opt_MIN_DATE_TO_ZERO &&
if (stmt->dbc->ds->opt_MIN_DATE_TO_ZERO &&
!time->year && (time->month == time->day == 1))
{
*length = myodbc_snprintf(buff, buff_max, "0000-00-00 %02d:%02d:%02d",
Expand Down Expand Up @@ -1037,7 +1037,7 @@ SQLRETURN insert_param(STMT *stmt, MYSQL_BIND *bind, DESC* apd,
Not sure if fraction should be considered as an overflow.
In fact specs say about "time fields only"
*/
if (!stmt->dbc->ds.opt_NO_DATE_OVERFLOW && TIME_FIELDS_NONZERO(ts))
if (!stmt->dbc->ds->opt_NO_DATE_OVERFLOW && TIME_FIELDS_NONZERO(ts))
{
return stmt->set_error("22008", "Date overflow", 0);
}
Expand Down Expand Up @@ -1227,7 +1227,7 @@ SQLRETURN insert_param(STMT *stmt, MYSQL_BIND *bind, DESC* apd,
size_t local_thousands_sep_length = thousands_sep.length();
size_t local_decimal_point_length = decimal_point.length();

if (!stmt->dbc->ds.opt_NO_LOCALE)
if (!stmt->dbc->ds->opt_NO_LOCALE)
{
/* force use of . as decimal point */
local_thousands_sep= ",";
Expand Down Expand Up @@ -2010,8 +2010,8 @@ SQLRETURN SQL_API SQLCancel(SQLHSTMT hstmt)
interfere with the existing one. Therefore, locking is not needed in
the following block.
*/
auto host = std::make_shared<HOST_INFO>((const char*)dbc->ds.opt_SERVER, dbc->ds.opt_PORT);
CONNECTION_PROXY* proxy = dbc->connection_handler->connect(host, &dbc->ds);
auto host = std::make_shared<HOST_INFO>((const char*)dbc->ds->opt_SERVER, dbc->ds->opt_PORT);
CONNECTION_PROXY* proxy = dbc->connection_handler->connect(host, dbc->ds);

/** @todo need to preserve and use ssl params */
if (!proxy)
Expand Down
16 changes: 8 additions & 8 deletions driver/handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,37 +350,37 @@ int reset_connection(DBC *dbc)

int wakeup_connection(DBC *dbc)
{
DataSource &ds = dbc->ds;
DataSource *ds = dbc->ds;

#if MFA_ENABLED
if(ds.opt_PWD1)
if(ds->opt_PWD1)
{
int fator = 2;
dbc->connection_proxy->options4(MYSQL_OPT_USER_PASSWORD,
&fator,
(const char*)ds.opt_PWD1);
(const char*)ds->opt_PWD1);
}

if (ds.opt_PWD2)
if (ds->opt_PWD2)
{
ds_get_utf8attr(ds->pwd2, &ds->pwd28);
int fator = 2;
dbc->connection_proxy->options4(MYSQL_OPT_USER_PASSWORD,
&fator,
(const char *)ds.opt_PWD2);
(const char *)ds->opt_PWD2);
}

if (ds.opt_PWD3)
if (ds->opt_PWD3)
{
ds_get_utf8attr(ds->pwd3, &ds->pwd38);
int fator = 3;
dbc->connection_proxy->options4(MYSQL_OPT_USER_PASSWORD,
&fator,
(const char *)ds.opt_PWD3);
(const char *)ds->opt_PWD3);
}
#endif

if (dbc->connection_proxy->change_user(ds.opt_UID, ds.opt_PWD, ds.opt_DATABASE))
if (dbc->connection_proxy->change_user(ds->opt_UID, ds->opt_PWD, ds->opt_DATABASE))
{
return 1;
}
Expand Down
Loading

0 comments on commit fa252ae

Please sign in to comment.