|
14 | 14 | from ocp_utilities.operators import install_operator, uninstall_operator |
15 | 15 | from pytest_testconfig import config as py_config |
16 | 16 | from simple_logger.logger import get_logger |
17 | | -from timeout_sampler import TimeoutExpiredError, TimeoutSampler |
18 | 17 |
|
19 | 18 | from tests.model_registry.model_registry.python_client.signing.constants import ( |
20 | 19 | SECURESIGN_API_VERSION, |
|
26 | 25 | create_connection_type_field, |
27 | 26 | get_organization_config, |
28 | 27 | get_tas_service_urls, |
29 | | - is_securesign_ready, |
30 | 28 | ) |
31 | 29 | from utilities.constants import OPENSHIFT_OPERATORS, Timeout |
32 | 30 | from utilities.infra import get_openshift_token |
@@ -119,6 +117,10 @@ def installed_tas_operator(admin_client: DynamicClient) -> Generator[None, Any]: |
119 | 117 | operator_namespace=operator_ns.name, |
120 | 118 | clean_up_namespace=False, |
121 | 119 | ) |
| 120 | + # Ensure namespace exists for Securesign |
| 121 | + ns = Namespace(name=SECURESIGN_NAMESPACE) |
| 122 | + if ns.exists: |
| 123 | + ns.delete(wait=True) |
122 | 124 | else: |
123 | 125 | LOGGER.info(f"TAS operator already installed in {OPENSHIFT_OPERATORS}. Using existing installation.") |
124 | 126 | yield |
@@ -149,7 +151,8 @@ def securesign_instance( |
149 | 151 | Resource: Securesign resource instance |
150 | 152 | """ |
151 | 153 | # Ensure namespace exists for Securesign |
152 | | - Namespace(name=SECURESIGN_NAMESPACE, ensure_exists=True) |
| 154 | + ns = Namespace(name=SECURESIGN_NAMESPACE) |
| 155 | + ns.wait_for_status(status=Namespace.Status.ACTIVE) |
153 | 156 |
|
154 | 157 | # Build Securesign CR spec |
155 | 158 | org_config = get_organization_config() |
@@ -197,21 +200,7 @@ def securesign_instance( |
197 | 200 | # Create Securesign instance using custom Securesign class |
198 | 201 | with Securesign(kind_dict=securesign_dict, client=admin_client) as securesign: |
199 | 202 | LOGGER.info(f"Securesign instance '{SECURESIGN_NAME}' created in namespace '{SECURESIGN_NAMESPACE}'") |
200 | | - |
201 | | - # Wait for the Securesign instance to become ready |
202 | | - try: |
203 | | - for sample in TimeoutSampler( |
204 | | - wait_timeout=Timeout.TIMEOUT_5MIN, |
205 | | - sleep=5, |
206 | | - func=lambda: securesign.instance.to_dict(), |
207 | | - ): |
208 | | - if sample and is_securesign_ready(sample): |
209 | | - LOGGER.info(f"Securesign instance '{SECURESIGN_NAME}' is ready") |
210 | | - break |
211 | | - except TimeoutExpiredError: |
212 | | - LOGGER.error(f"Timeout waiting for Securesign instance '{SECURESIGN_NAME}' to become ready") |
213 | | - raise |
214 | | - |
| 203 | + securesign.wait_for_condition(condition="Ready", status="True") |
215 | 204 | yield securesign |
216 | 205 |
|
217 | 206 | # Cleanup is handled automatically by the context manager |
|
0 commit comments