Skip to content

Commit

Permalink
Add a stress test for eventstream runtime (All-Hands-AI#6038)
Browse files Browse the repository at this point in the history
Co-authored-by: Xingyao Wang <[email protected]>
  • Loading branch information
li-boxuan and xingyaoww authored Jan 6, 2025
1 parent 1f8a018 commit fb53ae4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/runtime/test_stress_docker_runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Stress tests for the DockerRuntime, which connects to the ActionExecutor running in the sandbox."""

import pytest
from conftest import TEST_IN_CI, _close_test_runtime, _load_runtime

from openhands.core.logger import openhands_logger as logger
from openhands.events.action import CmdRunAction


@pytest.mark.skipif(
TEST_IN_CI,
reason='This test should only be run locally, not in CI.',
)
def test_stress_docker_runtime(temp_dir, runtime_cls, repeat=1):
runtime = _load_runtime(temp_dir, runtime_cls)

action = CmdRunAction(
command='sudo apt-get update && sudo apt-get install -y stress-ng'
)
logger.info(action, extra={'msg_type': 'ACTION'})
obs = runtime.run_action(action)
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
assert obs.exit_code == 0

for _ in range(repeat):
# run stress-ng stress tests for 5 minutes
# FIXME: this would make Docker daemon die, even though running this
# command on its own in the same container is fine
action = CmdRunAction(command='stress-ng --all 1 -t 5m')
action.timeout = 600
logger.info(action, extra={'msg_type': 'ACTION'})
obs = runtime.run_action(action)
logger.info(obs, extra={'msg_type': 'OBSERVATION'})

_close_test_runtime(runtime)

0 comments on commit fb53ae4

Please sign in to comment.