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

Function TestBuildAuditData

pkg/cli/audit_test.go:130–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestBuildAuditData(t *testing.T) {
131 // Create test data
132 run := WorkflowRun{
133 DatabaseID: 123456,
134 WorkflowName: "Test Workflow",
135 Status: "completed",
136 Conclusion: "success",
137 CreatedAt: time.Date(2024, 1, 1, 10, 0, 0, 0, time.UTC),
138 StartedAt: time.Date(2024, 1, 1, 10, 0, 30, 0, time.UTC),
139 UpdatedAt: time.Date(2024, 1, 1, 10, 5, 0, 0, time.UTC),
140 Duration: 4*time.Minute + 30*time.Second,
141 Event: "push",
142 HeadBranch: "main",
143 URL: "https://github.com/org/repo/actions/runs/123456",
144 TokenUsage: 1500,
145 Turns: 5,
146 ErrorCount: 2,
147 WarningCount: 1,
148 LogsPath: testutil.TempDir(t, "test-*"),
149 }
150
151 metrics := LogMetrics{
152 TokenUsage: 1500,
153 Turns: 5,
154 ToolCalls: []workflow.ToolCallInfo{
155 {
156 Name: "github_issue_read",
157 CallCount: 3,
158 MaxInputSize: 256,
159 MaxOutputSize: 1024,
160 MaxDuration: 2 * time.Second,
161 },
162 },
163 }
164
165 missingTools := []MissingToolReport{
166 {
167 Tool: "missing_tool",
168 Reason: "Tool not available",
169 Alternatives: "use alternative_tool instead",
170 ReportProvenance: ReportProvenance{
171 Timestamp: "2024-01-01T10:00:00Z",
172 },
173 },
174 }
175
176 mcpFailures := []MCPFailureReport{
177 {
178 ServerName: "test-server",
179 Status: "failed",
180 },
181 }
182
183 processedRun := ProcessedRun{
184 Run: run,
185 MissingTools: missingTools,
186 MCPFailures: mcpFailures,
187 }

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
buildAuditDataFunction · 0.85
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected