Skip to content

Commit f8302e3

Browse files
fix(bq_driver): Enable windows pipeline to utilize Google driver in g… (#1396)
1 parent 5921403 commit f8302e3

7 files changed

Lines changed: 74 additions & 20 deletions

File tree

ci/gha/builds/lib/odbc-driver-install.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ if ($CI_CLOUDBUILD_BUILDS_LIB_ODBC_DRIVER_INSTALL_SH__ -ne $null -and ++$CI_CLOU
2727
# Set Environment Variables
2828
$env:GCS_BUCKET = "bq-dev-tools-testing-drivers"
2929
$env:ODBC_DRIVER_VERSION = "3.1.6.1026"
30+
$env:ODBC_GOOGLE_DRIVER_VERSION = "1.1.3"
3031
if ([string]::IsNullOrEmpty($env:DRIVER_ARCH)) {
3132
throw "DRIVER_ARCH environment variable is not set or empty. Please provide a valid architecture."
3233
}
@@ -39,7 +40,11 @@ if ($env:DRIVER_ARCH -eq 'x64') {
3940
Write-Error "Invalid architecture: $env:DRIVER_ARCH"
4041
exit 1
4142
}
43+
if($env:BUILD_SHARD -eq 'Core'){
4244
$env:ODBC_DRIVER_MSI_NAME = "SimbaODBCDriverforGoogleBigQuery${arch}_${env:ODBC_DRIVER_VERSION}.msi"
45+
}else{
46+
$env:ODBC_DRIVER_MSI_NAME = "ODBCDriverforBigQuery_windows_${env:DRIVER_ARCH}_${env:ODBC_GOOGLE_DRIVER_VERSION}.msi"
47+
}
4348

4449
# Download from Google Cloud Storage (gsutil equivalent)
4550
Write-Output "Downloading $env:ODBC_DRIVER_MSI_NAME from Google Cloud Storage..."

ci/gha/builds/lib/system_dsn_setup_32.reg

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ REGEDIT4
2222

2323
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources]
2424
"SampleDSN"="Simba ODBC Driver for Google BigQuery"
25+
"BigQuery DSN"="ODBC Driver for BigQuery"
2526
"ODBCTransactionsTestsDSN"="Simba ODBC Driver for Google BigQuery"
26-
27+
"ODBCGoogleTransactionsTestsDSN"="ODBC Driver for BigQuery"
2728

2829
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\SampleDSN]
2930
"Description"="ODBC Driver for Google BigQuery 1"
@@ -37,6 +38,11 @@ REGEDIT4
3738
"LargeResultsDataSetId"="_odbc_temp_tables"
3839
"LargeResultsTempTableExpirationTime"="3600000"
3940

41+
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\BigQuery DSN]
42+
"OAuthMechanism"="0"
43+
"Catalog"="bigquery-devtools-drivers"
44+
"KeyFilePath"="C:\\b\\service_account_auth_keys.json"
45+
4046
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBCTransactionsTestsDSN]
4147
"Description"="ODBC Driver for Google BigQuery 2"
4248
"Catalog"="bigquery-devtools-drivers"
@@ -50,6 +56,19 @@ REGEDIT4
5056
"LargeResultsDataSetId"="_odbc_temp_tables"
5157
"LargeResultsTempTableExpirationTime"="3600000"
5258

59+
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBCGoogleTransactionsTestsDSN]
60+
"Description"="ODBC Driver for Google BigQuery 2"
61+
"Catalog"="bigquery-devtools-drivers"
62+
"Driver"="ODBC Driver for BigQuery"
63+
"SQLDialect"="1"
64+
"OAuthMechanism"="0"
65+
"Email"="bq-devtools-simba-drivers-test@bigquery-devtools-drivers.iam.gserviceaccount.com"
66+
"KeyFilePath"="C:\\b\\service_account_auth_keys.json"
67+
"EnableSession"="1"
68+
"AllowLargeResults"="0"
69+
"LargeResultsDataSetId"="_odbc_temp_tables"
70+
"LargeResultsTempTableExpirationTime"="3600000"
71+
5372
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Simba\Simba ODBC Driver for Google BigQuery\Driver]
5473
"LogLevel"="1"
5574
"LogFile"="C:\\b\\trace.log"

ci/gha/builds/lib/system_dsn_setup_64.reg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ REGEDIT4
2222

2323
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]
2424
"SampleDSN"="Simba ODBC Driver for Google BigQuery"
25+
"BigQuery DSN"="ODBC Driver for BigQuery"
2526
"ODBCTransactionsTestsDSN"="Simba ODBC Driver for Google BigQuery"
27+
"ODBCGoogleTransactionsTestsDSN"="ODBC Driver for BigQuery"
2628

2729

2830
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\SampleDSN]
@@ -37,6 +39,11 @@ REGEDIT4
3739
"LargeResultsDataSetId"="_odbc_temp_tables"
3840
"LargeResultsTempTableExpirationTime"="3600000"
3941

42+
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\BigQuery DSN]
43+
"OAuthMechanism"="0"
44+
"Catalog"="bigquery-devtools-drivers"
45+
"KeyFilePath"="C:\\b\\service_account_auth_keys.json"
46+
4047
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBCTransactionsTestsDSN]
4148
"Description"="ODBC Driver for Google BigQuery 2"
4249
"Catalog"="bigquery-devtools-drivers"
@@ -50,6 +57,19 @@ REGEDIT4
5057
"LargeResultsDataSetId"="_odbc_temp_tables"
5158
"LargeResultsTempTableExpirationTime"="3600000"
5259

60+
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBCGoogleTransactionsTestsDSN]
61+
"Description"="ODBC Driver for Google BigQuery 2"
62+
"Catalog"="bigquery-devtools-drivers"
63+
"Driver"="ODBC Driver for BigQuery"
64+
"SQLDialect"="1"
65+
"OAuthMechanism"="0"
66+
"Email"="bq-devtools-simba-drivers-test@bigquery-devtools-drivers.iam.gserviceaccount.com"
67+
"KeyFilePath"="C:\\b\\service_account_auth_keys.json"
68+
"EnableSession"="1"
69+
"AllowLargeResults"="0"
70+
"LargeResultsDataSetId"="_odbc_temp_tables"
71+
"LargeResultsTempTableExpirationTime"="3600000"
72+
5373
[HKEY_LOCAL_MACHINE\SOFTWARE\Simba\Simba ODBC Driver for Google BigQuery\Driver]
5474
"LogLevel"="1"
5575
"LogFile"="C:\\b\\trace.log"

ci/gha/builds/windows-cmake-integration.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ source "$(dirname "$0")/../../lib/init.sh"
2020
source module ci/gha/builds/lib/windows.sh
2121
source module ci/gha/builds/lib/cmake.sh
2222

23-
export ODBC_TESTS_DSN="SampleDSN"
23+
if [ "$BUILD_SHARD" == "Core" ]; then
24+
export ODBC_TESTS_DSN="SampleDSN"
25+
export ODBC_TRANSACTIONS_TESTS_DSN="ODBCTransactionsTestsDSN"
26+
else
27+
export ODBC_TESTS_DSN="BigQuery DSN"
28+
export ODBC_TRANSACTIONS_TESTS_DSN="ODBCGoogleTransactionsTestsDSN"
29+
fi
2430

