Skip to content

(test): Add DNS and IP Address Connectivity Tests #5514

@currantw

Description

@currantw

Summary

Add integration tests for

  • DNS resolution (with and without TLS)
  • Pv4/IPv6 connectivity (with and without TLS)

to all Valkey GLIDE clients, as well as the Rust core.

Pull Requests

Changes

Test Cases

The following tests cases were added to each client:

Cluster Mode Connection Type Test Case
1 Standalone Non-TLS Connection succeeds with valid hostname.
2 Standalone Non-TLS Connection fails with invalid hostname.
3 Standalone Non-TLS Connection succeeds with IPv4 address.
4 Standalone Non-TLS Connection succeeds with IPv6 address.
5 Standalone TLS Connection succeeds with hostname present in certificate SAN.
6 Standalone TLS Connection fails with hostname not in certificate SAN.
7 Standalone TLS Connection succeeds with IPv4 address in certificate.
8 Standalone TLS Connection succeeds with IPv6 address in certificate.
9 Cluster Non-TLS Connection succeeds with valid hostname.
10 Cluster Non-TLS Connection fails with invalid hostname.
11 Cluster Non-TLS Connection succeeds with IPv4 address.
12 Cluster Non-TLS Connection succeeds with IPv6 address.
13 Cluster TLS Connection succeeds with hostname present in certificate SAN.
14 Cluster TLS Connection fails with hostname not in certificate SAN.
15 Cluster TLS Connection succeeds with IPv4 address in certificate.
16 Cluster TLS Connection succeeds with IPv6 address in certificate.

Rust

Tests Method
1 test_standalone_connect_with_valid_hostname_no_tls
2 test_standalone_connect_with_invalid_hostname_no_tls
3, 4 test_connection_with_ip_address_succeeds
5 test_standalone_tls_connect_with_hostname_in_cert
6 test_standalone_tls_connect_with_hostname_not_in_cert
7, 8 test_tls_connection_with_ip_address_succeeds
9 test_cluster_connect_with_valid_hostname_no_tls
10 test_cluster_connect_with_invalid_hostname_no_tls
11, 12 test_cluster_connection_with_ip_address_succeeds
13 test_cluster_tls_connect_with_hostname_in_cert
14 test_cluster_tls_connect_with_hostname_not_in_cert
15, 16 test_cluster_tls_connection_with_ip_address_succeeds

Java

Tests Method
1, 9 DnsTest.testConnectWithValidHostnameNoTls
2, 10 DnsTest.testConnectWithInvalidHostnameNoTls
3, 4 StandaloneClientTests.testStandaloneConnectWithIpAddressSucceeds
5, 13 DnsTest.testTlsConnectWithHostnameInCert
6, 14 DnsTest.testTlsConnectWithHostnameNotInCert
7, 8 StandaloneTlsCertificateTest.testStandaloneTlsWithIpAddressSucceeds
11, 12 ClusterClientTests.testClusterConnectWithIpAddressSucceeds
15, 16 ClusterTlsCertificateTest.testClusterTlsWithIpAddressSucceeds

Python (Async)

Tests Method
1, 9 TestDns.test_connect_with_valid_hostname_succeeds
2, 10 TestDns.test_connect_with_invalid_hostname_fails
3, 4, 11, 12 TestConnection.test_connect_with_ip_address_succeeds
5, 13 TestDns.test_tls_with_hostname_in_certificate_succeeds
6, 14 TestDns.test_tls_with_hostname_not_in_certificate_fails
7, 8, 15, 16 TestTls.test_tls_with_ip_address_connection_succeeds

Python (Sync)

Tests Method
1, 9 TestSyncDns.test_connect_with_valid_hostname_succeeds
2, 10 TestSyncDns.test_connect_with_invalid_hostname_fails
3, 4, 11, 12 TestConnection.test_connect_with_ip_address_succeeds
5, 13 TestSyncDns.test_tls_with_hostname_in_certificate_succeeds
6, 14 TestSyncDns.test_tls_with_hostname_not_in_certificate_fails
7, 8, 15, 16 TestSyncTls.test_tls_with_ip_address_connection_succeeds

Node

