fix: finish progressive Target detection

This commit is contained in:
proxyctl coordinator
2026-07-17 21:25:43 +08:00
parent ad651402fd
commit 8348fa3ac8
17 changed files with 672 additions and 221 deletions
+18
View File
@@ -80,6 +80,24 @@ func TestShellDiagnosticsRejectSymlinkedPathsWithoutTouchingVictim(t *testing.T)
}
}
func TestDetectClassifiesMalformedRecoveryMetadataAsFailure(t *testing.T) {
a := newAdapter(t, "/bin/bash", nil)
if err := os.MkdirAll(filepath.Dir(a.RecoveryPath()), 0o700); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(a.RecoveryPath(), []byte("{malformed"), 0o600); err != nil {
t.Fatal(err)
}
detection := a.Detect(context.Background(), activeProfile())
if detection.Err == nil || detection.Inspection.State != target.Drifted {
t.Fatalf("detection = %#v, want failed Drifted inspection", detection)
}
if got := a.Inspect(context.Background(), activeProfile()); got.State != target.Drifted {
t.Fatalf("maintenance inspection = %#v, want established Drifted semantics", got)
}
}
func TestShellAvailabilitySupportsOnlyBashAndZsh(t *testing.T) {
for _, tc := range []struct {
shell string