Skip to content

Commit

Permalink
test: remove test_rest_outbox_mode
Browse files Browse the repository at this point in the history
NOTE: now irrelevant since we have an internal rate limiter
  • Loading branch information
NiklasNeugebauer committed Mar 4, 2025
1 parent 43e7e11 commit 82a8f62
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions learning_loop_node/tests/detector/test_client_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,3 @@ def check_switch_to_mode(mode: str):
check_switch_to_mode('stopped')
check_switch_to_mode('continuous_upload')
check_switch_to_mode('stopped')


async def test_api_responsive_during_large_upload(test_detector_node: DetectorNode):
assert len(get_outbox_files(test_detector_node.outbox)) == 0

with open(test_image_path, 'rb') as f:
image_bytes = f.read()

for _ in range(100):
files = {('files', ('test.jpg', image_bytes, 'image/jpeg'))}
requests.post(f'http://localhost:{GLOBALS.detector_port}/upload', files=files, timeout=5)

outbox_size_early = len(get_outbox_files(test_detector_node.outbox))
await asyncio.sleep(5) # NOTE: we wait 5 seconds because the continuous upload is running every 5 seconds

# check if api is still responsive
response = requests.get(f'http://localhost:{GLOBALS.detector_port}/outbox_mode', timeout=2)
assert response.status_code == 200, response.content

await asyncio.sleep(7)
outbox_size_late = len(get_outbox_files(test_detector_node.outbox))
assert outbox_size_late > 0, 'The outbox should not be fully cleared, maybe the node was too fast.'
assert outbox_size_early > outbox_size_late, 'The outbox should have been partially emptied.'

0 comments on commit 82a8f62

Please sign in to comment.