Tests Method
1 DNS Tests - Non-TLS: should connect with valid hostname - standalone
2 DNS Tests - Non-TLS: should fail with invalid hostname - standalone
3 GlideClient: should connect with IPv4 address
4 GlideClient: should connect with IPv6 address
5 DNS Tests - TLS: should connect with hostname in certificate SAN - standalone
6 DNS Tests - TLS: should fail with hostname NOT in certificate SAN - standalone
7 TlsCertificateTest: Standalone TLS with IP addresses: should connect with IPv4 address
8 TlsCertificateTest: Standalone TLS with IP addresses: should connect with IPv6 address
9 DNS Tests - Non-TLS: should connect with valid hostname - cluster
10 DNS Tests - Non-TLS: should fail with invalid hostname - cluster
11 GlideClusterClient: should connect with IPv4 address
12 GlideClusterClient: should connect with IPv6 address
13 DNS Tests - TLS: should connect with hostname in certificate SAN - cluster
14 DNS Tests - TLS: should fail with hostname NOT in certificate SAN - cluster
15 TlsCertificateTest: Cluster TLS with IP addresses: should connect with IPv4 address
16 TlsCertificateTest: Cluster TLS with IP addresses: should connect with IPv6 address

Go

Tests Method
1 TestDnsConnectWithValidHostnameSucceeds_Standalone
2 TestDnsConnectWithInvalidHostnameFails_Standalone
3 TestConnectWithIPv4AddressSucceeds_Standalone
4 TestConnectWithIPv6AddressSucceeds_Standalone
5 TestDnsTlsWithHostnameInCertificateSucceeds_Standalone
6 TestDnsTlsWithHostnameNotInCertificateFails_Standalone
7 TestTlsWithIPv4AddressSucceeds_Standalone
8 TestTlsWithIPv6AddressSucceeds_Standalone
9 TestDnsConnectWithValidHostnameSucceeds_Cluster
10 TestDnsConnectWithInvalidHostnameFails_Cluster
11 TestConnectWithIPv4AddressSucceeds_Cluster
12 TestConnectWithIPv6AddressSucceeds_Cluster
13 TestDnsTlsWithHostnameInCertificateSucceeds_Cluster
14 TestDnsTlsWithHostnameNotInCertificateFails_Cluster
15 TestTlsWithIPv4AddressSucceeds_Cluster
16 TestTlsWithIPv6AddressSucceeds_Cluster

C#

⚠️ TODO

PHP

⚠️ TODO

Test Constants

Test constants HOSTNAME_TLS, HOSTNAME_NO_TLS, HOST_ADDRESS_IPV4, and HOST_ADDRESS_IPV6 were added for each client and the Rust core. All names and documentation are consistent across clients. New test constants file were added where needed.

Client File
Java java/integTest/src/test/java/glide/Constants.java
Python python/tests/constants.py
Node.js node/tests/Constants.ts
Go go/integTest/constants.go
Rust glide-core/tests/constants.rs
C# ⚠️ TODO
PHP ⚠️ TODO

Workflows

GitHub workflows are also configured to run DNS tests for all clients:

  1. setup-dns-tests action - Configures /etc/hosts with test hostnames
  2. VALKEY_GLIDE_DNS_TESTS_ENABLED="1" - Environment variable to enable tests

Corresponding workflow files:

  • Java: .github/workflows/java.yml
  • Python: .github/workflows/python.yml
  • Node: .github/workflows/node.yml
  • Go: .github/workflows/go.yml
  • Rust: .github/workflows/rust.yml
  • C#: ⚠️ TODO
  • PHP: ⚠️ TODO

Documentation

All clients also contain consistent documentation:

  • A "DNS Tests" section in DEVELOPER.md that describes how to setup host mappings and the VALKEY_GLIDE_DNS_TESTS_ENABLED environment variables for DNS tests. (In Rust, there is no existing DEVELOPER.md, so this is part of README.md instead, which is fine because this is an internal module).
  • The DNS test module documentation for each client points to the corresponding markdown file to reduce duplication.
Client Markdown Documentation Test File Documentation
Java java/DEVELOPER.md#dns-tests DnsTest.java links to DEVELOPER.md#dns-tests
Python python/DEVELOPER.md#dns-tests test_dns.py and test_sync_dns.py link to DEVELOPER.md#dns-tests
Node.js node/DEVELOPER.md#dns-tests Dns.test.ts links to DEVELOPER.md#dns-tests
Go go/DEVELOPER.md#dns-tests dns_test.go links to DEVELOPER.md#dns-tests
Rust glide-core/README.md#dns-tests test_dns.rs links to README.md#dns-tests
C# ⚠️ TODO ⚠️ TODO
PHP ⚠️ TODO ⚠️ TODO

Metadata

Metadata

Assignees

No one assigned

    Labels

    CI/CD ⚒️CI/CD relatedTask 🔧Implementation work (not a bug)go 🏃golang wrappertesting 🧪Everything about testing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions