Skip to content

Commit

Permalink
Merge pull request #534 from averevki/assert-round-robin
Browse files Browse the repository at this point in the history
Assert IPs returned in round-robin fashion in the multicluster test
  • Loading branch information
averevki authored Sep 12, 2024
2 parents b4f9624 + f8efed3 commit 668f3a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions testsuite/tests/multicluster/test_simple_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def test_simple_strategy(client, hostname, gateway, gateway2):
assert not result.has_cert_verify_error(), result.error
assert result.status_code == 200

ips = {gateway.external_ip().split(":")[0], gateway2.external_ip().split(":")[0]}
dns_ips = {ip.address for ip in dns.resolver.resolve(hostname.hostname)}
assert ips == dns_ips, f"Expected IPs and actual IP mismatch, got {dns_ips}, expected {ips}"
dns_ip1 = dns.resolver.resolve(hostname.hostname)[0].address
dns_ip2 = dns.resolver.resolve(hostname.hostname)[0].address
assert dns_ip1 != dns_ip2, "Simple routing strategy should return IPs in a round-robin fashion"

gateway_ips = {gateway.external_ip().split(":")[0], gateway2.external_ip().split(":")[0]}
dns_ips = {dns_ip1, dns_ip2}
assert gateway_ips == dns_ips, f"Expected and actual IPs mismatch, expected {gateway_ips}, got {dns_ips}"

0 comments on commit 668f3a1

Please sign in to comment.