From 95a398f7b6a22cf0e2fecba369cd9e642f1ee74f Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:11:25 +0100 Subject: [PATCH] Remove accidental commmit --- trafficlight/__init__.py | 15 +-------------- trafficlight/internals/testcase.py | 4 ++-- trafficlight/internals/testsuite.py | 3 ++- trafficlight/tests/video/ec_basic_example.py | 9 +++------ trafficlight/tests/video/load_test_call_test.py | 2 +- trafficlight/tests/video/three_user_spotlight.py | 7 ++++--- 6 files changed, 13 insertions(+), 27 deletions(-) diff --git a/trafficlight/__init__.py b/trafficlight/__init__.py index 89bf31f..2f7cad9 100644 --- a/trafficlight/__init__.py +++ b/trafficlight/__init__.py @@ -12,16 +12,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import asyncio import json import logging import os import uuid -from asyncio import Future from datetime import datetime, timedelta from typing import Any, Dict, Optional -from quart import Quart, current_app +from quart import Quart import trafficlight.kiwi as kiwi from trafficlight.homerunner import HomerunnerClient @@ -118,17 +116,6 @@ async def startup() -> None: if kiwi.kiwi_client: await kiwi.kiwi_client.start_run() - async def wait_for_done() -> None: - try: - if suite.done() for suite in get_testsuites(): - if suite.done() - logger.info("Everything done!") - await app.shutdown() - - app.add_background_task( - wait_for_done, - ) - @app.after_serving async def shutdown() -> None: adapter.stop_background_tasks = True diff --git a/trafficlight/internals/testcase.py b/trafficlight/internals/testcase.py index 0ac81a8..147bb95 100644 --- a/trafficlight/internals/testcase.py +++ b/trafficlight/internals/testcase.py @@ -28,7 +28,7 @@ def __init__( server_names: List[str], client_types: Dict[str, ClientType], ) -> None: - self.completed: Future[None] + self.completed: Optional[Future[bool]] = None self.exceptions: List[str] = [] self.guid = hashlib.md5( f"TestCase{test.name()}{server_type.name() if server_type else None}{server_names}{client_types}".encode( @@ -125,7 +125,7 @@ async def run( server.finished() if kiwi.kiwi_client: await kiwi.kiwi_client.report_status(self) - self.completed.set_result(True) + self.completed.set_result(False) async def wait_for_completion(self) -> None: self.completed = asyncio.get_running_loop().create_future() diff --git a/trafficlight/internals/testsuite.py b/trafficlight/internals/testsuite.py index 35428ea..03fd676 100644 --- a/trafficlight/internals/testsuite.py +++ b/trafficlight/internals/testsuite.py @@ -1,4 +1,3 @@ -import asyncio import hashlib from typing import List @@ -52,3 +51,5 @@ def done(self) -> bool: ) > 0 ) + else: + return False diff --git a/trafficlight/tests/video/ec_basic_example.py b/trafficlight/tests/video/ec_basic_example.py index 6375a3a..4640b34 100644 --- a/trafficlight/tests/video/ec_basic_example.py +++ b/trafficlight/tests/video/ec_basic_example.py @@ -14,13 +14,10 @@ def __init__(self) -> None: async def run(self, alice: ElementCallClient, bob: ElementCallClient) -> None: room_name = "tl_chat_" + str(datetime.now().timestamp()) - (alice_joined, bob_joined) = await asyncio.gather( - alice.create_or_join(room_name), bob.create_or_join(room_name) - ) + await alice.create(room_name) + alice_lobby = await alice.get_lobby_data() - # Check only one of alice or bob joined the room (the other created it) - # between two single-bit booleans, this is xor - print(str(alice_joined) + " or " + str(bob_joined)) + await bob.join_by_url(alice_lobby.invite_url) await asyncio.gather(alice.lobby_join(), bob.lobby_join()) await asyncio.sleep(5) diff --git a/trafficlight/tests/video/load_test_call_test.py b/trafficlight/tests/video/load_test_call_test.py index 898a575..56c9eee 100644 --- a/trafficlight/tests/video/load_test_call_test.py +++ b/trafficlight/tests/video/load_test_call_test.py @@ -25,7 +25,7 @@ async def run(self, alice: ElementCallClient, bob: ElementCallClient) -> None: room_name = "tl_chat_" + str(datetime.now().timestamp()) # Create room - await alice.create_or_join(room_name) + await alice.create(room_name) lobby_data = await alice.get_lobby_data() diff --git a/trafficlight/tests/video/three_user_spotlight.py b/trafficlight/tests/video/three_user_spotlight.py index 3705f47..428b869 100644 --- a/trafficlight/tests/video/three_user_spotlight.py +++ b/trafficlight/tests/video/three_user_spotlight.py @@ -19,9 +19,10 @@ async def run(self, alice: ElementCallClient, bob: ElementCallClient) -> None: room_name = "tl_chat_" + str(datetime.now().timestamp()) - await asyncio.gather( - alice.create_or_join(room_name), bob.create_or_join(room_name) - ) + await alice.create(room_name) + alice_lobby = await alice.get_lobby_data() + + await bob.join_by_url(alice_lobby.invite_url) # lobby screen await asyncio.gather(alice.lobby_join(), bob.lobby_join())