2531
# Set VCPKG_TRIPLET based on DRIVER_ARCH
2632
if [ "${DRIVER_ARCH:-}" == "x64" ]; then
@@ -87,24 +93,19 @@ time {
8793

8894
if [ "$BUILD_SHARD" == "BqDriver" ] && [ "$DRIVER_ARCH" == "x64" ]; then
8995
for file in "${CMAKE_OUT}"/google/cloud/odbc/*.dll; do
90-
cp "$file" "C:\Program Files\Simba ODBC Driver for Google BigQuery\lib"
96+
cp "$file" "C:\Program Files\ODBC Driver for BigQuery\lib"
9197
done
92-
cp "${CMAKE_OUT}"/google/cloud/odbc/google_cloud_odbc_bq_driver.dll "C:\Program Files\Simba ODBC Driver for Google BigQuery\lib\GoogleBigQueryODBC_sb64.dll"
98+
cp "${CMAKE_OUT}"/google/cloud/odbc/google_cloud_odbc_bq_driver.dll "C:\Program Files\ODBC Driver for BigQuery\google_cloud_odbc_bq_driver.dll"
9399
fi
94100

95101
if [ "$BUILD_SHARD" == "BqDriver" ] && [ "$DRIVER_ARCH" == "x86" ]; then
96102
for file in "${CMAKE_OUT}"/google/cloud/odbc/*.dll; do
97-
cp "$file" "C:\Program Files (x86)\Simba ODBC Driver for Google BigQuery\lib"
103+
cp "$file" "C:\Program Files (x86)\ODBC Driver for BigQuery\lib"
98104
done
99-
cp "${CMAKE_OUT}"/google/cloud/odbc/google_cloud_odbc_bq_driver.dll "C:\Program Files (x86)\Simba ODBC Driver for Google BigQuery\lib\GoogleBigQueryODBC_sb32.dll"
105+
cp "${CMAKE_OUT}"/google/cloud/odbc/google_cloud_odbc_bq_driver.dll "C:\Program Files (x86)\ODBC Driver for BigQuery\google_cloud_odbc_bq_driver.dll"
100106
fi
101107

102108
TIMEFORMAT="==> 🕑 CMake test done in %R seconds"
103109
time {
104-
# gRPC requires a local roots.pem on Windows
105-
# https://github.com/grpc/grpc/issues/16571
106-
curl -fsSL -o "${HOME}/roots.pem" https://pki.google.com/roots.pem
107-
export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="${HOME}/roots.pem"
108-
109110
io::run ctest "${ctest_args[@]}" --test-dir "${CMAKE_OUT}" -LE integration-test
110111
}

google/cloud/odbc/bq_driver/internal/trace_utils_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TEST(CanWriteToFile, AllSecnarios) {
104104

105105
TEST(ClearOldLogFiles, WhenMaxFileCountIsOne) {
106106
std::string dir = std::filesystem::temp_directory_path().string();
107-
std::string file = dir + "/trace_0.log";
107+
std::string file = dir + "/Tracetestingcountone_0.log";
108108

109109
CreateDummyFile(file);
110110

@@ -117,7 +117,7 @@ TEST(ClearOldLogFiles, WhenMaxFileCountIsOne) {
117117

118118
TEST(ClearOldLogFiles, WhenLessThanMaxCount) {
119119
std::string dir = std::filesystem::temp_directory_path().string();
120-
std::string file = dir + "/trace_0.log";
120+
std::string file = dir + "/Tracetestingmaxcount_0.log";
121121

122122
CreateDummyFile(file);
123123
ClearOldLogFiles(dir, 2, 5);

google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ namespace google::cloud::odbc_tests {
2020
using google::cloud::odbc_tests::SetAttributes;
2121
using ::testing::HasSubstr;
2222

23-
// TODO(b/380186523): Need to fix the Driver Name for both Windows & Linux
2423
std::string GetDriverName() {
24+
#ifndef BQ_DRIVER_INTEGRATION_TESTS
2525
#ifdef _WIN32
2626
return "Simba ODBC Driver for Google BigQuery";
2727
#else
28-
#ifndef BQ_DRIVER_INTEGRATION_TESTS
2928
return "Simba Google BigQuery ODBC Connector";
29+
#endif /* _WIN32 */
3030
#else
3131
return "ODBC Driver for BigQuery";
32-
#endif
33-
34-
#endif // _WIN32
32+
#endif /* BQ_DRIVER_INTEGRATION_TESTS */
3533
}
3634

3735
TEST(SQLGetInfo, CheckPositionalUpdate) {
@@ -1129,8 +1127,11 @@ TEST(ConnectionTest, SQLBrowseConnect_StringDataRightTruncated) {
11291127
sizeof(in_conn_str), (SQLCHAR*)out_conn_str,
11301128
sizeof(out_conn_str), &out_conn_str_len);
11311129
EXPECT_EQ(status, SQL_NEED_DATA);
1132-
1130+
#ifndef BQ_DRIVER_INTEGRATION_TESTS
11331131
std::string const expected_conn_out_str = "DSN=Sampl";
1132+
#else
1133+
std::string const expected_conn_out_str = "DSN=BigQu";
1134+
#endif
11341135
EXPECT_NE(out_conn_str_len, expected_conn_out_str.size());
11351136

11361137
// TODO(b/382204927): SQLBrowseConnect API out_conn_str come as empty(Linux)

google/cloud/odbc/testing/odbc_utils/connection.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ inline std::string GetDefaultDSN() {
2828
.value_or("ODBCTestsDSN");
2929
}
3030

31+
// Returns the default Transactions DSN name after checking if
32+
// ODBC_TRANSACTIONS_TESTS_DSN env is defined
33+
inline std::string GetDefaultTransactionsTestDSN() {
34+
return google::cloud::internal::GetEnv("ODBC_TRANSACTIONS_TESTS_DSN")
35+
.value_or("ODBCTransactionsTestsDSN");
36+
}
37+
3138
std::string const kDefaultDataSource = GetDefaultDSN();
3239

3340
auto const kDefaultConnectionString = "DSN=" + GetDefaultDSN();
34-
auto const kSessionEnabledConnectionString = "DSN=ODBCTransactionsTestsDSN";
41+
auto const kSessionEnabledConnectionString =
42+
"DSN=" + GetDefaultTransactionsTestDSN();
3543

3644
// used for DSNLess SQLConnect. If we change BQ service account credentials
3745
// email it will need to be changed here as well other DSNLess connect tests

0 commit comments

Comments
 (0)