-
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.
Add tests for dnspolicy modification
Signed-off-by: averevki <[email protected]>
- Loading branch information
Showing
5 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
27 changes: 27 additions & 0 deletions
27
testsuite/tests/multicluster/load_balanced/test_change_default_geo.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Test for modification of default geolocation in DNSPolicy""" | ||
|
||
from time import sleep | ||
|
||
import pytest | ||
import dns.resolver | ||
|
||
pytestmark = [pytest.mark.multicluster] | ||
|
||
|
||
def test_change_default_geo(hostname, gateway, gateway2, dns_policy, dns_policy2, dns_default_geo_server): | ||
"""Test changing dns default geolocation and verify that changes are propagated""" | ||
resolver = dns.resolver.Resolver(configure=False) | ||
resolver.nameservers = [dns_default_geo_server] | ||
|
||
assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0] | ||
|
||
dns_policy.model.spec.loadBalancing.defaultGeo = False | ||
dns_policy.apply() | ||
dns_policy.wait_for_ready() | ||
|
||
dns_policy2.model.spec.loadBalancing.defaultGeo = True | ||
dns_policy2.apply() | ||
dns_policy2.wait_for_ready() | ||
|
||
sleep(300) # wait for DNS propagation on providers | ||
assert resolver.resolve(hostname.hostname)[0].address == gateway2.external_ip().split(":")[0] |
14 changes: 14 additions & 0 deletions
14
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Test changing load-balancing strategy in DNSPolicy""" | ||
|
||
import pytest | ||
|
||
pytestmark = [pytest.mark.multicluster] | ||
|
||
|
||
def test_change_lb_strategy(dns_policy2): | ||
"""Verify that changing load-balancing strategy is not allowed""" | ||
dns_policy2.model.spec.pop("loadBalancing") | ||
res = dns_policy2.apply() | ||
|
||
assert res.status() == 1 | ||
assert "loadBalancing is immutable" in res.err() |