fix(tester): route mobile checks by platform binding

This commit is contained in:
2026-10-16 12:38:11 +08:00
parent 9b2d0a28d8
commit 5b9a693fda
5 changed files with 258 additions and 20 deletions
+66
View File
@@ -50,6 +50,72 @@ class MobileBundleTests(unittest.TestCase):
with self.assertRaises(bundle.ArtifactFailure):
bundle.parse_artifacts(["android=/tmp/a.apk", "android=/tmp/b.apk"])
def test_parse_bindings_keeps_platforms_separate(self):
self.assertEqual(
bundle.parse_bindings(["android=tester.android", "ios=tester.ios"], ["android", "ios"]),
{"android": "tester.android", "ios": "tester.ios"},
)
self.assertEqual(
bundle.parse_bindings([], ["android"]),
{"android": "tester.android"},
)
with self.assertRaises(bundle.ArtifactFailure):
bundle.parse_bindings(["android=tester.test", "ios=tester.test"], ["android", "ios"])
def test_preflight_matrix_rejects_remote_platform_using_local_runner(self):
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
agent_dir = root / ".pouch"
agent_dir.mkdir()
(agent_dir / "agent.yaml").write_text(
"""
schemaVersion: 1
locations:
local-app:
environment: local
host: local
project: test
path: /tmp/test
remote-ios:
environment: macmini
host: runtime:12345678-1234-1234-1234-123456789012
project: test
path: /tmp/test-ios
profiles:
test-agent:
role: test
cli: codex
tier: standard
model: gpt-5
reasoningEffort: medium
permissionMode: workspace-write
bindings:
tester.android: {adapter: tester, location: local-app, profile: test-agent}
tester.ios: {adapter: tester, location: remote-ios, profile: test-agent}
""".strip()
+ "\n",
encoding="utf-8",
)
config = root / "matrix.yaml"
config.write_text(
"""
matrix:
- platform: android
tester: {binding: tester.android, node: local, runner: {kind: local}}
- platform: ios
tester: {binding: tester.ios, node: local, runner: {kind: local}}
""".strip()
+ "\n",
encoding="utf-8",
)
with self.assertRaisesRegex(bundle.EnvironmentFailure, "ios.*contract runner"):
bundle.validate_preflight_matrix(
root,
config,
{"android": "tester.android", "ios": "tester.ios"},
["android", "ios"],
)
def test_new_worktree_each_run(self):
with tempfile.TemporaryDirectory() as temp:
repo, worktrees = Path(temp) / "repo", Path(temp) / "worktrees"