Skip to content

Add DNS and TLS tests#215

Merged
currantw merged 29 commits intovalkey-io:mainfrom
currantw:currantw/dns_csharp_tests
Mar 20, 2026
Merged

Add DNS and TLS tests#215
currantw merged 29 commits intovalkey-io:mainfrom
currantw:currantw/dns_csharp_tests

Conversation

@currantw
Copy link
Collaborator

@currantw currantw commented Feb 27, 2026

Summary

Add integration tests for DNS resolution and TLS IPv4/IPv6 connectivity in the C# client.

Issue Link

⚪ None

Features and Behaviour Changes

Add new DNS and TLS tests, and centralize common test data and constants.
See more details below.

Implementation

New Tests

DnsTests class: DNS resolution tests with and without TLS for both cluster and standalone:

  • Non-TLS connection succeeds with valid hostname.
  • Non-TLS connection fails with invalid hostname.
  • TLS connection succeeds with hostname present in certificate SAN.
  • TLS connection fails with hostname not in certificate SAN.

TlsTests enhancements: TLS connectivity tests with IPv4 and IPv6 addresses:

  • TLS connection succeeds with IPv4 address (127.0.0.1).
  • TLS connection succeeds with IPv6 address (::1).

ClusterClientTests and StandaloneClientTests enhancements: connectivity tests with IPv4 and IPv6 addresses (without TLS):

  • Connection succeeds with IPv4 address (127.0.0.1).
  • Connection succeeds with IPv6 address (::1).

DNS tests require hostname mappings and the environment variable VALKEY_GLIDE_DNS_TESTS_ENABLED to be set.

Test Infrastructure Improvements

TestUtils.Constants class: Centralized shared test constants to eliminate duplication across test files:

  • HostnameTls - Hostname included in certificate SAN
  • HostnameNoTls - Hostname not in certificate SAN
  • Ipv4Address - IPv4 loopback address
  • Ipv6Address - IPv6 loopback address

TestUtils.Data class: Centralized common test data to eliminate duplication across test files, with ClusterMode and IpAddresses.

Server class enhancements:

  • Made Addresses property public for test access.
  • Added CertificatePath and CertificateData properties (reduce dependence on ServerManager and hide the fact that all servers share the same certificates).

Test refactoring: Updated all PubSub and other integration tests to use centralized Data.ClusterMode instead of local definitions, improving consistency and maintainability.

Limitations

DNS tests require host file entries mapping valkey.glide.test.tls.com and valkey.glide.test.no_tls.com to 127.0.0.1 and ::1. These must be configured manually for local development (automatically configured in CI).

Testing

See New Tests above.

Related Issues

  • Java implementation: #5419
  • Rust implementation: #5436
  • Go implementation: #5479

Checklist

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated and all checks pass.
  • CHANGELOG.md, README.md, DEVELOPER.md, and other documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

@currantw currantw self-assigned this Feb 27, 2026
@currantw currantw requested a review from Copilot February 27, 2026 17:35
Copy link

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

Adds new integration coverage for DNS resolution and TLS connectivity variants in the C# client, and refactors shared test utilities to reduce duplication.

Changes:

  • Introduces DNS/host-based integration tests and expands TLS test coverage.
  • Centralizes shared theory data (ClusterMode) and updates PubSub tests to consume it.
  • Enhances test Server utility with public addresses and certificate accessors; renames client creation APIs to async-style.

Reviewed changes

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

Show a summary per file
File Description
valkey-glide Updates submodule pointer to bring in upstream changes needed by the new tests/utilities.
tests/Valkey.Glide.TestUtils/Server.cs Exposes server addresses/certs for tests and renames client creation methods to *Async.
tests/Valkey.Glide.TestUtils/Data.cs Adds shared ClusterMode theory data for reuse across test suites.
tests/Valkey.Glide.IntegrationTests/TlsTests.cs Refactors TLS tests/fixture and adds new certificate handling pathways.
tests/Valkey.Glide.IntegrationTests/PubSubUtils.cs Switches PubSub theory generation to shared Data.ClusterMode.
tests/Valkey.Glide.IntegrationTests/PubSubQueueTests.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/PubSubIntrospectionTests.cs Updates MemberData and server client creation calls to async naming.
tests/Valkey.Glide.IntegrationTests/PubSubEdgeCases.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/PubSubCoexistenceTests.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/PubSubCallbackTests.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/PubSubBasicTests.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/ISubscriberCompatibilityTests.cs Updates MemberData to shared cluster-mode data.
tests/Valkey.Glide.IntegrationTests/DnsTests.cs Adds new host/DNS-oriented connectivity tests (cluster/standalone, TLS/non-TLS, IPv4/IPv6).

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

Signed-off-by: currantw <[email protected]>
Copy link

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


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

… into currantw/dns_csharp_tests

Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
@currantw currantw merged commit 4993130 into valkey-io:main Mar 20, 2026
22 of 23 checks passed
@currantw currantw deleted the currantw/dns_csharp_tests branch March 20, 2026 18:01
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.

4 participants