Tolerate macos nsc ssh handoff exit
Some checks failed
Build Apple / Build App (iOS Simulator) (push) Has started running
Build Site / Next.js Build (push) Successful in 1m47s
Build Rust / Cargo Test (push) Failing after 3m43s
Build Apple / Build App (macOS) (push) Successful in 2m12s

This commit is contained in:
Conrad Kramer 2026-03-19 04:37:01 -07:00
parent ff5736a817
commit dd369bd0f8
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,47 @@
package nsc
import (
"errors"
"testing"
)
func TestNSCSSHBootstrapLikelySucceeded(t *testing.T) {
t.Parallel()
err := errors.New("wait: remote command exited without exit status or exit signal")
output := `
level=info msg="Runner registered successfully."
time="2026-03-19T11:29:49Z" level=info msg="Starting job"
time="2026-03-19T11:29:50Z" level=info msg="task 124 repo is hackclub/burrow"
`
if !nscSSHBootstrapLikelySucceeded(err, output) {
t.Fatal("expected handoff success heuristic to match")
}
}
func TestNSCSSHBootstrapLikelySucceededRejectsIncompleteOutput(t *testing.T) {
t.Parallel()
err := errors.New("wait: remote command exited without exit status or exit signal")
output := `level=info msg="Runner registered successfully."`
if nscSSHBootstrapLikelySucceeded(err, output) {
t.Fatal("expected incomplete runner output to remain a failure")
}
}
func TestNSCSSHBootstrapLikelySucceededRejectsDifferentErrors(t *testing.T) {
t.Parallel()
err := errors.New("exit status 1")
output := `
level=info msg="Runner registered successfully."
time="2026-03-19T11:29:49Z" level=info msg="Starting job"
time="2026-03-19T11:29:50Z" level=info msg="task 124 repo is hackclub/burrow"
`
if nscSSHBootstrapLikelySucceeded(err, output) {
t.Fatal("expected unrelated nsc ssh errors to remain failures")
}
}