Skip to content

Commit

Permalink
Merge pull request #251 from IRL2/fix/essd-test
Browse files Browse the repository at this point in the history
improve reliability of essd tests
  • Loading branch information
Ragzouken authored Oct 7, 2024
2 parents 1391b5d + e4a6d77 commit 60dbd32
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions python-libraries/nanover-essd/tests/test_essd_client_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from nanover.essd import DiscoveryServer
from nanover.essd.client import DiscoveryClient
from nanover.testing import assert_not_in_soon, assert_in_soon
from test_essd_server import service
from test_essd_service import (
properties,
Expand Down Expand Up @@ -67,22 +68,20 @@ def test_send_service_different_port(service):


def test_remove_service(client_server, service):
"""
Test that a removed service is no longer found by searching for services.
"""
client, server = client_server

def find_services():
services = set(client.search_for_services(search_time=1))
return services

server.register_service(service)
services = set(
client.search_for_services(
search_time=TEST_SEARCH_TIME, interval=TEST_INTERVAL_TIME
)
)
assert service in services
assert_in_soon(lambda: service, lambda: find_services(), timeout=5)

server.unregister_service(service)
time.sleep(TEST_INTERVAL_TIME)
services = set(
client.search_for_services(
search_time=TEST_SEARCH_TIME, interval=TEST_INTERVAL_TIME
)
)
assert service not in services
assert_not_in_soon(lambda: service, lambda: find_services(), timeout=5)


def test_send_service_multiple_clients(client_server, service):
Expand Down

0 comments on commit 60dbd32

Please sign in to comment.