fix: complete target diagnostics and reset inspection
This commit is contained in:
@@ -224,7 +224,7 @@ func runMaintenanceCommand(args []string, input io.Reader, output io.Writer, sto
|
||||
continue
|
||||
}
|
||||
if item.Err != nil {
|
||||
fmt.Fprintf(output, "%s: failed (%s) — %s\n", item.TargetID, item.Inspection.State, profile.RedactText(item.Err.Error()))
|
||||
fmt.Fprintf(output, "%s: failed (%s) — %s; fresh inspection: %s\n", item.TargetID, item.Inspection.State, profile.RedactText(item.Err.Error()), profile.RedactText(item.Inspection.Evidence))
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(output, "%s: reset (%s) — %s\n", item.TargetID, item.Inspection.State, profile.RedactText(item.Inspection.Evidence))
|
||||
|
||||
@@ -50,6 +50,9 @@ func TestProductionCompositionRegistersAPTContainerGNOMEAndDaemonTargets(t *test
|
||||
var ids []string
|
||||
for _, adapter := range targets {
|
||||
ids = append(ids, adapter.ID())
|
||||
if _, ok := adapter.(target.Diagnosable); !ok {
|
||||
t.Errorf("production Target %s does not contribute doctor checks", adapter.ID())
|
||||
}
|
||||
}
|
||||
want := []string{"apt", "docker-containers", "gnome", "docker-daemon"}
|
||||
if strings.Join(ids, ",") != strings.Join(want, ",") {
|
||||
|
||||
@@ -232,10 +232,10 @@ func TestResetCommandCancellationAndTruthfulPartialFailureWithFakeTargets(t *tes
|
||||
t.Fatal("partial reset returned success")
|
||||
}
|
||||
text := output.String()
|
||||
if good.calls != 1 || bad.calls != 1 || external.calls != 0 || !strings.Contains(text, "good: reset (Disabled)") || !strings.Contains(text, "bad: failed (Drifted)") || !strings.Contains(text, "external: skipped (External)") {
|
||||
if good.calls != 1 || bad.calls != 1 || external.calls != 0 || !strings.Contains(text, "good: reset (Disabled)") || !strings.Contains(text, "bad: failed (Drifted)") || !strings.Contains(text, "fresh inspection: fake evidence for http://alice:REDACTED@proxy.test") || !strings.Contains(text, "external: skipped (External)") {
|
||||
t.Fatalf("partial reset output=%q calls=%d/%d/%d", text, good.calls, bad.calls, external.calls)
|
||||
}
|
||||
if strings.Contains(text, "hunter2") || strings.Contains(err.Error(), "hunter2") {
|
||||
if strings.Contains(text, "hunter2") || strings.Contains(text, "secret") || strings.Contains(err.Error(), "hunter2") {
|
||||
t.Fatalf("reset leaked credentials: output=%q err=%v", text, err)
|
||||
}
|
||||
logData, readErr := os.ReadFile(filepath.Join(stateDir, "operations.log"))
|
||||
|
||||
Reference in New Issue
Block a user