Skip to content

fix: support ipv6 - #234

Open
NguyenHoangSon96 wants to merge 1 commit into
mainfrom
fix/support-ipv6
Open

fix: support ipv6#234
NguyenHoangSon96 wants to merge 1 commit into
mainfrom
fix/support-ipv6

Conversation

@NguyenHoangSon96

@NguyenHoangSon96 NguyenHoangSon96 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #

Proposed Changes

  • Add tests for IPv6, I only check if our clients can parse the addresses correctly. Real communication tests need to be created inside a machine executor in CircleCI, and It is not worth the efforts, already talked with Jakub about this.
  • Arrow Flight Python does not support IPv6 with Zone Ids so we only support IPv6 without zone ids.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@NguyenHoangSon96 NguyenHoangSon96 self-assigned this Aug 13, 2026
Copilot AI lite review requested due to automatic review settings August 13, 2026 09:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds IPv6 URL support to InfluxDBClient3 host parsing so that generated REST base_url and gRPC connection_string preserve IPv6 bracket formatting, with accompanying unit tests to validate behavior.

Changes:

  • Update host parsing to re-wrap IPv6 hostnames in [] when the input URL netloc indicates an IPv6 literal.
  • Add tests covering URL parsing for IPv4/hostname and IPv6 (including ports, paths, and queries).
  • Add tests asserting the gRPC connection string generated for IPv6 hosts.

Reviewed changes

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

File Description
influxdb_client_3/__init__.py Adjusts host parsing to preserve IPv6 bracket formatting when constructing base_url / gRPC connection strings.
tests/test_influxdb_client_3.py Adds unit tests validating parsed base_url and gRPC connection strings for IPv6 hosts.

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

Comment thread influxdb_client_3/__init__.py Outdated
Comment thread tests/test_influxdb_client_3.py Outdated
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.90%. Comparing base (c5c8b6a) to head (a2f786b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   86.88%   86.90%   +0.01%     
==========================================
  Files          28       28              
  Lines        2082     2084       +2     
==========================================
+ Hits         1809     1811       +2     
  Misses        273      273              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

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)

influxdb_client_3/init.py:311

  • The docstring now states IPv6 Zone IDs are not supported, but the constructor currently accepts hosts containing a zone id (e.g. http://[fe80::1%25eth0]:8086) and will pass the percent-encoded value through into base_url/gRPC connection strings. This is likely to fail later in Arrow Flight with a hard-to-diagnose error; consider rejecting zone IDs early with a clear ValueError to match the documented contract.
        # Parse the host input
        parsed_url = urllib.parse.urlparse(host)
        hostname = parsed_url.hostname if parsed_url.hostname else host
        if "[" in parsed_url.netloc and "]" in parsed_url.netloc:
            hostname = f"[{hostname}]"

tests/test_influxdb_client_3.py:84

  • Tests cover bracket-wrapped IPv6 literals, but there is no assertion that IPv6 Zone IDs are rejected even though the PR description and docstrings state they are unsupported. Adding a zone-id case here would prevent accidental regression where a zone id silently flows into the gRPC connection string and fails later in Arrow Flight.
    def test_parse_addresses(self):
        tests = [
            {"url": "http://192.168.0.5/db", "expect": "http://192.168.0.5:443"},
            {"url": "http://192.168.0.1:80", "expect": "http://192.168.0.1:80"},
            {"url": "https://[2001:db8::1]", "expect": "https://[2001:db8::1]:443"},
            {"url": "https://[2001:db8::1]:8086/influx", "expect": "https://[2001:db8::1]:8086"},
            {"url": "http://[2001:db8::1]:15000?token=my-token", "expect": "http://[2001:db8::1]:15000"},
            {"url": "http://[2001:db8::1]", "expect": "http://[2001:db8::1]:443"},
            {"url": "http://[2001:db8:a0b:12f0::1]:80", "expect": "http://[2001:db8:a0b:12f0::1]:80"},
            {"url": "http://example.com", "expect": "http://example.com:443"},
            {"url": "http://example.com:3000", "expect": "http://example.com:3000"},
        ]
        for test in tests:
            client = InfluxDBClient3(
                host=test["url"],
                org="my_org",
                database="my_db",
                token="my_token",
            )
            self.assertEqual(client.base_url, test["expect"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants