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
+19
View File
@@ -108,6 +108,25 @@ func active() *profile.Profile {
return &profile.Profile{Name: "office", Mode: profile.AdvancedMode, HTTPURL: "http://proxy.example:8080", HTTPSURL: "http://secure.example:8443", AllURL: "socks5://socks.example:1080", Bypass: []string{"localhost", ".example.com", "10.0.0.0/8", "2001:db8::1"}}
}
func TestDetectClassifiesMalformedRecoveryMetadataAsFailureWithoutRepeatingSettingsProbe(t *testing.T) {
runner := newRunner()
a := adapter(runner, &memoryState{data: []byte("{malformed")})
detection := a.Detect(context.Background(), active())
if detection.Err == nil || detection.Inspection.State != target.Drifted {
t.Fatalf("detection = %#v, want failed Drifted inspection", detection)
}
gets := 0
for _, call := range runner.calls {
if len(call.Args) > 0 && call.Args[0] == "get" {
gets++
}
}
if gets != 12 {
t.Fatalf("Detect issued %d gsettings get probes, want one 12-setting inspection", gets)
}
}
func TestAuthenticationPasswordSetFailureSuppressesRunnerErrorAndProfileArgument(t *testing.T) {
const profilePassword = "GNOME-PROFILE-PASSWORD-07"
r, state := newRunner(), &memoryState{}