-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #604 from averevki/fix-multicluster-tests
Fix multicluster tests
- Loading branch information
Showing
2 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
31 changes: 26 additions & 5 deletions
31
testsuite/tests/multicluster/load_balanced/test_change_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
"""Test changing load-balancing strategy in DNSPolicy""" | ||
|
||
from time import sleep | ||
|
||
import pytest | ||
import dns.resolver | ||
|
||
from testsuite.kuadrant.policy.dns import has_record_condition | ||
|
||
pytestmark = [pytest.mark.multicluster] | ||
|
||
|
||
def test_change_lb_strategy(dns_policy2): | ||
"""Verify that changing load-balancing strategy is not allowed""" | ||
def test_change_lb_strategy(hostname, gateway, gateway2, dns_policy2, dns_server, dns_server2, wildcard_domain): | ||
"""Verify that removing DNSPolicy load-balancing configuration removes GEO load-balancing endpoint from the pool""" | ||
resolver = dns.resolver.Resolver(configure=False) | ||
resolver.nameservers = [dns_server["address"]] | ||
assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0] | ||
|
||
resolver.nameservers = [dns_server2["address"]] | ||
assert resolver.resolve(hostname.hostname)[0].address == gateway2.external_ip().split(":")[0] | ||
|
||
dns_policy2.model.spec.pop("loadBalancing") | ||
res = dns_policy2.apply() | ||
dns_policy2.apply() | ||
assert dns_policy2.wait_until( | ||
has_record_condition( | ||
"Ready", | ||
"False", | ||
"ProviderError", | ||
"The DNS provider failed to ensure the record: record type conflict, cannot update endpoint " | ||
f"'{wildcard_domain}' with record type 'A' when endpoint already exists with record type 'CNAME'", | ||
) | ||
) | ||
|
||
assert res.status() == 1 | ||
assert "loadBalancing is immutable" in res.err() | ||
sleep(300) # wait for DNS propagation on providers | ||
assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters