Skip to content

Commit

Permalink
test_: fix codecov, final
Browse files Browse the repository at this point in the history
  • Loading branch information
antdanchenko committed Feb 27, 2025
1 parent 43820d6 commit e7c1930
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
20 changes: 1 addition & 19 deletions tests-functional/clients/status_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, await_signals=[], privileged=False):
url = option.status_backend_url
else:
self.docker_client = docker.from_env()
retries = 5
retries = 2
ports_tried = []
for _ in range(retries):
try:
Expand Down Expand Up @@ -321,24 +321,6 @@ def container_exec(self, command):
def find_public_key(self):
self.public_key = self.node_login_event.get("event", {}).get("settings", {}).get("public-key")

@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
def kill(self):
if not self.container:
return
logging.info(f"Killing container with id {self.container.short_id}")
try:
self.container.stop(timeout=30)
self.container.remove()
except Exception as e:
print(e)
try:
self.container.remove()
except Exception as e:
logging.warning(f"Failed to remove container {self.container.short_id}: {e}")
finally:
self.container = None
logging.info("Container stopped.")

@retry(stop=stop_after_delay(10), wait=wait_fixed(0.1), reraise=True)
def change_container_ip(self, new_ip=None):
if not self.container:
Expand Down
10 changes: 4 additions & 6 deletions tests-functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def close_status_backend_containers(request):
yield
if hasattr(request.node.instance, "reuse_container"):
return
for container in option.status_backend_containers:
try:
container.stop(timeout=30)
container.remove()
except Exception as e:
print(e)
for status_backend in option.status_backend_containers:
status_backend.container.stop(timeout=10)
option.status_backend_containers.remove(status_backend)
status_backend.container.remove()
11 changes: 5 additions & 6 deletions tests-functional/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ def setup_class(self):
self.rpc_client.wait_for_login()

def teardown_class(self):
for container in option.status_backend_containers:
try:
container.stop(timeout=30)
container.remove()
except Exception as e:
print(e)
for status_backend in option.status_backend_containers:
status_backend.container.stop(timeout=10)
option.status_backend_containers.remove(status_backend)
status_backend.container.remove()



class WalletTestCase(StatusBackendTestCase):
Expand Down

0 comments on commit e7c1930

Please sign in to comment.