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

Function TestBuildAuditDataComplete

pkg/cli/audit_report_test.go:655–846  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

653}
654
655func TestBuildAuditDataComplete(t *testing.T) {
656 // Create a comprehensive test with all data filled in
657 tmpDir := testutil.TempDir(t, "audit-data-test-*")
658
659 // Create test files in the temp directory
660 testFiles := map[string]string{
661 "aw_info.json": `{"engine":"copilot"}`,
662 "output.log": "Test log content",
663 }
664 for filename, content := range testFiles {
665 err := os.WriteFile(tmpDir+"/"+filename, []byte(content), 0644)
666 require.NoError(t, err, "Failed to create test file %s", filename)
667 }
668
669 processedRun := ProcessedRun{
670 Run: WorkflowRun{
671 DatabaseID: 12345,
672 WorkflowName: "Complete Test Workflow",
673 Status: "completed",
674 Conclusion: "failure",
675 CreatedAt: time.Date(2024, 1, 1, 10, 0, 0, 0, time.UTC),
676 StartedAt: time.Date(2024, 1, 1, 10, 0, 30, 0, time.UTC),
677 UpdatedAt: time.Date(2024, 1, 1, 10, 10, 0, 0, time.UTC),
678 Duration: 9*time.Minute + 30*time.Second,
679 Event: "pull_request",
680 HeadBranch: "feature-branch",
681 URL: "https://github.com/test/repo/actions/runs/12345",
682 TokenUsage: 25000,
683 Turns: 8,
684 ErrorCount: 3,
685 WarningCount: 2,
686 LogsPath: tmpDir,
687 },
688 JobDetails: []JobInfoWithDuration{
689 {
690 JobInfo: JobInfo{
691 Name: "build",
692 Status: "completed",
693 Conclusion: "success",
694 Steps: []JobStep{
695 {Name: "Set up job", Status: "completed", Conclusion: "success"},
696 {Name: "Compile", Status: "completed", Conclusion: "success"},
697 },
698 },
699 Duration: 2 * time.Minute,
700 },
701 {
702 JobInfo: JobInfo{
703 Name: "test",
704 Status: "completed",
705 Conclusion: "failure",
706 Steps: []JobStep{
707 {Name: "Set up job", Status: "completed", Conclusion: "success"},
708 {Name: "Run tests", Status: "completed", Conclusion: "failure"},
709 },
710 },
711 Duration: 5 * time.Minute,
712 },

Callers

nothing calls this directly

Calls 3

TempDirFunction · 0.92
buildAuditDataFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected