MCPcopy Create free account
hub / github.com/github/gh-aw / TestBuildMissingToolsSummary

Function TestBuildMissingToolsSummary

pkg/cli/logs_json_test.go:560–629  ·  view source on GitHub ↗

TestBuildMissingToolsSummary tests missing tools aggregation

(t *testing.T)

Source from the content-addressed store, hash-verified

558
559// TestBuildMissingToolsSummary tests missing tools aggregation
560func TestBuildMissingToolsSummary(t *testing.T) {
561 processedRuns := []ProcessedRun{
562 {
563 Run: WorkflowRun{
564 WorkflowName: "Workflow A",
565 DatabaseID: 1,
566 },
567 MissingTools: []MissingToolReport{
568 {
569 Tool: "github_search",
570 Reason: "Not allowed",
571 ReportProvenance: ReportProvenance{
572 WorkflowName: "Workflow A",
573 RunID: 1,
574 },
575 },
576 },
577 },
578 {
579 Run: WorkflowRun{
580 WorkflowName: "Workflow B",
581 DatabaseID: 2,
582 },
583 MissingTools: []MissingToolReport{
584 {
585 Tool: "github_search",
586 Reason: "Permission denied",
587 ReportProvenance: ReportProvenance{
588 WorkflowName: "Workflow B",
589 RunID: 2,
590 },
591 },
592 {
593 Tool: "web_fetch",
594 Reason: "Not configured",
595 ReportProvenance: ReportProvenance{
596 WorkflowName: "Workflow B",
597 RunID: 2,
598 },
599 },
600 },
601 },
602 }
603
604 summary := buildMissingToolsSummary(processedRuns)
605
606 // Should have 2 unique tools
607 if len(summary) != 2 {
608 t.Errorf("Expected 2 unique tools, got %d", len(summary))
609 }
610
611 // github_search should have count 2 and be first (sorted by count desc)
612 if summary[0].Tool != "github_search" {
613 t.Errorf("Expected first tool to be 'github_search', got '%s'", summary[0].Tool)
614 }
615 if summary[0].Count != 2 {
616 t.Errorf("Expected github_search count 2, got %d", summary[0].Count)
617 }

Callers

nothing calls this directly

Calls 2

buildMissingToolsSummaryFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected