mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
test(doctor): cover mutation command wiring (age-nw28h.2.7.3)
This commit is contained in:
@@ -15,6 +15,39 @@ import (
|
||||
"github.com/boshu2/agentops/cli/internal/doctor"
|
||||
)
|
||||
|
||||
func TestDoctorMutationRequestCopiesCommandFlags(t *testing.T) {
|
||||
oldOnly, oldSkip := doctorOnly, doctorSkip
|
||||
oldQuick, oldOnline := doctorQuick, doctorOnline
|
||||
oldSeverity, oldDryRun := doctorSeverity, doctorDryRun
|
||||
oldRobot := doctorRobot
|
||||
t.Cleanup(func() {
|
||||
doctorOnly, doctorSkip = oldOnly, oldSkip
|
||||
doctorQuick, doctorOnline = oldQuick, oldOnline
|
||||
doctorSeverity, doctorDryRun = oldSeverity, oldDryRun
|
||||
doctorRobot = oldRobot
|
||||
})
|
||||
|
||||
doctorOnly = []string{"one"}
|
||||
doctorSkip = []string{"two"}
|
||||
doctorQuick = true
|
||||
doctorOnline = true
|
||||
doctorSeverity = "P2"
|
||||
doctorDryRun = true
|
||||
doctorRobot = true
|
||||
|
||||
request := doctorMutationRequest()
|
||||
if len(request.Only) != 1 || request.Only[0] != "one" || len(request.Skip) != 1 || request.Skip[0] != "two" {
|
||||
t.Fatalf("request=%+v", request)
|
||||
}
|
||||
if !request.Quick || !request.Online || request.Severity != "P2" || !request.DryRun || !request.JSON {
|
||||
t.Fatalf("request=%+v", request)
|
||||
}
|
||||
doctorOnly[0] = "changed"
|
||||
if request.Only[0] != "one" {
|
||||
t.Fatalf("request aliases command flags: %+v", request)
|
||||
}
|
||||
}
|
||||
|
||||
func TestComputeResult(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -143,7 +143,7 @@ ao doctor [command]
|
||||
--online Enable network probes (default: offline-only)
|
||||
--only strings Scope to a subset of detectors or subsystems
|
||||
--quick Run only fast-path detectors (< 200ms)
|
||||
--robot Alias for --json with structured wrapper
|
||||
--robot Alias for stable JSON report output
|
||||
--robot-triage Emit the mega-command triage JSON
|
||||
--severity string Minimum severity to emit (P0|P1|P2|P3) (default "P3")
|
||||
--since string Diff findings against an earlier run
|
||||
|
||||
Reference in New Issue
Block a user