From 476f3f171c1ae7bcf3afdd6ffee6051350a6cd9e Mon Sep 17 00:00:00 2001 From: affonsoBQ <67347924+affonsoBQ@users.noreply.github.com> Date: Thu, 28 Oct 2021 12:42:00 -0700 Subject: [PATCH] GitHub Actions - Assemble and publish build artefacts (#1) fixing GitHub actions and unit tests --- .github/workflows/linux-build.yml | 47 +- .github/workflows/mac-build.yml | 47 +- .github/workflows/mac-debug-build.yml | 22 +- .github/workflows/release-workflow.yml | 18 - .github/workflows/{main.yml => win-build.yml} | 68 ++- .github/workflows/win-debug-build.yml | 49 +- src/Tests/ITODBCHelper/it_odbc_helper.h | 3 + src/Tests/Tests/test_odbc_catalog.cpp | 177 +++++++ src/Tests/Tests/test_odbc_connection.cpp | 29 ++ src/Tests/Tests/test_odbc_descriptors.cpp | 63 +++ src/Tests/Tests/test_odbc_execution.cpp | 147 ++++++ src/Tests/Tests/test_odbc_info.cpp | 9 + src/Tests/Tests/test_odbc_results.cpp | 447 ++++++++++++++++++ src/Tests/Tests/test_odbc_tableau_queries.cpp | 4 + src/timestreamsqlodbc/odbc_communication.cpp | 7 + 15 files changed, 985 insertions(+), 152 deletions(-) rename .github/workflows/{main.yml => win-build.yml} (69%) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index dd51de6eb..f28b4b539 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,13 +1,13 @@ -name: Timestream ODBC Driver for Linux +name: ODBC Driver for Linux on: push: branches: - - master + - main - develop pull_request: branches: - - master + - main - develop env: @@ -16,6 +16,7 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + NOT_CONNECTED: 1 jobs: build-linux64: @@ -42,35 +43,27 @@ jobs: run: | sudo cp ./src/Tests/Tests/odbc-linux64.ini /etc/odbc.ini sudo cp ./src/Tests/Tests/odbcinst-linux64.ini /etc/odbcinst.ini - mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs + mkdir -p ${{ github.workspace }}/odbc-logs export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini - name: configure-and-build-driver run: | ./build_linux_release64_deb.sh - - name: configure-aws-credentials - if: success() - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: run-tests if: success() run: | - ./build/odbc/bin/tests --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* + ./build/odbc/bin/tests --gtest_output="xml:report.xml" - name: prepare-test-results if: always() run: | - cp /tmp/timestreamodbc_*.log ${{ github.workspace }}/odbc-logs/ - - name: upload-test-results - if: always() + cp ${{ github.workspace }}/report.xml ${{ github.workspace }}/odbc-logs/ + - name: upload-test-report + if: failure() uses: actions/upload-artifact@v2 with: name: test-results-linux64 - path: | - ${{ github.workspace }}/odbc-logs/ + path: ${{ github.workspace }}/report.xml - name: build-deb-installer if: success() run: | @@ -126,17 +119,10 @@ jobs: run: | sudo cp ./src/Tests/Tests/odbc-linux32.ini /etc/odbc.ini sudo cp ./src/Tests/Tests/odbcinst-linux32.ini /etc/odbcinst.ini - mkdir /home/runner/work/timestream-odbc/timestream-odbc/odbc-logs + mkdir -p ${{ github.workspace }}/odbc-logs export ODBCSYSINI=/etc/ export ODBCINSTINI=odbcinst.ini export ODBCINI=/etc/odbc.ini - - name: configure-aws-credentials - if: success() - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: configure-and-build-driver if: success() run: | @@ -144,18 +130,17 @@ jobs: - name: run-tests if: success() run: | - ./build/odbc/bin/tests --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* + ./build/odbc/bin/tests --gtest_output="xml:report.xml" - name: prepare-test-results if: always() run: | - cp /tmp/timestreamodbc_*.log ${{ github.workspace }}/odbc-logs/ - - name: upload-test-results - if: always() + cp ${{ github.workspace }}/report.xml ${{ github.workspace }}/odbc-logs/ + - name: upload-test-report + if: failure() uses: actions/upload-artifact@v2 with: name: test-results-linux32 - path: | - ${{ github.workspace }}/odbc-logs/ + path: ${{ github.workspace }}/report.xml - name: build-deb-installer if: success() run: | diff --git a/.github/workflows/mac-build.yml b/.github/workflows/mac-build.yml index 5efa5d544..aecbf1db0 100644 --- a/.github/workflows/mac-build.yml +++ b/.github/workflows/mac-build.yml @@ -1,7 +1,14 @@ -name: Timestream ODBC Driver for Mac +name: ODBC Driver for Mac on: - workflow_dispatch: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop env: CI_OUTPUT_PATH: "ci-output" @@ -9,6 +16,7 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + NOT_CONNECTED: 1 jobs: build-mac: @@ -34,12 +42,6 @@ jobs: - name: configure-and-build-driver run: | ./build_mac_release64.sh - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: prepare-dsn run: | sudo mkdir /Library/ODBC @@ -48,12 +50,13 @@ jobs: mkdir ${{ github.workspace }}/odbc-logs - name: run-tests run: | - ./build/odbc/bin/tests --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: print-test-logs + ./build/odbc/bin/tests --gtest_output="xml:report.xml" + - name: upload-test-report if: failure() - run: | - cat /tmp/timestreamodbc_*.log - cat ./aws_sdk_*.log + uses: actions/upload-artifact@v2 + with: + name: test-result-macos + path: ${{ github.workspace }}/report.xml - name: print-memory-leak-logs if: always() run: | @@ -66,9 +69,9 @@ jobs: path: | ${{ github.workspace }}/odbc-logs/ ${{ github.workspace }}/leaks_ - #- name: test - # run: | - # bash ./run_test_runner.sh + # - name: test + # run: | + # bash ./run_test_runner.sh - name: build-installer if: success() run: | @@ -98,9 +101,9 @@ jobs: with: name: mac64-installer path: installer - #- name: upload-test-results - # if: success() - # uses: actions/upload-artifact@v2 - # with: - # name: mac-test-results - # path: test-output + - name: upload-test-results + if: success() + uses: actions/upload-artifact@v2 + with: + name: mac-test-results + path: test-output diff --git a/.github/workflows/mac-debug-build.yml b/.github/workflows/mac-debug-build.yml index e10edd67c..fad250485 100644 --- a/.github/workflows/mac-debug-build.yml +++ b/.github/workflows/mac-debug-build.yml @@ -1,4 +1,4 @@ -name: Timestream ODBC Driver for Mac (Debug) +name: ODBC Driver for Mac (Debug) on: workflow_dispatch: @@ -9,10 +9,13 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + NOT_CONNECTED: 1 jobs: build-mac: runs-on: macos-latest + env: + NOT_CONNETECD: 1 steps: - uses: actions/checkout@v2 - name: run-cppcheck @@ -37,12 +40,6 @@ jobs: - name: configure-and-build-driver run: | ./build_mac_debug64.sh - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: prepare-dsn run: | sudo mkdir /Library/ODBC @@ -50,12 +47,13 @@ jobs: mkdir ${{ github.workspace }}/odbc-logs - name: run-tests run: | - ./build/odbc/bin/tests --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: print-test-logs + ./build/odbc/bin/tests --gtest_output="xml:report.xml" + - name: upload-test-report if: failure() - run: | - cat /tmp/timestreamodbc_*.log - cat ./aws_sdk_*.log + uses: actions/upload-artifact@v2 + with: + name: test-result-macos + path: ${{ github.workspace }}\report.xml - name: print-memory-leak-logs if: always() run: | diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 0227f90fd..6c468153e 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -21,12 +21,6 @@ jobs: run: | brew install cppcheck sh run_cppcheck.sh - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: upload-cppcheck-results if: failure() uses: actions/upload-artifact@v2 @@ -79,12 +73,6 @@ jobs: uses: lukka/get-cmake@v3.18.3 - name: add-msbuild-to-path uses: microsoft/setup-msbuild@v1.0.2 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: configure-and-build-driver run: | .\build_win_release32.ps1 @@ -116,12 +104,6 @@ jobs: uses: lukka/get-cmake@v3.18.3 - name: add-msbuild-to-path uses: microsoft/setup-msbuild@v1.0.2 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: configure-and-build-driver run: | .\build_win_release64.ps1 diff --git a/.github/workflows/main.yml b/.github/workflows/win-build.yml similarity index 69% rename from .github/workflows/main.yml rename to .github/workflows/win-build.yml index 1c252d5c3..a95e099ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/win-build.yml @@ -1,13 +1,13 @@ -name: Timestream ODBC Driver +name: ODBC Driver for Windows on: push: branches: - - master + - main - develop pull_request: branches: - - master + - main - develop env: @@ -16,6 +16,7 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + NOT_CONNECTED: 1 jobs: build-windows32: @@ -29,12 +30,6 @@ jobs: - name: configure-and-build-driver run: | .\build_win_release32.ps1 - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: import-registry run: | reg import .\src\Tests\Tests\AWSProfileRegistry_Win32.reg @@ -42,13 +37,13 @@ jobs: mkdir ${{ github.workspace }}\odbc-logs - name: run-tests run: | - .\build\odbc\bin\Release\tests.exe --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: upload-test-logs + .\build\odbc\bin\Release\tests.exe --gtest_output="xml:report.xml" + - name: upload-test-report if: failure() uses: actions/upload-artifact@v2 with: name: test-logs-win32 - path: ${{ github.workspace }}\odbc-logs\ + path: ${{ github.workspace }}\report.xml - name: build-installer if: success() run: | @@ -69,12 +64,12 @@ jobs: with: name: windows32-installer path: ci-output/installer - #- name: upload-test-results - # if: always() - # uses: actions/upload-artifact@v2 - # with: - # name: windows-test-results - # path: $CI_OUTPUT_PATH/test + - name: upload-test-results + if: always() + uses: actions/upload-artifact@v2 + with: + name: windows-test-results + path: $CI_OUTPUT_PATH/test build-windows64: runs-on: windows-latest steps: @@ -86,12 +81,6 @@ jobs: - name: configure-and-build-driver run: | .\build_win_release64.ps1 - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: import-registry run: | reg import .\src\Tests\Tests\AWSProfileRegistry.reg @@ -99,13 +88,13 @@ jobs: mkdir ${{ github.workspace }}\odbc-logs - name: run-tests run: | - .\build\odbc\bin\Release\tests.exe --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: upload-test-logs + .\build\odbc\bin\Release\tests.exe --gtest_output="xml:report.xml" + - name: upload-test-report if: failure() uses: actions/upload-artifact@v2 with: name: test-logs-win64 - path: ${{ github.workspace }}\odbc-logs\ + path: ${{ github.workspace }}\report.xml - name: build-installer if: success() run: | @@ -142,23 +131,24 @@ jobs: - name: configure-and-build-driver run: | .\build_win_debug64.ps1 - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: import-registry run: | reg import .\src\Tests\Tests\AWSProfileRegistry.reg reg import .\src\Tests\Tests\IAMRegistry.reg - name: run-tests run: | - opencppcoverage --sources src --excluded_modules ut_conn --excluded_modules ut_helper --excluded_modules gtest --excluded_modules aws --export_type cobertura:coverage.xml -- ${{ github.workspace }}\build\odbc\bin\Debug\tests.exe --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: Upload Report to Codecov + opencppcoverage --sources src --excluded_modules ut_conn --excluded_modules ut_helper --excluded_modules gtest --excluded_modules aws --export_type cobertura:coverage.xml -- ${{ github.workspace }}\build\odbc\bin\Debug\tests.exe --gtest_output="xml:report.xml" + - name: upload-coverage if: always() - uses: codecov/codecov-action@v2.0.2 + uses: actions/upload-artifact@v2 with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - fail_ci_if_error: true + name: coverage.xml + path: ./coverage.xml + # The step below should be uncommented after the codecov is setup + # - name: Upload Report to Codecov + # if: always() + # uses: codecov/codecov-action@v2.0.2 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # files: ./coverage.xml + # fail_ci_if_error: true diff --git a/.github/workflows/win-debug-build.yml b/.github/workflows/win-debug-build.yml index cc1791a17..f1e3ff84f 100644 --- a/.github/workflows/win-debug-build.yml +++ b/.github/workflows/win-debug-build.yml @@ -1,4 +1,4 @@ -name: Timestream ODBC Driver for Windows (Debug) +name: ODBC Driver for Windows (Debug) on: workflow_dispatch: @@ -9,6 +9,7 @@ env: ODBC_BIN_PATH: "./build/odbc/bin" ODBC_BUILD_PATH: "./build/odbc/build" AWS_SDK_INSTALL_PATH: "./build/aws-sdk/install" + NOT_CONNECTED: 1 jobs: build-windows32: @@ -25,12 +26,6 @@ jobs: - name: build-tests run: | MSBuild.exe ./build/odbc/cmake/global_make_list.sln -property:Configuration=Debug,Platform=Win32 - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: import-registry run: | reg import .\src\Tests\Tests\AWSProfileRegistry_Win32.reg @@ -38,7 +33,7 @@ jobs: mkdir ${{ github.workspace }}\odbc-logs - name: run-tests run: | - .\build\odbc\bin\Debug\tests.exe --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* + .\build\odbc\bin\Debug\tests.exe --gtest_output="xml:report.xml" - name: upload-test-logs if: always() uses: actions/upload-artifact@v2 @@ -55,12 +50,12 @@ jobs: with: name: windows32-build path: ci-output/build - #- name: upload-test-results - # if: always() - # uses: actions/upload-artifact@v2 - # with: - # name: windows-test-results - # path: $CI_OUTPUT_PATH/test + - name: upload-test-report + if: failure() + uses: actions/upload-artifact@v2 + with: + name: test-logs-win32 + path: ${{ github.workspace }}\report.xml build-windows64: runs-on: windows-latest steps: @@ -75,12 +70,6 @@ jobs: - name: build-tests run: | MSBuild.exe ./build/odbc/cmake/global_make_list.sln -property:Configuration=Debug,Platform=x64 - - name: configure-aws-credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - name: import-registry run: | reg import .\src\Tests\Tests\AWSProfileRegistry.reg @@ -88,13 +77,13 @@ jobs: mkdir ${{ github.workspace }}\odbc-logs - name: run-tests run: | - .\build\odbc\bin\Debug\tests.exe --gtest_filter=-TestSQLConnectSAMLAuth.*:TestSQLDriverConnectSAMLAuth.* - - name: upload-test-logs - if: always() + .\build\odbc\bin\Debug\tests.exe --gtest_output="xml:report.xml" + - name: upload-test-report + if: failure() uses: actions/upload-artifact@v2 with: name: test-logs-win64 - path: ${{ github.workspace }}\odbc-logs\ + path: ${{ github.workspace }}\report.xml - name: prepare-output if: always() run: | @@ -105,9 +94,9 @@ jobs: with: name: windows64-build path: ci-output/build - #- name: upload-test-results - # if: always() - # uses: actions/upload-artifact@v2 - # with: - # name: windows-test-results - # path: ci-output/test-output + - name: upload-test-results + if: always() + uses: actions/upload-artifact@v2 + with: + name: windows-test-results + path: ci-output/test-output diff --git a/src/Tests/ITODBCHelper/it_odbc_helper.h b/src/Tests/ITODBCHelper/it_odbc_helper.h index f24852110..5db172ff7 100644 --- a/src/Tests/ITODBCHelper/it_odbc_helper.h +++ b/src/Tests/ITODBCHelper/it_odbc_helper.h @@ -117,6 +117,9 @@ test_string conn_string(); class Fixture : public testing::Test { public: void SetUp() override { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } m_env = SQL_NULL_HENV; m_conn = SQL_NULL_HDBC; m_hstmt = SQL_NULL_HSTMT; diff --git a/src/Tests/Tests/test_odbc_catalog.cpp b/src/Tests/Tests/test_odbc_catalog.cpp index 55af0955f..86f4be111 100644 --- a/src/Tests/Tests/test_odbc_catalog.cpp +++ b/src/Tests/Tests/test_odbc_catalog.cpp @@ -224,6 +224,9 @@ class TestSQLStatistics : public Fixture {}; */ TEST_F(TestSQLTables, TEST_ALL_NULL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -257,6 +260,9 @@ TEST_F(TestSQLTables, TEST_ALL_NULL) { } TEST_F(TestSQLTables, TEST_LONG_TABLE_NAME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("Lng%")), SQL_NTS, nullptr, @@ -288,6 +294,9 @@ TEST_F(TestSQLTables, TEST_LONG_TABLE_NAME) { } TEST_F(TestSQLTables, TEST_ALL_DATABASES_EXCEL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("%")), 1, AS_SQLTCHAR(CREATE_STRING("")), 0, AS_SQLTCHAR(CREATE_STRING("")), 0, @@ -320,6 +329,9 @@ TEST_F(TestSQLTables, TEST_ALL_DATABASES_EXCEL) { } TEST_F(TestSQLTables, TEST_ALL_DATABASES_NULL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("%")), SQL_NTS, nullptr, 0, nullptr, 0, nullptr, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -353,6 +365,9 @@ TEST_F(TestSQLTables, TEST_ALL_DATABASES_NULL) { } TEST_F(TestSQLTables, TEST_ALL_DATABASES_SEARCH_PATTERN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("%BC%")), SQL_NTS, AS_SQLTCHAR(CREATE_STRING("")), SQL_NTS, AS_SQLTCHAR(CREATE_STRING("")), SQL_NTS, AS_SQLTCHAR(CREATE_STRING("")), SQL_NTS); @@ -384,6 +399,9 @@ TEST_F(TestSQLTables, TEST_ALL_DATABASES_SEARCH_PATTERN) { } TEST_F(TestSQLTables, TEST_ALL_TABLES_VIEWS_TYPES_BIND_EXCEL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, AS_SQLTCHAR(CREATE_STRING("TABLE,VIEW")), 10); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -417,6 +435,9 @@ TEST_F(TestSQLTables, TEST_ALL_TABLES_VIEWS_TYPES_BIND_EXCEL) { } TEST_F(TestSQLTables, TEST_ALL_TABLES_VIEWS_TYPES_GETDATA) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, SQL_NTS, nullptr, SQL_NTS, nullptr, SQL_NTS, AS_SQLTCHAR(CREATE_STRING("TABLE,VIEW")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -449,6 +470,9 @@ TEST_F(TestSQLTables, TEST_ALL_TABLES_VIEWS_TYPES_GETDATA) { } TEST_F(TestSQLTables, TEST_ALL_VIEWS_TYPES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, AS_SQLTCHAR("VIEW"), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -475,6 +499,9 @@ TEST_F(TestSQLTables, TEST_ALL_VIEWS_TYPES) { } TEST_F(TestSQLTables, TEST_ALL_TABLE_TYPES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, AS_SQLTCHAR(CREATE_STRING("TABLE")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -508,6 +535,9 @@ TEST_F(TestSQLTables, TEST_ALL_TABLE_TYPES) { } TEST_F(TestSQLTables, TEST_SQL_ALL_TABLE_TYPES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, AS_SQLTCHAR(CREATE_STRING("%")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -541,6 +571,9 @@ TEST_F(TestSQLTables, TEST_SQL_ALL_TABLE_TYPES) { } TEST_F(TestSQLTables, TEST_SQL_ALL_TABLE_TYPES_OTHER_EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("")), 0, AS_SQLTCHAR(CREATE_STRING("")), 0, AS_SQLTCHAR(CREATE_STRING("")), 0, AS_SQLTCHAR(CREATE_STRING("%")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -570,6 +603,9 @@ TEST_F(TestSQLTables, TEST_SQL_ALL_TABLE_TYPES_OTHER_EMPTY) { } TEST_F(TestSQLTables, TEST_INVALID_TABLE_TYPES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, nullptr, 0, nullptr, 0, nullptr, 0, AS_SQLTCHAR(CREATE_STRING("INVALID")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -596,6 +632,9 @@ TEST_F(TestSQLTables, TEST_INVALID_TABLE_TYPES) { } TEST_F(TestSQLTables, TABLE_UNDER_DATABASE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTables(m_hstmt, AS_SQLTCHAR(CREATE_STRING("%BCTes_")), SQL_NTS, nullptr, 0, AS_SQLTCHAR(CREATE_STRING("I_T")), SQL_NTS, AS_SQLTCHAR(CREATE_STRING("TABLE")), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -625,6 +664,9 @@ TEST_F(TestSQLTables, TABLE_UNDER_DATABASE) { } TEST_F(TestSQLTables, EXACT_MATCH_META_DATA) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER)true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -657,6 +699,9 @@ TEST_F(TestSQLTables, EXACT_MATCH_META_DATA) { } TEST_F(TestSQLTables, EXACT_MATCH_META_DATA_CASE_INSENSITIVE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -690,6 +735,9 @@ TEST_F(TestSQLTables, EXACT_MATCH_META_DATA_CASE_INSENSITIVE) { } TEST_F(TestSQLTables, EXACT_MATCH_META_DATA_NOT_FOUND) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -721,6 +769,9 @@ TEST_F(TestSQLTables, EXACT_MATCH_META_DATA_NOT_FOUND) { } TEST_F(TestSQLTables, INVALID_USE_OF_NULLPTR_CATALOG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -731,6 +782,9 @@ TEST_F(TestSQLTables, INVALID_USE_OF_NULLPTR_CATALOG) { } TEST_F(TestSQLTables, INVALID_USE_OF_NULLPTR_SCHEMAS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -741,6 +795,9 @@ TEST_F(TestSQLTables, INVALID_USE_OF_NULLPTR_SCHEMAS) { } TEST_F(TestSQLTables, INVALID_USE_OF_NULLPTR_TABLE_NAME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -783,6 +840,9 @@ void PopulateSQLColumnsBinds(std::vector< bind_info > &binds) { */ TEST_F(TestSQLColumns, ISQL_WORKFLOW) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, nullptr, 0, nullptr, 0, (SQLTCHAR *)CREATE_STRING("DevOps"), SQL_NTS, nullptr, 0); @@ -862,6 +922,9 @@ TEST_F(TestSQLColumns, ISQL_WORKFLOW) { } TEST_F(TestSQLColumns, EXACT_MATCH_ONE_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, nullptr, 0, (SQLTCHAR*)CREATE_STRING("IoT"), SQL_NTS, (SQLTCHAR*)CREATE_STRING("time"), SQL_NTS); @@ -897,6 +960,9 @@ TEST_F(TestSQLColumns, EXACT_MATCH_ONE_COLUMN) { } TEST_F(TestSQLColumns, EXACT_MATCH_ALL_COLUMNS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, nullptr, 0, (SQLTCHAR*)CREATE_STRING("DevOps"), SQL_NTS, nullptr, 0); @@ -952,6 +1018,9 @@ TEST_F(TestSQLColumns, EXACT_MATCH_ALL_COLUMNS) { } TEST_F(TestSQLColumns, SEARCH_PATTERN_ALL_COLUMNS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, nullptr, 0, (SQLTCHAR*)CREATE_STRING("DevOps"), SQL_NTS, (SQLTCHAR*)CREATE_STRING("%"), SQL_NTS); @@ -1007,6 +1076,9 @@ TEST_F(TestSQLColumns, SEARCH_PATTERN_ALL_COLUMNS) { } TEST_F(TestSQLColumns, SEARCH_PATTERN_SOME_COLUMNS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, nullptr, 0, (SQLTCHAR*)CREATE_STRING("DevOps"), SQL_NTS, (SQLTCHAR*)CREATE_STRING("measure%"), @@ -1044,6 +1116,9 @@ TEST_F(TestSQLColumns, SEARCH_PATTERN_SOME_COLUMNS) { } TEST_F(TestSQLColumns, SEARCH_PATTERN_MULTI_TABLES_COLUMNS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, nullptr, 0, (SQLTCHAR*)CREATE_STRING("%"), SQL_NTS, (SQLTCHAR*)CREATE_STRING("tim_"), SQL_NTS); @@ -1083,6 +1158,9 @@ TEST_F(TestSQLColumns, SEARCH_PATTERN_MULTI_TABLES_COLUMNS) { } TEST_F(TestSQLColumns, META_DATA_CASE_INSENSITIVE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1121,6 +1199,9 @@ TEST_F(TestSQLColumns, META_DATA_CASE_INSENSITIVE) { } TEST_F(TestSQLColumns, META_DATA_CASE_INSENSITIVE_NOT_FOUND) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSetStmtAttr(m_hstmt, SQL_ATTR_METADATA_ID, (SQLPOINTER) true, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1152,6 +1233,9 @@ TEST_F(TestSQLColumns, META_DATA_CASE_INSENSITIVE_NOT_FOUND) { } TEST_F(TestSQLColumns, LONG_COLUMN_NAME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumns(m_hstmt, nullptr, 0, (SQLTCHAR *)CREATE_STRING(""), SQL_NTS, (SQLTCHAR *)CREATE_STRING("%"), SQL_NTS, @@ -1187,6 +1271,9 @@ TEST_F(TestSQLColumns, LONG_COLUMN_NAME) { } TEST_F(TestSQLColAttribute, SQL_DESC_CONCISE_TYPE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT INTEGER \'1\' from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1201,6 +1288,9 @@ TEST_F(TestSQLColAttribute, SQL_DESC_CONCISE_TYPE) { } TEST_F(TestCatalogSQLDescribeCol, INTEGER_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT INTEGER \'1\' from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); @@ -1224,6 +1314,9 @@ TEST_F(TestCatalogSQLDescribeCol, INTEGER_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, DOUBLE_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT DOUBLE \'1.0\' from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1247,6 +1340,9 @@ TEST_F(TestCatalogSQLDescribeCol, DOUBLE_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, BIGINT_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT BIGINT \'2147483648\' from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1270,6 +1366,9 @@ TEST_F(TestCatalogSQLDescribeCol, BIGINT_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, BOOLEAN_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT true from ODBCTest.IoT LIMIT 1"); @@ -1294,6 +1393,9 @@ TEST_F(TestCatalogSQLDescribeCol, BOOLEAN_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, VARCHAR_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT VARCHAR\'ABCDEFG\' from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1317,6 +1419,9 @@ TEST_F(TestCatalogSQLDescribeCol, VARCHAR_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, TIMESERIES_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 " @@ -1348,6 +1453,9 @@ TEST_F(TestCatalogSQLDescribeCol, TIMESERIES_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, ARRAY_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT ARRAY[ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]], " @@ -1374,6 +1482,9 @@ TEST_F(TestCatalogSQLDescribeCol, ARRAY_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, ROW_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT ROW(ROW(ROW(INTEGER '03', BIGINT '10', true), " @@ -1400,6 +1511,9 @@ TEST_F(TestCatalogSQLDescribeCol, ROW_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, NULL_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT null from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1423,6 +1537,9 @@ TEST_F(TestCatalogSQLDescribeCol, NULL_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, TIMESTAMP_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT TIMESTAMP \'2021-01-02 18:01:13.000000000\' from ODBCTest.IoT " @@ -1452,6 +1569,9 @@ TEST_F(TestCatalogSQLDescribeCol, TIMESTAMP_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, DATE_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT DATE \'2021-01-02\' from ODBCTest.IoT LIMIT 1"); @@ -1480,6 +1600,9 @@ TEST_F(TestCatalogSQLDescribeCol, DATE_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, TIME_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT TIME \'06:39:45.123456789\' from ODBCTest.IoT LIMIT 1"); @@ -1508,6 +1631,9 @@ TEST_F(TestCatalogSQLDescribeCol, TIME_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, INTERVAL_YEAR_TO_MONTH_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT 1year from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1531,6 +1657,9 @@ TEST_F(TestCatalogSQLDescribeCol, INTERVAL_YEAR_TO_MONTH_COLUMN) { } TEST_F(TestCatalogSQLDescribeCol, INTERVAL_DAY_TO_SECOND_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string query = CREATE_STRING("SELECT 1d from ODBCTest.IoT LIMIT 1"); ret = SQLPrepare(m_hstmt, (SQLTCHAR *)query.c_str(), SQL_NTS); @@ -1555,6 +1684,9 @@ TEST_F(TestCatalogSQLDescribeCol, INTERVAL_DAY_TO_SECOND_COLUMN) { TEST_F(TestSQLGetTypeInfo, TEST_SQL_ALL_TYPES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLGetTypeInfo(m_hstmt, SQL_ALL_TYPES); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1629,6 +1761,9 @@ TEST_F(TestSQLGetTypeInfo, TEST_SQL_ALL_TYPES) { } TEST_F(TestSQLGetTypeInfo, TEST_SQL_WVARCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLGetTypeInfo(m_hstmt, SQL_WVARCHAR); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1679,6 +1814,9 @@ TEST_F(TestSQLGetTypeInfo, TEST_SQL_WVARCHAR) { } TEST_F(TestSQLGetTypeInfo, TEST_SQL_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLGetTypeInfo(m_hstmt, SQL_BIT); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1710,6 +1848,9 @@ TEST_F(TestSQLGetTypeInfo, TEST_SQL_BIT) { } TEST_F(TestSQLGetTypeInfo, TEST_SQL_DECIMAL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLGetTypeInfo(m_hstmt, SQL_DECIMAL); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1738,6 +1879,9 @@ TEST_F(TestSQLGetTypeInfo, TEST_SQL_DECIMAL) { } TEST_F(TestSQLColumnPrivileges, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLColumnPrivileges(m_hstmt, (SQLTCHAR *)CREATE_STRING("ODBCTest"), SQL_NTS, (SQLTCHAR *)CREATE_STRING(""), SQL_NTS, @@ -1748,6 +1892,9 @@ TEST_F(TestSQLColumnPrivileges, EMPTY) { } TEST_F(TestSQLTablePrivileges, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLTablePrivileges(m_hstmt, (SQLTCHAR *)CREATE_STRING("ODBCTest"), SQL_NTS, (SQLTCHAR *)CREATE_STRING(""), SQL_NTS, @@ -1759,6 +1906,9 @@ TEST_F(TestSQLTablePrivileges, EMPTY) { // We expect an empty result set for PrimaryKeys and ForeignKeys // Tableau specified catalog, table and NULL args TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_CATALOG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLPrimaryKeys(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, NULL, 0, NULL, 0); @@ -1767,6 +1917,9 @@ TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_CATALOG) { } TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_TABLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLPrimaryKeys(m_hstmt, NULL, 0, NULL, 0, (SQLTCHAR*)CREATE_STRING("DevOps"), SQL_NTS); @@ -1775,6 +1928,9 @@ TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_TABLE) { } TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_NULL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLPrimaryKeys(m_hstmt, NULL, 0, NULL, 0, NULL, 0); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -1782,6 +1938,9 @@ TEST_F(TestSQLPrimaryKeys, EMPTY_RESULT_SET_WITH_NULL) { } TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_CATALOG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLForeignKeys(m_hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, NULL, 0); @@ -1790,6 +1949,9 @@ TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_CATALOG) { } TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_TABLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLForeignKeys(m_hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, (SQLTCHAR*)CREATE_STRING("DevOps"), SQL_NTS); @@ -1798,6 +1960,9 @@ TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_TABLE) { } TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_NULL) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLForeignKeys(m_hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0); @@ -1806,6 +1971,9 @@ TEST_F(TestSQLForeignKeys, EMPTY_RESULT_SET_WITH_NULL) { } TEST_F(TestSQLProcedureColumns, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLProcedureColumns(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, NULL, 0, (SQLTCHAR*)CREATE_STRING("%"), @@ -1815,6 +1983,9 @@ TEST_F(TestSQLProcedureColumns, EMPTY) { } TEST_F(TestSQLProcedures, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLProcedures(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, (SQLTCHAR*)CREATE_STRING("%"), SQL_NTS, @@ -1824,6 +1995,9 @@ TEST_F(TestSQLProcedures, EMPTY) { } TEST_F(TestSQLSpecialColumns, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLSpecialColumns(m_hstmt, SQL_BEST_ROWID, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, NULL, @@ -1834,6 +2008,9 @@ TEST_F(TestSQLSpecialColumns, EMPTY) { } TEST_F(TestSQLStatistics, EMPTY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; ret = SQLStatistics(m_hstmt, (SQLTCHAR*)CREATE_STRING("ODBCTest"), SQL_NTS, NULL, 0, (SQLTCHAR*)CREATE_STRING("%"), SQL_NTS, diff --git a/src/Tests/Tests/test_odbc_connection.cpp b/src/Tests/Tests/test_odbc_connection.cpp index e04f8a7e3..278f1296e 100644 --- a/src/Tests/Tests/test_odbc_connection.cpp +++ b/src/Tests/Tests/test_odbc_connection.cpp @@ -68,6 +68,9 @@ class TestSQLConnect : public testing::Test { }; TEST_F(TestSQLConnect, AWS_Profile_Default_credential_chain) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLConnect( m_conn, AS_SQLTCHAR(default_credential_chain.c_str()), SQL_NTS, AS_SQLTCHAR(empty.c_str()), static_cast< SQLSMALLINT >(empty.length()), @@ -77,6 +80,9 @@ TEST_F(TestSQLConnect, AWS_Profile_Default_credential_chain) { } TEST_F(TestSQLConnect, IAM_Success) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLConnect( m_conn, AS_SQLTCHAR(wdsn_name.c_str()), SQL_NTS, AS_SQLTCHAR(user.c_str()), static_cast< SQLSMALLINT >(user.length()), @@ -86,6 +92,9 @@ TEST_F(TestSQLConnect, IAM_Success) { } TEST_F(TestSQLConnect, IAM_empty_server_used_default) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLConnect( m_conn, AS_SQLTCHAR(empty.c_str()), SQL_NTS, AS_SQLTCHAR(user.c_str()), static_cast< SQLSMALLINT >(user.length()), AS_SQLTCHAR(pass.c_str()), @@ -115,10 +124,16 @@ TEST_F(TestSQLConnect, IAM_WrongPassword) { class TestSQLDriverConnect : public testing::Test { public: void SetUp() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } AllocConnection(&m_env, &m_conn, true, true); } void TearDown() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } if (SQL_NULL_HDBC != m_conn) { SQLFreeHandle(SQL_HANDLE_DBC, m_conn); } @@ -245,11 +260,17 @@ TEST_F(TestSQLDriverConnect, UnsupportedKeyword) { class TestSQLDisconnect : public testing::Test { public: void SetUp() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } m_env = SQL_NULL_HENV; m_conn = SQL_NULL_HDBC; } void TearDown() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } if (SQL_NULL_HDBC != m_conn) { SQLDisconnect(m_conn); SQLFreeHandle(SQL_HANDLE_DBC, m_conn); @@ -294,6 +315,10 @@ TEST_F(TestSQLDisconnect, TestDisconnectWithoutConnect) { class TestSQLDriverConnectMultiConnection : public Fixture { public: void SetUp() override { + if (std::getenv("NOT_CONNECTED")) \ + { \ + GTEST_SKIP(); \ + } Fixture::SetUp(); m_env2 = SQL_NULL_HENV; m_conn2 = SQL_NULL_HDBC; @@ -304,6 +329,10 @@ class TestSQLDriverConnectMultiConnection : public Fixture { } void TearDown() override { + if (std::getenv("NOT_CONNECTED")) \ + { \ + GTEST_SKIP(); \ + } Fixture::TearDown(); if (SQL_NULL_HSTMT != m_hstmt2) { ASSERT_NO_THROW(CloseCursor(&m_hstmt2, true, true)); diff --git a/src/Tests/Tests/test_odbc_descriptors.cpp b/src/Tests/Tests/test_odbc_descriptors.cpp index ae9ba45a4..6da371786 100644 --- a/src/Tests/Tests/test_odbc_descriptors.cpp +++ b/src/Tests/Tests/test_odbc_descriptors.cpp @@ -51,6 +51,9 @@ class TestSQLGetDescRec : public Fixture {}; class TestSQLCopyDesc : public Fixture {}; TEST_F(TestSQLCopyDesc, ARD_TO_ARD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -75,6 +78,9 @@ TEST_F(TestSQLCopyDesc, ARD_TO_ARD) { } TEST_F(TestSQLCopyDesc, ARD_TO_APD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -90,6 +96,9 @@ TEST_F(TestSQLCopyDesc, ARD_TO_APD) { } TEST_F(TestSQLCopyDesc, ARD_TO_IPD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -105,6 +114,9 @@ TEST_F(TestSQLCopyDesc, ARD_TO_IPD) { } TEST_F(TestSQLCopyDesc, ARD_TO_IRD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -120,6 +132,9 @@ TEST_F(TestSQLCopyDesc, ARD_TO_IRD) { } TEST_F(TestSQLCopyDesc, IRD_TO_IRD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -135,6 +150,9 @@ TEST_F(TestSQLCopyDesc, IRD_TO_IRD) { } TEST_F(TestSQLCopyDesc, IRD_TO_ARD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -150,6 +168,9 @@ TEST_F(TestSQLCopyDesc, IRD_TO_ARD) { } TEST_F(TestSQLCopyDesc, IRD_TO_APD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -165,6 +186,9 @@ TEST_F(TestSQLCopyDesc, IRD_TO_APD) { } TEST_F(TestSQLCopyDesc, IRD_TO_IPD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -180,6 +204,9 @@ TEST_F(TestSQLCopyDesc, IRD_TO_IPD) { } TEST_F(TestSQLCopyDesc, APD_TO_APD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -194,6 +221,9 @@ TEST_F(TestSQLCopyDesc, APD_TO_APD) { } TEST_F(TestSQLCopyDesc, APD_TO_ARD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -209,6 +239,9 @@ TEST_F(TestSQLCopyDesc, APD_TO_ARD) { } TEST_F(TestSQLCopyDesc, APD_TO_IPD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -224,6 +257,9 @@ TEST_F(TestSQLCopyDesc, APD_TO_IPD) { } TEST_F(TestSQLCopyDesc, APD_TO_IRD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -239,6 +275,9 @@ TEST_F(TestSQLCopyDesc, APD_TO_IRD) { } TEST_F(TestSQLCopyDesc, IPD_TO_IPD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -253,6 +292,9 @@ TEST_F(TestSQLCopyDesc, IPD_TO_IPD) { } TEST_F(TestSQLCopyDesc, IPD_TO_ARD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -268,6 +310,9 @@ TEST_F(TestSQLCopyDesc, IPD_TO_ARD) { } TEST_F(TestSQLCopyDesc, IPD_TO_ARP) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -283,6 +328,9 @@ TEST_F(TestSQLCopyDesc, IPD_TO_ARP) { } TEST_F(TestSQLCopyDesc, IPD_TO_IRD) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ExecuteQuery(multi_col, data_set, convert_to_test_string(multi_row_cnt), &m_hstmt); SQLHDESC ard = SQL_NULL_HDESC; ASSERT_TRUE(SQL_SUCCEEDED( @@ -300,6 +348,9 @@ TEST_F(TestSQLCopyDesc, IPD_TO_IRD) { class TestSQLSetDescField : public testing::Test { public: void SetUp() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } AllocStatement((SQLTCHAR*)(conn_string().c_str()), &m_env, &m_conn, &m_hstmt, true, true); SQLGetStmtAttr(m_hstmt, SQL_ATTR_APP_ROW_DESC, &m_ard_hdesc, 0, NULL); @@ -307,6 +358,9 @@ class TestSQLSetDescField : public testing::Test { } void TearDown() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } if (m_ard_hdesc != SQL_NULL_HDESC) { SQLFreeHandle(SQL_HANDLE_DESC, m_ard_hdesc); } @@ -560,6 +614,9 @@ TEST_SQL_SET_DESC_FIELD(TestUndefinedError_SQL_DESC_UPDATABLE, class TestSQLGetDescField : public testing::Test { public: void SetUp() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } AllocStatement((SQLTCHAR*)(conn_string().c_str()), &m_env, &m_conn, &m_hstmt, true, true); SQLGetStmtAttr(m_hstmt, SQL_ATTR_APP_ROW_DESC, &m_ard_hdesc, 0, NULL); @@ -569,6 +626,9 @@ class TestSQLGetDescField : public testing::Test { } void TearDown() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } if (m_ard_hdesc != SQL_NULL_HDESC) { SQLFreeHandle(SQL_HANDLE_DESC, m_ard_hdesc); } @@ -592,6 +652,9 @@ class TestSQLGetDescField : public testing::Test { // Descriptor Header Fields Tests TEST_F(TestSQLGetDescField, Test_SQL_DESC_ALLOC_TYPE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLSMALLINT m_value_ptr = 0; ASSERT_TRUE( SQL_SUCCEEDED(SQLGetDescField(m_ird_hdesc, 0, SQL_DESC_ALLOC_TYPE, diff --git a/src/Tests/Tests/test_odbc_execution.cpp b/src/Tests/Tests/test_odbc_execution.cpp index 727314c9f..acff3f4ed 100644 --- a/src/Tests/Tests/test_odbc_execution.cpp +++ b/src/Tests/Tests/test_odbc_execution.cpp @@ -92,6 +92,9 @@ class TestSQLBulkOperations : public Fixture {}; class TestSQLSetPos : public Fixture {}; TEST_F(TestSQLExecute, NO_SQLPREPARE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLExecute(m_hstmt); EXPECT_EQ(SQL_ERROR, ret); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, SQLSTATE_SEQUENCE_ERROR)); @@ -99,6 +102,9 @@ TEST_F(TestSQLExecute, NO_SQLPREPARE) { } TEST_F(TestSQLExecute, BASIC) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 12345 FROM ODBCTest.IoT LIMIT 5"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -122,6 +128,9 @@ TEST_F(TestSQLExecute, BASIC) { } TEST_F(TestSQLExecute, EXECUTE_TWICE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 12345 FROM ODBCTest.IoT LIMIT 5"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -150,6 +159,9 @@ TEST_F(TestSQLExecute, EXECUTE_TWICE) { } TEST_F(TestSQLExecute, EXECUTE_TWICE_WITH_CLOSECURSOR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 12345 FROM ODBCTest.IoT LIMIT 5"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -178,6 +190,9 @@ TEST_F(TestSQLExecute, EXECUTE_TWICE_WITH_CLOSECURSOR) { } TEST_F(TestSQLExecute, PREPARE_AND_EXECDIRECT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 12345 FROM ODBCTest.IoT LIMIT 5"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -200,6 +215,9 @@ TEST_F(TestSQLExecute, PREPARE_AND_EXECDIRECT) { } TEST_F(TestSQLExecute, UPDATE_PREPARE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 12345 FROM ODBCTest.IoT LIMIT 5"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -227,6 +245,9 @@ TEST_F(TestSQLExecute, UPDATE_PREPARE) { } TEST_F(TestSQLExecute, CLEAR_PREPARE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -240,6 +261,9 @@ TEST_F(TestSQLExecute, CLEAR_PREPARE) { } TEST_F(TestSQLPrepare, SUCCESS_NO_PARAM) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_EQ(SQL_SUCCESS, ret); @@ -247,6 +271,9 @@ TEST_F(TestSQLPrepare, SUCCESS_NO_PARAM) { } TEST_F(TestSQLPrepare, ERROR_WITH_PARAM) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT where time = ? LIMIT 1"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_EQ(SQL_ERROR, ret); @@ -254,6 +281,9 @@ TEST_F(TestSQLPrepare, ERROR_WITH_PARAM) { } TEST_F(TestSQLPrepare, PREPARE_METADATA) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1, 2, 3, 4 FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_EQ(SQL_SUCCESS, ret); @@ -265,6 +295,9 @@ TEST_F(TestSQLPrepare, PREPARE_METADATA) { } TEST_F(TestSQLPrepare, ERROR_NULL_QUERY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLPrepare(m_hstmt, NULL, SQL_NTS); EXPECT_EQ(SQL_ERROR, ret); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, @@ -273,6 +306,9 @@ TEST_F(TestSQLPrepare, ERROR_NULL_QUERY) { } TEST_F(TestSQLPrepare, SHOW_STATEMENT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SHOW DATABASES LIKE 'ODBC%'"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -294,6 +330,9 @@ TEST_F(TestSQLPrepare, SHOW_STATEMENT) { } TEST_F(TestSQLPrepare, SHOW_STATEMENT_LEADING_SPACES) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING(" SHOW DATABASES LIKE 'ODBC%'"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -315,6 +354,9 @@ TEST_F(TestSQLPrepare, SHOW_STATEMENT_LEADING_SPACES) { } TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("DESCRIBE ODBCTest.DevOps"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); @@ -334,6 +376,9 @@ TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT) { } TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT_SIZE_0) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("DESCRIBE ODBCTest.DevOps"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), 0); EXPECT_EQ(SQL_SUCCESS, ret); @@ -345,6 +390,9 @@ TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT_SIZE_0) { } TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT_GREATER_THAN_0) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("DESCRIBE ODBCTest.DevOps"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), 5); EXPECT_EQ(SQL_SUCCESS, ret); @@ -357,6 +405,9 @@ TEST_F(TestSQLPrepare, DESCRIBE_STATEMENT_GREATER_THAN_0) { TEST_F(TestSQLPrepare, WITH_SELECT_STATEMENT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") CREATE_STRING("14:18:30.123456789' AS binned_timestamp, ARRAY[1,2,3] ") @@ -374,6 +425,9 @@ TEST_F(TestSQLPrepare, WITH_SELECT_STATEMENT) { } TEST_F(TestSQLDescribeParam, DESCRIBE_PARAM) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT where time = ? LIMIT 1"); SQLRETURN ret = SQLPrepare(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_EQ(SQL_ERROR, ret); @@ -389,6 +443,9 @@ TEST_F(TestSQLDescribeParam, DESCRIBE_PARAM) { } TEST_F(TestSQLNumParams, NUM_PARAMS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLSMALLINT num = 0; SQLRETURN ret = SQLNumParams(nullptr, &num); EXPECT_EQ(SQL_ERROR, ret); @@ -399,15 +456,24 @@ TEST_F(TestSQLNumParams, NUM_PARAMS) { } TEST_F(TestSQLFetch, INVALID_HANDLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } EXPECT_EQ(SQL_INVALID_HANDLE, SQLFetch(nullptr)); } TEST_F(TestSQLFetch, INVALID_CURSOR_STATE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } EXPECT_EQ(SQL_ERROR, SQLFetch(m_hstmt)); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, SQLSTATE_INVALID_CURSUR_STATE)); } TEST_F(TestSQLFetch, SUCCESS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -415,6 +481,9 @@ TEST_F(TestSQLFetch, SUCCESS) { } TEST_F(TestSQLFetch, NO_MORE_DATA) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT 1 FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -423,6 +492,9 @@ TEST_F(TestSQLFetch, NO_MORE_DATA) { } TEST_F(TestSQLFetch, FRACTIONAL_TRUNCATION) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT VARCHAR \'1.5\' FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -435,6 +507,9 @@ TEST_F(TestSQLFetch, FRACTIONAL_TRUNCATION) { } TEST_F(TestSQLFetch, RIGHT_TRUNCATION) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT VARCHAR \'741370\' FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -448,6 +523,9 @@ TEST_F(TestSQLFetch, RIGHT_TRUNCATION) { } TEST_F(TestSQLFetch, OUT_OF_RANGE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT VARCHAR \'2\' FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -460,6 +538,9 @@ TEST_F(TestSQLFetch, OUT_OF_RANGE) { } TEST_F(TestSQLFetch, RESTRICTED_DATA_TYPE_VIOLATION) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT DATE \'2021-01-02\' FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -472,6 +553,9 @@ TEST_F(TestSQLFetch, RESTRICTED_DATA_TYPE_VIOLATION) { } TEST_F(TestSQLFetch, STRING_CONVERSION_ERROR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT VARCHAR \'1.a\' FROM ODBCTest.IoT LIMIT 1"); SQLRETURN ret = SQLExecDirect(m_hstmt, (SQLTCHAR*)query.c_str(), SQL_NTS); EXPECT_TRUE(SQL_SUCCEEDED(ret)); @@ -484,6 +568,9 @@ TEST_F(TestSQLFetch, STRING_CONVERSION_ERROR) { } TEST_F(TestSQLExecDirect, Success_100) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 100; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ") + to_test_string(std::to_string(limit)); @@ -500,6 +587,9 @@ TEST_F(TestSQLExecDirect, Success_100) { } TEST_F(TestSQLExecDirect, Success_400) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 400; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ")+ to_test_string(std::to_string(limit)); @@ -516,6 +606,9 @@ TEST_F(TestSQLExecDirect, Success_400) { } TEST_F(TestSQLExecDirect, Success_5000) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 5000; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ")+ to_test_string(std::to_string(limit)); @@ -532,6 +625,9 @@ TEST_F(TestSQLExecDirect, Success_5000) { } TEST_F(TestSQLExecDirect, Success_10000) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 10000; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ")+ to_test_string(std::to_string(limit)); @@ -548,12 +644,18 @@ TEST_F(TestSQLExecDirect, Success_10000) { } TEST_F(TestSQLExecDirect, NullQueryError) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLExecDirect(m_hstmt, NULL, SQL_NTS); EXPECT_EQ(SQL_ERROR, ret); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); } TEST_F(TestSQLSetCursorName, Success) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLSetCursorName(m_hstmt, AS_SQLTCHAR(m_cursor_name.c_str()), SQL_NTS); EXPECT_EQ(SQL_SUCCESS, ret); @@ -561,6 +663,9 @@ TEST_F(TestSQLSetCursorName, Success) { } TEST_F(TestSQLGetCursorName, Success) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLGetCursorName(m_hstmt, m_cursor_name_buf, IT_SIZEOF(m_cursor_name_buf), &m_cursor_name_length); @@ -571,6 +676,9 @@ TEST_F(TestSQLGetCursorName, Success) { } TEST_F(TestSQLGetCursorName, WrongLengthForCursorName) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLGetCursorName(m_hstmt, m_cursor_name_buf, m_wrong_buffer_length, &m_cursor_name_length); @@ -581,11 +689,17 @@ TEST_F(TestSQLGetCursorName, WrongLengthForCursorName) { } TEST_F(TestSQLCancel, NULLHandle) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret_exec = SQLCancel(NULL); EXPECT_EQ(ret_exec, SQL_INVALID_HANDLE); } TEST_F(TestSQLCancel, QueryInProgress) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 32925; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ")+ to_test_string(std::to_string(limit)); @@ -605,6 +719,9 @@ TEST_F(TestSQLCancel, QueryInProgress) { } TEST_F(TestSQLCancel, QueryInProgressMultithread) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT"); std::thread th1([&]() { @@ -629,11 +746,17 @@ TEST_F(TestSQLCancel, QueryInProgressMultithread) { } TEST_F(TestSQLCancel, QueryNotSent) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret_exec = SQLCancel(m_hstmt); EXPECT_EQ(ret_exec, SQL_SUCCESS); } TEST_F(TestSQLCancel, QueryFinished) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int limit = 10000; test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT ") + to_test_string(std::to_string(limit)); @@ -652,6 +775,9 @@ TEST_F(TestSQLCancel, QueryFinished) { } TEST_F(TestSQLEndTran, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLEndTran(SQL_HANDLE_DBC, m_conn, SQL_COMMIT); EXPECT_EQ(ret, SQL_ERROR); EXPECT_TRUE( @@ -660,6 +786,9 @@ TEST_F(TestSQLEndTran, NOT_SUPPORTED) { } TEST_F(TestSQLTransact, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLTransact(m_env, m_conn, SQL_COMMIT); EXPECT_EQ(ret, SQL_ERROR); EXPECT_TRUE( @@ -668,6 +797,9 @@ TEST_F(TestSQLTransact, NOT_SUPPORTED) { } TEST_F(TestSQLNativeSql, SUCCESS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string query = CREATE_STRING("SELECT * FROM ODBCTest.IoT LIMIT 1"); SQLTCHAR out_query[1024] = {0}; SQLINTEGER out_length = 0; @@ -677,6 +809,9 @@ TEST_F(TestSQLNativeSql, SUCCESS) { } TEST_F(TestSQLParamData, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLParamData(m_hstmt, NULL); EXPECT_EQ(ret, SQL_ERROR); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, @@ -685,6 +820,9 @@ TEST_F(TestSQLParamData, NOT_SUPPORTED) { } TEST_F(TestSQLPutData, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLCHAR data; SQLRETURN ret = SQLPutData(m_hstmt, &data, SQL_NULL_DATA); EXPECT_EQ(ret, SQL_ERROR); @@ -694,6 +832,9 @@ TEST_F(TestSQLPutData, NOT_SUPPORTED) { } TEST_F(TestSQLBindParameter, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLCHAR data[1024]; SQLLEN indicator; SQLRETURN ret = SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, @@ -705,6 +846,9 @@ TEST_F(TestSQLBindParameter, NOT_SUPPORTED) { } TEST_F(TestSQLBulkOperations, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLBulkOperations(m_hstmt, SQL_ADD); EXPECT_EQ(ret, SQL_ERROR); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, @@ -713,6 +857,9 @@ TEST_F(TestSQLBulkOperations, NOT_SUPPORTED) { } TEST_F(TestSQLSetPos, NOT_SUPPORTED) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLSetPos(m_hstmt, 0, SQL_POSITION, SQL_LOCK_NO_CHANGE); EXPECT_EQ(ret, SQL_ERROR); EXPECT_TRUE(CheckSQLSTATE(SQL_HANDLE_STMT, m_hstmt, diff --git a/src/Tests/Tests/test_odbc_info.cpp b/src/Tests/Tests/test_odbc_info.cpp index d68d1116a..9fed49a96 100644 --- a/src/Tests/Tests/test_odbc_info.cpp +++ b/src/Tests/Tests/test_odbc_info.cpp @@ -36,11 +36,17 @@ class TestSQLGetInfo : public testing::Test { } void SetUp() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } ITDriverConnect((SQLTCHAR*)(conn_string().c_str()), &m_env, &m_conn, true, true); } void TearDown() { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLDisconnect(m_conn); SQLFreeHandle(SQL_HANDLE_ENV, m_env); } @@ -95,6 +101,9 @@ int Ver1GEVer2(test_string ver_1_str, test_string ver_2_str) { // Test template for SQLGetInfo #define TEST_SQL_GET_INFO_STRING(test_name, info_type, expected_value) \ TEST_F(TestSQLGetInfo, test_name) { \ + if (std::getenv("NOT_CONNECTED")) { \ + GTEST_SKIP(); \ + } \ SQLTCHAR info_value_ptr[1024]; \ SQLSMALLINT string_length_ptr; \ SQLRETURN ret = \ diff --git a/src/Tests/Tests/test_odbc_results.cpp b/src/Tests/Tests/test_odbc_results.cpp index 02492fab2..00cf8ae2c 100644 --- a/src/Tests/Tests/test_odbc_results.cpp +++ b/src/Tests/Tests/test_odbc_results.cpp @@ -269,18 +269,27 @@ class TestSQLRowCount : public Fixture {}; class TestSQLBindCol : public Fixture {}; TEST_F(TestSQLBindCol, SingleColumnSingleBind) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(single_col_cnt); std::vector< std::vector< SQLLEN > > lens(single_col_cnt); QueryBind(single_row_cnt, 1, single_col, cols, lens, &m_hstmt); } TEST_F(TestSQLBindCol, MultiColumnsMultiBind) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(multi_col_cnt); std::vector< std::vector< SQLLEN > > lens(multi_col_cnt); QueryBind(single_row_cnt, 1, multi_col, cols, lens, &m_hstmt); } TEST_F(TestSQLBindCol, MultiColumnsMultiRows) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(multi_col_cnt); std::vector< std::vector< SQLLEN > > lens(multi_col_cnt); QueryBind(multi_row_cnt, multi_row_cnt, multi_col, cols, lens, &m_hstmt); @@ -289,6 +298,9 @@ TEST_F(TestSQLBindCol, MultiColumnsMultiRows) { // Looked at SQLBindCol - if < requested column are allocated, it will // reallocate additional space for that column TEST_F(TestSQLBindCol, InvalidColIndex0) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(single_col_cnt); std::vector< std::vector< SQLLEN > > lens(single_col_cnt); BindColSetup(single_row_cnt, 1, single_col, cols, lens, &m_hstmt); @@ -306,6 +318,9 @@ TEST_F(TestSQLBindCol, InvalidColIndex0) { } TEST_F(TestSQLBindCol, InvalidColIndex2) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(2); std::vector< std::vector< SQLLEN > > lens(2); BindColSetup(single_row_cnt, 1, single_col, cols, lens, &m_hstmt); @@ -323,6 +338,9 @@ TEST_F(TestSQLBindCol, InvalidColIndex2) { } TEST_F(TestSQLBindCol, InvalidBufferLength) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::vector< char > > cols(single_col_cnt); std::vector< std::vector< SQLLEN > > lens(single_col_cnt); BindColSetup(single_row_cnt, 1, single_col, cols, lens, &m_hstmt); @@ -336,6 +354,9 @@ TEST_F(TestSQLBindCol, InvalidBufferLength) { } TEST_F(TestSQLBindCol, InsufficientSpace) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLSetStmtAttr(m_hstmt, SQL_ROWSET_SIZE, (void*)1, 0); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); ASSERT_EQ(ret, SQL_SUCCESS); @@ -363,6 +384,9 @@ TEST_F(TestSQLBindCol, InsufficientSpace) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 0; int v2 = 1; int v3 = -1; // underflow @@ -387,6 +411,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_BIT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_STINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SCHAR_MIN; int v2 = SCHAR_MAX; int v3 = SCHAR_MIN - 1; // underflow @@ -411,6 +438,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_STINYINT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_TINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SCHAR_MIN; int v2 = SCHAR_MAX; int v3 = INT_MIN; // underflow @@ -435,6 +465,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_TINYINT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_UTINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = UCHAR_MAX; int v2 = -1; // underflow int v3 = UCHAR_MAX + 1; // overflow @@ -456,6 +489,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_UTINYINT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SLONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -472,6 +508,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SLONG) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_LONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -488,6 +527,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_LONG) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_ULONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 293719; int v2 = -1; // underflow test_string columns = CREATE_STRING("INTEGER\'") @@ -505,6 +547,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_ULONG) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SSHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SHRT_MIN; int v2 = SHRT_MAX; int v3 = SHRT_MIN - 1; // underflow @@ -530,6 +575,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SSHORT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SHRT_MIN; int v2 = SHRT_MAX; int v3 = INT_MIN; // underflow @@ -554,6 +602,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SHORT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_USHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = USHRT_MAX; int v2 = -1; // underflow int v3 = USHRT_MAX + 1; // overflow @@ -577,6 +628,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_USHORT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -593,6 +647,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_SBIGINT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_UBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 293719; int v2 = -1; // underflow test_string columns = CREATE_STRING("INTEGER\'") @@ -611,6 +668,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_UBIGINT) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -642,6 +702,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -682,6 +745,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_DOUBLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -698,6 +764,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_DOUBLE) { } TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_FLOAT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("INTEGER\'") @@ -714,6 +783,9 @@ TEST_F(TestSQLGetData, INTEGER_TO_SQL_C_FLOAT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = 0.0; double v2 = 1.0; double v3 = -1.0; // underflow @@ -738,6 +810,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_BIT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_STINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -3.9E-5; double v2 = 3.9E-5; double v3 = -1.29E2; // underflow @@ -767,6 +842,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_STINYINT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_TINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -1.279E2; double v2 = 1.269E2; double v3 = LLONG_MIN; // underflow @@ -796,6 +874,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_TINYINT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_UTINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = 1.1; double v2 = -3.0; // underflow double v3 = 2.56E2; // overflow @@ -821,6 +902,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_UTINYINT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SLONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; double v3 = (double)INT32_MIN; @@ -862,6 +946,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SLONG) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_LONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; double v3 = (double)INT32_MIN; @@ -903,6 +990,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_LONG) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_ULONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = 293719.0; double v2 = (double)UINT32_MAX; double v3 = -1; // underflow @@ -933,6 +1023,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_ULONG) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SSHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = SHRT_MIN; double v2 = SHRT_MAX; double v3 = -3.2769E4; // underflow @@ -961,6 +1054,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SSHORT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = SHRT_MIN; double v2 = SHRT_MAX; double v3 = -DBL_MAX; // underflow @@ -988,6 +1084,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SHORT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_USHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = 0; double v2 = -1.0; // underflow double v3 = 6.5536E4; // overflow @@ -1011,6 +1110,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_USHORT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; double v3 = -DBL_MAX; // underflow @@ -1038,6 +1140,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_SBIGINT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_UBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = 2.93719E5; double v2 = -1.0; // underflow double v3 = DBL_MAX; // overflow @@ -1063,6 +1168,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_UBIGINT) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; test_string columns = CREATE_STRING("DOUBLE\'") + convert_to_test_string(v1) @@ -1087,6 +1195,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; test_string columns = CREATE_STRING("DOUBLE\'") + convert_to_test_string(v1) @@ -1125,6 +1236,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_DOUBLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; test_string columns = CREATE_STRING("DOUBLE\'") + convert_to_test_string(v1) @@ -1140,6 +1254,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_DOUBLE) { } TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_FLOAT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; double v3 = -DBL_MAX; // underflow @@ -1164,6 +1281,9 @@ TEST_F(TestSQLGetData, DOUBLE_TO_SQL_C_FLOAT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = 0; long long v2 = 1; long long v3 = -2147483649ll; // underflow @@ -1188,6 +1308,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_BIT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_STINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = SCHAR_MIN; long long v2 = SCHAR_MAX; long long v3 = SCHAR_MIN - 1; // underflow @@ -1212,6 +1335,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_STINYINT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_TINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = SCHAR_MIN; long long v2 = SCHAR_MAX; long long v3 = INT_MIN; // underflow @@ -1236,6 +1362,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_TINYINT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_UTINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = UCHAR_MAX; long long v2 = -1; // underflow long long v3 = UCHAR_MAX + 1; // overflow @@ -1258,6 +1387,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_UTINYINT) { // SQLINTEGER(long) is 8 bytes in Linux 64 bit and Mac TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SLONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -293719; long long v2 = 741370; long long v3 = (long long)INT32_MIN; @@ -1296,6 +1428,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SLONG) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_LONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -293719; long long v2 = 741370; long long v3 = (long long)INT32_MIN; @@ -1334,6 +1469,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_LONG) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_ULONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = 293719; long long v2 = UINT32_MAX; long long v3 = -1; // underflow @@ -1358,6 +1496,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_ULONG) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SSHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = SHRT_MIN; long long v2 = SHRT_MAX; long long v3 = SHRT_MIN - 1; // underflow @@ -1383,6 +1524,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SSHORT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = SHRT_MIN; long long v2 = SHRT_MAX; long long v3 = INT_MIN; // underflow @@ -1407,6 +1551,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SHORT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_USHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = USHRT_MAX; long long v2 = -1; // underflow long long v3 = USHRT_MAX + 1; // overflow @@ -1430,6 +1577,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_USHORT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -2147483649ll; long long v2 = 2147483649ll; test_string columns = CREATE_STRING("BIGINT\'") + convert_to_test_string(v1) @@ -1445,6 +1595,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_SBIGINT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_UBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = 2147483649ll; long long v2 = -1ll; // underflow test_string columns = CREATE_STRING("BIGINT\'") + convert_to_test_string(v1) @@ -1462,6 +1615,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_UBIGINT) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = 2147483649ll; long long v2 = 2147483649ll; v2 *= -1; @@ -1485,6 +1641,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -2147483649ll; long long v2 = 2147483649ll; test_string columns = CREATE_STRING("BIGINT\'") + convert_to_test_string(v1) @@ -1524,6 +1683,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_DOUBLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -2147483649ll; long long v2 = 2147483649ll; test_string columns = CREATE_STRING("BIGINT\'") + convert_to_test_string(v1) @@ -1539,6 +1701,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_DOUBLE) { } TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_FLOAT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } long long v1 = -2147483649ll; long long v2 = 2147483649ll; test_string columns = CREATE_STRING("BIGINT\'") + convert_to_test_string(v1) @@ -1554,6 +1719,9 @@ TEST_F(TestSQLGetData, BIGINT_TO_SQL_C_FLOAT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< bool, SQLTCHAR* > > expected; expected.push_back(std::make_pair(true, nullptr)); expected.push_back(std::make_pair(false, nullptr)); @@ -1563,6 +1731,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_BIT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_STINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLSCHAR, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLSCHAR >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLSCHAR >(0), nullptr)); @@ -1573,6 +1744,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_STINYINT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_TINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLSCHAR, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLSCHAR >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLSCHAR >(0), nullptr)); @@ -1583,6 +1757,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_TINYINT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_UTINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLCHAR, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLCHAR >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLCHAR >(0), nullptr)); @@ -1593,6 +1770,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_UTINYINT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SLONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLINTEGER, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLINTEGER >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLINTEGER >(0), nullptr)); @@ -1603,6 +1783,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SLONG) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_LONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLINTEGER, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLINTEGER >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLINTEGER >(0), nullptr)); @@ -1613,6 +1796,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_LONG) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_ULONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLUINTEGER, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLUINTEGER >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLUINTEGER >(0), nullptr)); @@ -1623,6 +1809,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_ULONG) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SSHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLSMALLINT, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLSMALLINT >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLSMALLINT >(0), nullptr)); @@ -1633,6 +1822,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SSHORT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLSMALLINT, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLSMALLINT >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLSMALLINT >(0), nullptr)); @@ -1643,6 +1835,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SHORT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_USHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLUSMALLINT, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLUSMALLINT >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLUSMALLINT >(0), nullptr)); @@ -1653,6 +1848,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_USHORT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLBIGINT, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLBIGINT >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLBIGINT >(0), nullptr)); @@ -1663,6 +1861,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_SBIGINT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_UBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLUBIGINT, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLUBIGINT >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLUBIGINT >(0), nullptr)); @@ -1673,6 +1874,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_UBIGINT) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } QueryFetch(bool_columns, table_name, single_row, &m_hstmt); SQLCHAR data[1024] = {0}; SQLLEN indicator = 0; @@ -1689,6 +1893,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } QueryFetch(bool_columns, table_name, single_row, &m_hstmt); SQLWCHAR data[1024] = {0}; SQLWCHAR data2[1024] = {0}; @@ -1722,6 +1929,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_DOUBLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLDOUBLE, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLDOUBLE >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLDOUBLE >(0), nullptr)); @@ -1732,6 +1942,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_DOUBLE) { } TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_FLOAT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } std::vector< std::pair< SQLREAL, SQLTCHAR* > > expected; expected.push_back(std::make_pair(static_cast< SQLREAL >(1), nullptr)); expected.push_back(std::make_pair(static_cast< SQLREAL >(0), nullptr)); @@ -1742,6 +1955,9 @@ TEST_F(TestSQLGetData, BOOLEAN_TO_SQL_C_FLOAT) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ARRAY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1766,6 +1982,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ARRAY) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ARRAY) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1790,6 +2009,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ARRAY) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ROW) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1813,6 +2035,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ROW) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ROW) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1837,6 +2062,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ROW) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ARRAY_ROW_COMBINATION) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1861,6 +2089,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_CHAR_ARRAY_ROW_COMBINATION) { } TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ARRAY_ROW_COMBINATION) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -1885,6 +2116,9 @@ TEST_F(TestSQLGetData, TIMESERIES_TO_SQL_C_WCHAR_ARRAY_ROW_COMBINATION) { } TEST_F(TestSQLGetData, ARRAY_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("ARRAY[ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]], ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]]], ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[1, 2, 3]]]]]]]]]]]], ARRAY[]"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLCHAR data[1024] = {0}; @@ -1908,6 +2142,9 @@ TEST_F(TestSQLGetData, ARRAY_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, ARRAY_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("ARRAY[ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]], ") CREATE_STRING("ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]]], ") @@ -1934,6 +2171,9 @@ TEST_F(TestSQLGetData, ARRAY_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, ROW_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("ROW(ROW(ROW(INTEGER '03', BIGINT '10', true), ") CREATE_STRING("ARRAY[ARRAY[1,2],ARRAY[1.1,2.2]])), ROW(true)"); @@ -1957,6 +2197,9 @@ TEST_F(TestSQLGetData, ROW_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, ROW_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("ROW(ROW(ROW(INTEGER '03', BIGINT '10', true), ") CREATE_STRING("ARRAY[ARRAY[1,2],ARRAY[1.1,2.2]])), ROW(true)"); @@ -1977,6 +2220,9 @@ TEST_F(TestSQLGetData, ROW_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, NULL_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("null, NULL"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -1998,6 +2244,9 @@ TEST_F(TestSQLGetData, NULL_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, NULL_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("null, NULL"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLWCHAR data[1024] = {0}; @@ -2016,6 +2265,9 @@ TEST_F(TestSQLGetData, NULL_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, ARRAY_ROW_NULL_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("Array[Row(null), Row(NULL)], Row(Array[null], Array[NULL])"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLCHAR data[1024] = {0}; @@ -2036,6 +2288,9 @@ TEST_F(TestSQLGetData, ARRAY_ROW_NULL_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, ARRAY_ROW_NULL_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("Array[Row(null), Row(NULL)], Row(Array[null], Array[NULL])"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -2054,6 +2309,9 @@ TEST_F(TestSQLGetData, ARRAY_ROW_NULL_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("TIMESTAMP \'2021-11-20 18:01:13.123456789\',") @@ -2092,6 +2350,9 @@ TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("TIMESTAMP \'2021-11-20 18:01:13.123456789\',") @@ -2131,6 +2392,9 @@ TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_TIMESTAMP) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("TIMESTAMP \'2021-11-20 06:39:45.123456789\',") @@ -2157,6 +2421,9 @@ TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_TIMESTAMP) { } TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_DATE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("TIMESTAMP \'2021-11-20 06:39:45.123456789\',") @@ -2182,6 +2449,9 @@ TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_DATE) { } TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_TIME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("TIMESTAMP \'2021-11-20 06:39:45.123456789\',") @@ -2204,6 +2474,9 @@ TEST_F(TestSQLGetData, TIMESTAMP_TO_SQL_C_TYPE_TIME) { } TEST_F(TestSQLGetData, DATE_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("DATE \'2021-01-02\', DATE \'2021-11-20\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLCHAR data[1024] = {0}; @@ -2221,6 +2494,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, DATE_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("DATE \'2021-01-02\', DATE \'2021-11-20\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLTCHAR data[1024] = {0}; @@ -2238,6 +2514,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_TIMESTAMP) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("DATE \'2021-01-02\', DATE \'2021-11-20\'"); std::vector< std::pair< TIMESTAMP_STRUCT, SQLTCHAR* > > expected; @@ -2250,6 +2529,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_TIMESTAMP) { } TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_DATE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("DATE \'2021-01-02\', DATE \'2021-11-20\'"); std::vector< std::pair< DATE_STRUCT, SQLTCHAR* > > expected; @@ -2260,6 +2542,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_DATE) { } TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_TIME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("DATE \'2021-01-02\', DATE \'2021-11-20\'"); std::vector< std::pair< TIME_STRUCT, SQLTCHAR* > > expected; @@ -2272,6 +2557,9 @@ TEST_F(TestSQLGetData, DATE_TO_SQL_C_TYPE_TIME) { } TEST_F(TestSQLGetData, TIME_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIME \'18:01:13.000000000\',") CREATE_STRING("TIME \'06:39:45.123456789\',") @@ -2306,6 +2594,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, TIME_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIME \'18:01:13.000000000\',") CREATE_STRING("TIME \'06:39:45.123456789\',") @@ -2340,6 +2631,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_TIMESTAMP) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIME \'18:01:13.000000000\',") CREATE_STRING("TIME \'06:39:45.123456789\',") @@ -2371,6 +2665,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_TIMESTAMP) { } TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_DATE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIME \'18:01:13.524000000\', TIME \'06:39:45.123456789\'"); @@ -2384,6 +2681,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_DATE) { } TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_TIME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("TIME \'18:01:13.000000000\',") CREATE_STRING("TIME \'06:39:45.123456789\',") @@ -2402,6 +2702,9 @@ TEST_F(TestSQLGetData, TIME_TO_SQL_C_TYPE_TIME) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_BIT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 0; int v2 = 1; double v3 = 1.5; // truncation @@ -2440,6 +2743,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_BIT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_STINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SCHAR_MIN; int v2 = SCHAR_MAX; double v3 = 1.5; // truncation @@ -2476,6 +2782,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_STINYINT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SCHAR_MIN; int v2 = SCHAR_MAX; double v3 = 1.5; // truncation @@ -2512,6 +2821,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TINYINT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_UTINYINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = UCHAR_MAX; double v2 = 1.5; // truncation int v3 = -1; // underflow @@ -2545,6 +2857,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_UTINYINT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SLONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; double v3 = (double)INT32_MAX; @@ -2600,6 +2915,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SLONG) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_LONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; double v3 = 1.5; // truncation @@ -2652,6 +2970,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_LONG) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_ULONG) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 293719; double v2 = 1.5; // truncation int v3 = -1; // underflow @@ -2692,6 +3013,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_ULONG) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SSHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SHRT_MIN; int v2 = SHRT_MAX; double v3 = 1.5; // truncation @@ -2729,6 +3053,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SSHORT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = SHRT_MIN; int v2 = SHRT_MAX; double v3 = 1.5; // truncation @@ -2765,6 +3092,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SHORT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_USHORT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = USHRT_MAX; double v2 = 1.5; // truncation int v3 = -1; // underflow @@ -2800,6 +3130,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_USHORT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; double v3 = 1.5; // truncation @@ -2836,6 +3169,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_SBIGINT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_UBIGINT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = 293719; double v2 = 1.5; // truncation double v3 = -1.0; // underflow @@ -2870,6 +3206,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_UBIGINT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_DOUBLE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; test_string columns = @@ -2910,6 +3249,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_DOUBLE) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_FLOAT) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } double v1 = -2.93719E5; double v2 = 7.41370E5; double v3 = -DBL_MAX; // underflow @@ -2941,6 +3283,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_FLOAT) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("VARCHAR\'") + convert_to_test_string(v1) + CREATE_STRING("\', VARCHAR\'") @@ -2970,6 +3315,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } int v1 = -293719; int v2 = 741370; test_string columns = CREATE_STRING("VARCHAR\'") + convert_to_test_string(v1) + CREATE_STRING("\', VARCHAR\'") @@ -3006,6 +3354,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIMESTAMP) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("VARCHAR \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("VARCHAR \'2021-11-20 06:39:45.123456789\',") @@ -3065,6 +3416,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIMESTAMP) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_DATE) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("VARCHAR \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("VARCHAR \'2021-11-20 06:39:45.123456789\',") @@ -3114,6 +3468,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_DATE) { } TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIME) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("VARCHAR \'2021-01-02 18:01:13.000000000\',") CREATE_STRING("VARCHAR \'2021-11-20 06:39:45.123456789\',") @@ -3158,6 +3515,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_SQL_C_TYPE_TIME) { } TEST_F(TestSQLGetData, VARCHAR_TO_INTERVAL_YEAR_TO_MONTH) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("VARCHAR \'1-0',") CREATE_STRING("VARCHAR \'0-1\',") @@ -3201,6 +3561,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_INTERVAL_YEAR_TO_MONTH) { } TEST_F(TestSQLGetData, VARCHAR_TO_INTERVAL_DAY_TO_SECOND) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("VARCHAR \'1 00:00:00.000000000\',") CREATE_STRING("VARCHAR \'0 01:00:00.000000000\',") @@ -3254,6 +3617,9 @@ TEST_F(TestSQLGetData, VARCHAR_TO_INTERVAL_DAY_TO_SECOND) { } TEST_F(TestSQLGetData, INTERVAL_YEAR_TO_MONTH_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("1year,") CREATE_STRING("1month,") @@ -3305,6 +3671,9 @@ TEST_F(TestSQLGetData, INTERVAL_YEAR_TO_MONTH_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, INTERVAL_YEAR_TO_MONTH_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("1year,") CREATE_STRING("1month,") @@ -3349,6 +3718,9 @@ TEST_F(TestSQLGetData, INTERVAL_YEAR_TO_MONTH_TO_SQL_C_WCHAR) { } TEST_F(TestSQLGetData, INTERVAL_DAY_TO_SECOND_TO_SQL_C_CHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("1d,1h,1m,1s,1ms,1us,1ns"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLCHAR data[1024] = {0}; @@ -3400,6 +3772,9 @@ TEST_F(TestSQLGetData, INTERVAL_DAY_TO_SECOND_TO_SQL_C_CHAR) { } TEST_F(TestSQLGetData, INTERVAL_DAY_TO_SECOND_TO_SQL_C_WCHAR) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("1d,1h,1m,1s,1ms,1us,1ns"); QueryFetch(columns, table_name, single_row, &m_hstmt); SQLTCHAR data[1024] = {0}; @@ -3443,6 +3818,9 @@ TEST_F(TestSQLGetData, INTERVAL_DAY_TO_SECOND_TO_SQL_C_WCHAR) { } TEST_F(TestSQLNumResultCols, SingleColumn) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("Array[Row(null), Row(NULL)]"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3452,6 +3830,9 @@ TEST_F(TestSQLNumResultCols, SingleColumn) { } TEST_F(TestSQLNumResultCols, MultiColumn) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("Array[Row(null), Row(NULL)], Row(Array[null], Array[NULL]), ") CREATE_STRING("Array[Row(null), Row(NULL)], Row(Array[null], Array[NULL]), ") @@ -3467,6 +3848,9 @@ TEST_F(TestSQLNumResultCols, MultiColumn) { } TEST_F(TestSQLDescribeCol, INTEGER_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("INTEGER \'1\'"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3489,6 +3873,9 @@ TEST_F(TestSQLDescribeCol, INTEGER_COLUMN) { } TEST_F(TestSQLDescribeCol, DOUBLE_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("DOUBLE \'1.0\'"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3511,6 +3898,9 @@ TEST_F(TestSQLDescribeCol, DOUBLE_COLUMN) { } TEST_F(TestSQLDescribeCol, BIGINT_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("BIGINT \'2147483648\'"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3533,6 +3923,9 @@ TEST_F(TestSQLDescribeCol, BIGINT_COLUMN) { } TEST_F(TestSQLDescribeCol, BOOLEAN_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("true"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3555,6 +3948,9 @@ TEST_F(TestSQLDescribeCol, BOOLEAN_COLUMN) { } TEST_F(TestSQLDescribeCol, VARCHAR_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("VARCHAR\'ABCDEFG\'"); ExecuteQuery(columns, table_name, single_row, &m_hstmt); @@ -3577,6 +3973,9 @@ TEST_F(TestSQLDescribeCol, VARCHAR_COLUMN) { } TEST_F(TestSQLDescribeCol, TIMESERIES_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string statement = CREATE_STRING("WITH binned_timeseries AS(SELECT TIMESTAMP'2021-03-05 ") @@ -3610,6 +4009,9 @@ TEST_F(TestSQLDescribeCol, TIMESERIES_COLUMN) { } TEST_F(TestSQLDescribeCol, ARRAY_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("ARRAY[ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]], ARRAY[ARRAY[ARRAY[1.1, 2.3], ARRAY[1.1, 2.3]]]]"); @@ -3633,6 +4035,9 @@ TEST_F(TestSQLDescribeCol, ARRAY_COLUMN) { } TEST_F(TestSQLDescribeCol, ROW_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("ROW(ROW(ROW(INTEGER '03', BIGINT '10', true), ARRAY[ARRAY[1,2],ARRAY[1.1,2.2]]))"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3655,6 +4060,9 @@ TEST_F(TestSQLDescribeCol, ROW_COLUMN) { } TEST_F(TestSQLDescribeCol, NULL_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("null"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3677,6 +4085,9 @@ TEST_F(TestSQLDescribeCol, NULL_COLUMN) { } TEST_F(TestSQLDescribeCol, TIMESTAMP_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("TIMESTAMP \'2021-01-02 18:01:13.000000000\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3700,6 +4111,9 @@ TEST_F(TestSQLDescribeCol, TIMESTAMP_COLUMN) { } TEST_F(TestSQLDescribeCol, DATE_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("DATE \'2021-01-02\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3723,6 +4137,9 @@ TEST_F(TestSQLDescribeCol, DATE_COLUMN) { } TEST_F(TestSQLDescribeCol, TIME_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("TIME \'06:39:45.123456789\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3746,6 +4163,9 @@ TEST_F(TestSQLDescribeCol, TIME_COLUMN) { } TEST_F(TestSQLDescribeCol, INTERVAL_YEAR_TO_MONTH_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("1year"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3768,6 +4188,9 @@ TEST_F(TestSQLDescribeCol, INTERVAL_YEAR_TO_MONTH_COLUMN) { } TEST_F(TestSQLDescribeCol, INTERVAL_DAY_TO_SECOND_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("1d"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3790,6 +4213,9 @@ TEST_F(TestSQLDescribeCol, INTERVAL_DAY_TO_SECOND_COLUMN) { } TEST_F(TestSQLDescribeCol, OUT_OF_INDEX_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("INTEGER\'1\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3807,6 +4233,9 @@ TEST_F(TestSQLDescribeCol, OUT_OF_INDEX_COLUMN) { } TEST_F(TestSQLDescribeCol, TRUNCATED_COLUMN_NAME_COLUMN) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("INTEGER\'1\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3829,6 +4258,9 @@ TEST_F(TestSQLDescribeCol, TRUNCATED_COLUMN_NAME_COLUMN) { } TEST_F(TestSQLDescribeCol, INVALID_STRING_OR_BUFFER_LENGTH) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("INTEGER\'1\'"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3847,6 +4279,9 @@ TEST_F(TestSQLDescribeCol, INVALID_STRING_OR_BUFFER_LENGTH) { } TEST_F(TestSQLDescribeCol, MULTIPLE_COLUMNS) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQL_ERROR; test_string columns = CREATE_STRING("INTEGER\'1\', DOUBLE \'1.0\', BIGINT \'2147483648\', true"); QueryFetch(columns, table_name, single_row, &m_hstmt); @@ -3896,12 +4331,18 @@ TEST_F(TestSQLDescribeCol, MULTIPLE_COLUMNS) { } TEST_F(TestSQLMoreResults, NoData_noquery) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLRETURN ret = SQLMoreResults(m_hstmt); EXPECT_EQ(SQL_NO_DATA, ret); LogAnyDiagnostics(SQL_HANDLE_STMT, m_hstmt, ret); } TEST_F(TestSQLMoreResults, NoData_query) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } test_string columns = CREATE_STRING("Array[Row(null), Row(NULL)]"); ExecuteQuery(columns, table_name, CREATE_STRING("100"), &m_hstmt); SQLRETURN ret = SQLMoreResults(m_hstmt); @@ -3912,6 +4353,9 @@ TEST_F(TestSQLMoreResults, NoData_query) { // Row count is not supported for the driver, so this should return -1, // as defined in the ODBC API. TEST_F(TestSQLRowCount, RowCountNotAvailable) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLLEN row_count = 0; SQLRETURN ret = SQLRowCount(m_hstmt, &row_count); EXPECT_EQ(SQL_SUCCESS, ret); @@ -3919,6 +4363,9 @@ TEST_F(TestSQLRowCount, RowCountNotAvailable) { } TEST_F(TestSQLRowCount, InvalidHandle) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } SQLLEN row_count = 0; SQLRETURN ret = SQLRowCount(nullptr, &row_count); EXPECT_EQ(SQL_INVALID_HANDLE, ret); diff --git a/src/Tests/Tests/test_odbc_tableau_queries.cpp b/src/Tests/Tests/test_odbc_tableau_queries.cpp index e46c45c77..478d0322a 100644 --- a/src/Tests/Tests/test_odbc_tableau_queries.cpp +++ b/src/Tests/Tests/test_odbc_tableau_queries.cpp @@ -41,6 +41,10 @@ inline void GetAllLinesInFile(const std::string file_name, } TEST(TableauQuery, IssueQueriesAll) { + if (std::getenv("NOT_CONNECTED")) { + GTEST_SKIP(); + } + // Get lines from file std::vector< std::string > lines; GetAllLinesInFile(all_queries_file, lines); diff --git a/src/timestreamsqlodbc/odbc_communication.cpp b/src/timestreamsqlodbc/odbc_communication.cpp index 458380423..262a88c36 100644 --- a/src/timestreamsqlodbc/odbc_communication.cpp +++ b/src/timestreamsqlodbc/odbc_communication.cpp @@ -99,6 +99,13 @@ bool TSCommunication::Validate(const runtime_options& options) { if (options.auth.auth_type != AUTHTYPE_DEFAULT) { throw std::invalid_argument("Unknown authentication type: \"" + options.auth.auth_type + "\"."); } + if (options.auth.uid.empty()) { + throw std::invalid_argument("UID cannot be empty."); + } + + if (options.auth.pwd.empty()) { + throw std::invalid_argument("Password cannot be empty."); + } LogMsg(LOG_DEBUG, "Required connection options are valid."); return true;