File size: 1,282 Bytes
4de7d31 85b7ac8 4de7d31 85b7ac8 4de7d31 85b7ac8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | from server.environment import CloudNativeDebugEnvironment
from server.models import Action, ActionType, FileEdit
def test_episode_flow_fix_and_autocomplete():
env = CloudNativeDebugEnvironment()
obs = env.reset(task_id="dockerfile_syntax", scenario_id="typo_filename", seed=7)
assert obs.task_id == "dockerfile_syntax"
assert obs.total_issues >= 1
action = Action(
action_type=ActionType.REPLACE_LINE,
edits=[
FileEdit(
file_path="Dockerfile",
line_number=3,
new_content="COPY requirements.txt .",
)
],
reasoning="Fix typo in requirements filename",
)
next_obs, reward, done, info = env.step(action)
assert reward > 0
assert info["issues_fixed"] >= 1
assert done is True
assert next_obs.issues_fixed >= 1
def test_submit_runs_combined_simulation():
env = CloudNativeDebugEnvironment()
env.reset(task_id="workflow_secrets_permissions", scenario_id="missing_env_secrets", seed=42)
obs, reward, done, info = env.step(Action(action_type=ActionType.SUBMIT, reasoning="validate"))
assert done is True
assert "issues_total" in info
assert reward >= 0.0
assert obs.task_id == "workflow_secrets_permissions"
|