Tolerate macos nsc ssh handoff exit
This commit is contained in:
parent
ff5736a817
commit
dd369bd0f8
2 changed files with 72 additions and 0 deletions
47
services/forgejo-nsc/internal/nsc/macos_nsc_test.go
Normal file
47
services/forgejo-nsc/internal/nsc/macos_nsc_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue