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

Function createTestProcessedRun

pkg/cli/audit_report_test.go:22–51  ·  view source on GitHub ↗

createTestProcessedRun creates a test ProcessedRun with customizable parameters

(opts ...func(*ProcessedRun))

Source from the content-addressed store, hash-verified

20
21// createTestProcessedRun creates a test ProcessedRun with customizable parameters
22func createTestProcessedRun(opts ...func(*ProcessedRun)) ProcessedRun {
23 run := WorkflowRun{
24 DatabaseID: 123456,
25 WorkflowName: "Test Workflow",
26 Status: "completed",
27 Conclusion: "success",
28 CreatedAt: time.Date(2024, 1, 1, 10, 0, 0, 0, time.UTC),
29 StartedAt: time.Date(2024, 1, 1, 10, 0, 30, 0, time.UTC),
30 UpdatedAt: time.Date(2024, 1, 1, 10, 5, 0, 0, time.UTC),
31 Duration: 4*time.Minute + 30*time.Second,
32 Event: "push",
33 HeadBranch: "main",
34 URL: "https://github.com/org/repo/actions/runs/123456",
35 TokenUsage: 1500,
36 Turns: 5,
37 ErrorCount: 0,
38 WarningCount: 0,
39 LogsPath: "/tmp/test-logs",
40 }
41
42 processedRun := ProcessedRun{
43 Run: run,
44 }
45
46 for _, opt := range opts {
47 opt(&processedRun)
48 }
49
50 return processedRun
51}
52
53// assertFindingExists checks if a finding with the given category and severity exists
54func assertFindingExists(t *testing.T, findings []Finding, category, severity string, msgAndArgs ...any) {

Calls

no outgoing calls

Tested by

no test coverage detected