Fallback macos ssh bootstrap to nsc
All checks were successful
Build Site / Next.js Build (push) Successful in 1m39s
Build Rust / Cargo Test (push) Successful in 4m17s
Build Apple / Build App (iOS Simulator) (push) Successful in 2m14s
Build Apple / Build App (macOS) (push) Successful in 2m40s

This commit is contained in:
Conrad Kramer 2026-03-19 14:11:40 -07:00
parent a4cabf9fb7
commit b0e4351a9d
3 changed files with 145 additions and 6 deletions

View file

@ -1,6 +1,9 @@
package nsc
import "testing"
import (
"errors"
"testing"
)
func TestNormalizeMacOSNSCMachineTypeRoundsUp(t *testing.T) {
t.Parallel()
@ -31,3 +34,36 @@ func TestNormalizeMacOSNSCMachineTypeKeepsAllowedShape(t *testing.T) {
t.Fatalf("expected 6x14, got %q", got)
}
}
func TestShouldFallbackToNSCSSHFallbackForComputeAuthErrors(t *testing.T) {
t.Parallel()
err := errors.New("compute get ssh config failed: unauthenticated: invalid tenant credentials")
if !shouldFallbackToNSCSSH(err) {
t.Fatal("expected compute auth error to fall back to nsc ssh")
}
}
func TestShouldFallbackToNSCSSHRejectsOtherErrors(t *testing.T) {
t.Parallel()
err := errors.New("compute ssh runner bootstrap failed: exit status 1")
if shouldFallbackToNSCSSH(err) {
t.Fatal("expected unrelated bootstrap errors to remain fatal")
}
}
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")
}
}