Skip to content

Test the ssh host listing without children racing the ssh -G deadline - #734

Merged
yansfil merged 4 commits into
mainfrom
fix/flaky-728
Oct 7, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/flaky-728

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Closes #728

Summary

resolving_runs_a_bounded_number_of_children_and_asks_each_alias_once는 stand-in ssh script 12개를 제품의 3초 RESOLVE_DEADLINE 아래 실제 child로 돌렸다.
host가 바빠 child 하나가 3초 안에 끝나지 못하면 TimedOut으로 실패했다(#728, load 55-67).
같은 방식이 Add device host list의 runtime test에도 있었다.
이제 alias가 어디로 가는지 묻는 일은 Resolve(herdr-core/src/ssh_hosts.rs)다. 제품은 실제 ssh -G인 ssh_g를 넘기고, test는 답을 정한다.
listing의 규칙(한 번에 4개까지, alias마다 한 번, 순서)과 host list의 core 규칙은 child도 시계도 없이 검사하고, ssh -G가 무엇을 실행하는지와 끝나는 방식마다 어떤 답이 되는지는 값으로 검사한다.
제품 동작, deadline, 동시 실행 수는 바뀌지 않았다.

Review

  • 조심해서 볼 파일: herdr-core/src/ssh_hosts.rs - resolve_one을 command(실행할 ssh -F <config> -G -- <alias>)와 answer(실행 결과를 Problem으로)로 나눴다. 매핑은 그대로다.
  • 조심해서 볼 파일: herdr-core/src/runtime.rs - ssh_program: PathBuf가 ssh_resolve: Resolve가 됐다. 기본값은 ssh_g("ssh")로 이전과 같은 program을 쓴다.
  • 판단해 주세요: 실제 child로 ssh -G를 끝까지 돌리는 test는 이제 하나다(없는 program, 시작에서 바로 실패해 deadline과 무관). stand-in이 받은 argv를 보던 검사는 Command의 program, argv, HOME을 직접 보는 검사로 옮겼다.

Evidence

  • 확인한 것: main에서 결정적 재현. stand-in 하나(h7)가 아무도 쓰지 않는 FIFO를 cat해 끝나지 않게 하면, 이슈와 같은 assertion에서 TimedOut으로 실패한다(3.7초).
  • 확인한 것: 같은 재현을 kill -STOP으로 먼저 해 봤지만, 멈춘 child는 deadline 전에 SshFailed로 끝나 느린 child를 흉내 내지 못했다. 그래서 FIFO로 바꿨다.
  • 확인한 것: 수정 뒤 ssh_hosts test 12개(unit 10, runtime 2)를 30회 반복, 30회 모두 통과. 그동안 다른 build로 host load average가 40-83이었다.
  • 확인한 것: 로컬 verify-cargo.sh nextest -p herdr-core 1642/1642 통과, fmt-check, clippy -p herdr-core --all-targets -D warnings 통과.
  • 확인한 것: 새 test: resolving_asks_each_alias_once_from_a_bounded_number_of_workers_in_order(worker 수가 4 이하, alias마다 한 번, 순서), a_raised_stop_asks_no_alias, ssh_g_names_the_accounts_own_config_and_home, each_way_ssh_g_can_end_has_one_answer.
  • 확인하지 못한 것: Linux와 Windows는 CI로만 확인한다. 같은 실행에서 무관한 remote::tests::sparse_remote_wire_snapshot_requires_typed_bootstrap_for_events가 LEAK로 표시됐다(통과).

…n racing the ssh -G deadline

The scheduling test ran twelve stand-in ssh scripts against the
three-second RESOLVE_DEADLINE, so a host loaded enough to delay one child
failed it with TimedOut. Asking where an alias leads is now a Resolve:
production passes ssh_g, the real ssh -G, and the tests decide each
answer. The command ssh -G runs and the answer each way it can end are
checked as values, and the runtime test of the host list uses decided
answers too; the missing-program case keeps the real path, which fails
at start without a deadline.
The gh tests that also wrote their stand-in through it moved to hide-host
with its own copy, and the ssh -G tests no longer run a stand-in.
@yansfil
yansfil merged commit b2f4512 into main Oct 7, 2026
20 checks passed
@yansfil
yansfil deleted the fix/flaky-728 branch October 7, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: herdr-core::ssh_hosts resolving_runs_a_bounded_number_of_children_and_asks_each_alias_once

1 participant