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.
Merge pull request Kuadrant#387 from pehala/affected_by
Add affected by status tests
- Loading branch information
Showing
10 changed files
with
112 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Contains Base class for policies""" | ||
|
||
import openshift_client as oc | ||
|
||
from testsuite.openshift import OpenShiftObject | ||
from testsuite.utils import has_condition | ||
|
||
|
||
class Policy(OpenShiftObject): | ||
"""Base class with common functionality for all policies""" | ||
|
||
def wait_for_ready(self): | ||
"""Wait for a Policy to be Enforced""" | ||
with oc.timeout(90): | ||
success, _, _ = self.self_selector().until_all( | ||
success_func=has_condition("Enforced", "True"), | ||
tolerate_failures=5, | ||
) | ||
assert success, f"{self.kind()} did not get ready in time" |
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
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
31 changes: 31 additions & 0 deletions
31
testsuite/tests/kuadrant/gateway/reconciliation/test_affected_by.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,31 @@ | ||
"""Tests that affected by status is applied correctly to the HTTPRoute and Gateway""" | ||
|
||
import pytest | ||
|
||
pytestmark = [pytest.mark.kuadrant_only] | ||
|
||
|
||
def test_route_status(route, rate_limit, authorization): | ||
"""Tests affected by status for HTTPRoute""" | ||
route.refresh() | ||
assert route.is_affected_by(rate_limit) | ||
assert route.is_affected_by(authorization) | ||
|
||
rate_limit.delete() | ||
assert not route.wait_until(lambda obj: obj.is_affected_by(rate_limit)) | ||
|
||
authorization.delete() | ||
assert not route.wait_until(lambda obj: obj.is_affected_by(authorization)) | ||
|
||
|
||
def test_gateway_status(gateway, dns_policy, tls_policy): | ||
"""Tests affected by status for Gateway""" | ||
gateway.refresh() | ||
assert gateway.is_affected_by(dns_policy) | ||
assert gateway.is_affected_by(tls_policy) | ||
|
||
dns_policy.delete() | ||
assert not gateway.wait_until(lambda obj: obj.is_affected_by(dns_policy)) | ||
|
||
tls_policy.delete() | ||
assert not gateway.wait_until(lambda obj: obj.is_affected_by(tls_policy)) |
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