Skip to content

Add non-HttpSM tests for acquireSession - #13579

Draft
JosiahWI wants to merge 4 commits into
apache:masterfrom
JosiahWI:feat/session-tests
Draft

Add non-HttpSM tests for acquireSession#13579
JosiahWI wants to merge 4 commits into
apache:masterfrom
JosiahWI:feat/session-tests

Conversation

@JosiahWI

Copy link
Copy Markdown
Contributor

This patch includes a few simple test cases for acquireSession. They cover only the behavior which does not require an HttpSM object.

This patch includes a few simple test cases for `acquireSession`. They cover
only the behavior which does not require an `HttpSM` object.
@JosiahWI JosiahWI added this to the 11.0.0 milestone Aug 21, 2026
@JosiahWI JosiahWI self-assigned this Aug 21, 2026
Copilot AI lite review requested due to automatic review settings August 21, 2026 11:53
@JosiahWI JosiahWI added the Tests label Aug 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Catch2 unit coverage for ServerSessionPool::acquireSession() paths that do not require an HttpSM instance, and updates the public header documentation to better describe the API’s selection behavior.

Changes:

  • Add a new test_HttpSessionManager.cc exercising acquireSession() matching behavior for IP-only, host-only, and combined masks.
  • Wire the new unit test file into the test_http target.
  • Expand / clarify ServerSessionPool::acquireSession() documentation in HttpSessionManager.h.

Reviewed changes

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

File Description
src/proxy/http/unit_tests/test_HttpSessionManager.cc New Catch2 unit tests for ServerSessionPool::acquireSession() without HttpSM.
src/proxy/http/unit_tests/CMakeLists.txt Adds the new test source to the test_http executable.
include/proxy/http/HttpSessionManager.h Updates the doxygen comment for acquireSession() to clarify behavior and constraints.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/proxy/http/unit_tests/test_HttpSessionManager.cc Outdated
Comment thread src/proxy/http/unit_tests/test_HttpSessionManager.cc
Comment thread include/proxy/http/HttpSessionManager.h Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 21, 2026 13:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

include/proxy/http/HttpSessionManager.h:104

  • The sm parameter docs currently say it is only consulted for SNI/certificate validation when the corresponding bits are set in match_style, but acquireSession() also calls validate_session_origin_cert(sm, ...) unconditionally. For multiplexing sessions this dereferences sm for origin certificate hostname verification regardless of match_style, so the docs should reflect that broader usage (or explicitly state sm must be non-null when multiplexing sessions may be present).
   * @param[in]  sm             The requesting HTTP state machine; consulted for SNI and certificate
   *                            validation when the corresponding bits are set in @p match_style.

src/proxy/http/unit_tests/test_HttpSessionManager.cc:209

  • In this section, acquired is set by a successful DONE acquisition and then reused in a NOT_FOUND acquisition, but the test doesn't assert that acquireSession() clears the output parameter on failure. Adding a CHECK(acquired == nullptr) here would verify the documented out-parameter contract for the non-null -> null transition.
      CHECK(acquired == session);

      // A non-multiplexing session is handed off, not shared: it leaves both pools.
      CHECK(pool.count() == 0);
      CHECK(pool.acquireSession(Addr{"10.0.0.1:80"}, hash_of("one.example.com"), MATCH_HOSTONLY, nullptr, acquired) ==

Copilot AI review requested due to automatic review settings August 21, 2026 13:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

include/proxy/http/HttpSessionManager.h:104

  • The sm parameter docs say it is only consulted when the corresponding bits are set in match_style, but acquireSession() always calls validate_session_origin_cert(sm, session) (see src/proxy/http/HttpSessionManager.cc:176-239). For multiplexing sessions that function dereferences sm (sm->get_outbound_sni_for_cert_verification(), HttpSessionManager.cc:50-53) even if match_style doesn’t include TS_SERVER_SESSION_SHARING_MATCH_MASK_CERT. Please update the parameter documentation to reflect that sm may be consulted when evaluating multiplexed sessions (origin-certificate hostname validation), so callers know sm must be valid in that case.
   * @param[in]  sm             The requesting HTTP state machine; consulted for SNI and certificate
   *                            validation when the corresponding bits are set in @p match_style.

@JosiahWI

Copy link
Copy Markdown
Contributor Author

[approve ci autest 3]

Comment thread src/proxy/http/unit_tests/test_HttpSessionManager.cc
Comment thread include/proxy/http/HttpSessionManager.h Outdated
  Reset metric after each subcase
  Improve `sm` parameter doc
Copilot AI review requested due to automatic review settings August 21, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated no new comments.

@JosiahWI
JosiahWI marked this pull request as draft August 21, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants