Skip to content

GH-49783: [C++][FlightRPC][ODBC] Reuse connections across test suite#49784

Open
justing-bq wants to merge 4 commits intoapache:mainfrom
Bit-Quill:gh-49783-reuse-test-connections
Open

GH-49783: [C++][FlightRPC][ODBC] Reuse connections across test suite#49784
justing-bq wants to merge 4 commits intoapache:mainfrom
Bit-Quill:gh-49783-reuse-test-connections

Conversation

@justing-bq
Copy link
Copy Markdown
Contributor

@justing-bq justing-bq commented Apr 17, 2026

Rationale for this change

We avoid crashing tests on Linux if we minimize the number of connect/disconnect attempts. So now we are reusing the same connection as much as possible throughout the tests.

What changes are included in this PR?

All our necessary connections happen during global SetUp() and then they get disconnected during global TearDown().
Test Fixture SetUp logic is now about updating pointers to the correct environment, connection, and statement handles for those tests.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@justing-bq justing-bq requested a review from lidavidm as a code owner April 17, 2026 19:57
@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #49783 has been automatically assigned in GitHub to PR creator.

@justing-bq
Copy link
Copy Markdown
Contributor Author

@lidavidm @kou
Please take a look when you have a chance.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Flight SQL ODBC C++ test suite to reuse ODBC environment/connection handles across the entire test run (global SetUp/TearDown), reducing connect/disconnect churn that can crash tests on Linux.

Changes:

  • Introduces shared handle pools (remote/mock, ODBC v2/v3, plus “non-connection” handles) and rewires fixtures to point env/conn/stmt at the appropriate shared handles.
  • Moves remote/mock connection establishment into a global ::testing::Environment and updates helper APIs (Connect, Disconnect, etc.) to accept explicit handle references.
  • Adjusts a few tests to use the new connection helper signature and adds a Windows-only CMake source tweak.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h Adds shared handle structs/pools and updates test base APIs to take explicit handles.
cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc Implements a global test environment that connects once and reuses handles across suites/tests.
cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc Updates handle-based tests to call ConnectWithString(..., conn).
cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc Allocates a local env/conn for a DM-only attribute test and uses new helpers.
cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt Adds a Windows-only extra source intended to address a Windows crash.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt Outdated
Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h Outdated
Copy link
Copy Markdown
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue for tracking down the cause of the crash?

Comment thread cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt Outdated
Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
@alinaliBQ
Copy link
Copy Markdown
Collaborator

Is there an issue for tracking down the cause of the crash?

We have an issue here: #48270

Copy link
Copy Markdown
Collaborator

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@alinaliBQ alinaliBQ self-requested a review April 20, 2026 20:47
@alinaliBQ
Copy link
Copy Markdown
Collaborator

Could we resolve the merge conflict?

@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch from f497c6b to eb7732b Compare April 20, 2026 23:49
@github-actions github-actions Bot added Component: Documentation awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Apr 20, 2026
@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch from eb7732b to 12386aa Compare April 20, 2026 23:50
@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch from 12386aa to f43b2ce Compare April 21, 2026 20:43
@justing-bq
Copy link
Copy Markdown
Contributor Author

@lidavidm @kou
Please take a look when you have time.

@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch from f43b2ce to e13e14c Compare April 27, 2026 21:13
@kou kou requested a review from Copilot April 28, 2026 00:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h
Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc
Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc
@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch 3 times, most recently from 1580dbd to 0f25fe5 Compare May 4, 2026 18:09
@justing-bq justing-bq force-pushed the gh-49783-reuse-test-connections branch from 0f25fe5 to 1f5db13 Compare May 5, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants