forked from Kuadrant/testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: averevki <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
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
Empty file.
44 changes: 44 additions & 0 deletions
44
testsuite/tests/singlecluster/gateway/dnspolicy/test_dnspolicy_removal.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,44 @@ | ||
"""Test that Gateway will behave properly after attached DNSPolicy is deleted""" | ||
|
||
import pytest | ||
|
||
from testsuite.gateway.gateway_api.gateway import KuadrantGateway | ||
|
||
pytestmark = [pytest.mark.kuadrant_only, pytest.mark.dnspolicy] | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def gateway(request, cluster, blame, wildcard_domain, module_label): | ||
"""Create gateway without TLS enabled""" | ||
gw = KuadrantGateway.create_instance(cluster, blame("gw"), wildcard_domain, {"app": module_label}, tls=False) | ||
request.addfinalizer(gw.delete) | ||
gw.commit() | ||
gw.wait_for_ready() | ||
return gw | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def commit(request, route, dns_policy): # pylint: disable=unused-argument | ||
"""Commits dnspolicy""" | ||
request.addfinalizer(dns_policy.delete) | ||
dns_policy.commit() | ||
dns_policy.wait_for_ready() | ||
|
||
|
||
def test_dnspolicy_removal(gateway, dns_policy, client): | ||
""" | ||
Test that Gateway will behave properly after attached DNSPolicy is deleted | ||
- Verify that Gateway is affected by DNSPolicy and requests are successful | ||
- Delete DNSPolicy | ||
- Verify that Gateway is no longer affected by DNSPolicy and requests are failing | ||
""" | ||
assert gateway.refresh().is_affected_by(dns_policy) | ||
|
||
response = client.get("/get") | ||
assert response.status_code == 200 | ||
|
||
dns_policy.delete() | ||
|
||
assert not gateway.refresh().is_affected_by(dns_policy) | ||
response = client.get("/get") | ||
assert response.has_dns_error() |