swift-server / swift-server/async-http-client

flaky test: `testConnectionPoolGrowsToMaxConcurrentConnections`

Open
#508 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/testing
Dominant language
Swift
Stars
1.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

There are a couple of issues with testConnectionPoolGrowsToMaxConcurrentConnections:

  • The maxConnections variable isn't passed down to the ConnectionPool constructor. The expected value 8 happens to match the default, but shouldn't this test use a non-default value, to check that the parameter works?

  • It checks:

    XCTAssertEqual(httpBin.createdConnections, maxConnections)
    

    But actually, httpBin.createdConnections > maxConnections is also valid. The ConnectionsCountHandler doesn't actually measure the maximum number of active connections it saw -- just the total number that were created. If I have a couple of Xcode projects open, some Safari windows each with lots of tabs, I can see 10 created connections (even though when logging, I see that the maximum concurrent connections parameter was always respected).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with testConnectionPoolGrowsToMaxConcurrentConnections in Tests/AsyncHTTPClientTests/HTTPConnectionPoolTests.swift and inspect ConnectionsCountHandler in Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift. Run the test and verify it passes a non-default maxConnections value, measures the maximum concurrent connections rather than only total connections created, and accepts valid connection recreation.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.