Skip to content

Commit

Permalink
Merge pull request #445 from jsmolar/jsmolar2
Browse files Browse the repository at this point in the history
Moved wait_for_ready to parent object for CRs
  • Loading branch information
averevki authored Jun 17, 2024
2 parents 0754e23 + a319536 commit 7064bbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
10 changes: 10 additions & 0 deletions testsuite/openshift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ def safe_apply(self):
assert status, f"Unable to apply changes for APIObject with result: {result}"
return result

def wait_for_ready(self):
"""Waits until CR reports ready status"""
with timeout(90):
success, _, _ = self.self_selector().until_all(
success_func=lambda obj: len(obj.model.status.conditions) > 0
and all(x.status == "True" for x in obj.model.status.conditions)
)
assert success, f"{self.kind()} did got get ready in time"
self.refresh()

def __getitem__(self, name):
return self.model.spec[name]

Expand Down
12 changes: 1 addition & 11 deletions testsuite/openshift/authorino.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
from typing import Any, Optional, Dict, List

from openshift_client import selector, timeout
from openshift_client import selector

from testsuite.lifecycle import LifecycleObject
from testsuite.openshift import CustomResource
Expand Down Expand Up @@ -86,16 +86,6 @@ def create_instance(
with openshift.context:
return cls(model)

def wait_for_ready(self):
"""Waits until Authorino CR reports ready status"""
with timeout(90):
success, _, _ = self.self_selector().until_all(
success_func=lambda obj: len(obj.model.status.conditions) > 0
and all(x.status == "True" for x in obj.model.status.conditions)
)
assert success, "Authorino did got get ready in time"
self.refresh()

@property
def deployment(self):
"""Returns Deployment object for this Authorino"""
Expand Down
12 changes: 1 addition & 11 deletions testsuite/openshift/kuadrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dataclasses

from openshift_client import selector, timeout
from openshift_client import selector

from testsuite.openshift import CustomResource
from testsuite.openshift.deployment import Deployment
Expand Down Expand Up @@ -59,13 +59,3 @@ def limitador_deployment(self):
"""Returns Deployment object for this Authorino"""
with self.context:
return selector(f"deployment/{self.LIMITADOR}").object(cls=Deployment)

def wait_for_ready(self):
"""Waits until Kuadrant CR reports ready status"""
with timeout(90):
success, _, _ = self.self_selector().until_all(
success_func=lambda obj: len(obj.model.status.conditions) > 0
and all(x.status == "True" for x in obj.model.status.conditions)
)
assert success, "Kuadrant did got get ready in time"
self.refresh()

0 comments on commit 7064bbc

Please sign in to comment.