TestBuildLogsDataWithoutContinuation tests that continuation is omitted when nil
(t *testing.T)
| 721 | |
| 722 | // TestBuildLogsDataWithoutContinuation tests that continuation is omitted when nil |
| 723 | func TestBuildLogsDataWithoutContinuation(t *testing.T) { |
| 724 | tmpDir := testutil.TempDir(t, "test-*") |
| 725 | |
| 726 | processedRuns := []ProcessedRun{ |
| 727 | { |
| 728 | Run: WorkflowRun{ |
| 729 | DatabaseID: 12345, |
| 730 | WorkflowName: "Test Workflow", |
| 731 | LogsPath: filepath.Join(tmpDir, "run-12345"), |
| 732 | }, |
| 733 | }, |
| 734 | } |
| 735 | |
| 736 | // Build logs data without continuation |
| 737 | logsData := buildLogsData(processedRuns, tmpDir, nil) |
| 738 | |
| 739 | // Verify continuation field is nil |
| 740 | if logsData.Continuation != nil { |
| 741 | t.Errorf("Expected continuation field to be nil, got %+v", logsData.Continuation) |
| 742 | } |
| 743 | |
| 744 | // Test JSON serialization |
| 745 | jsonOutput, err := json.Marshal(logsData) |
| 746 | if err != nil { |
| 747 | t.Fatalf("Failed to marshal logs data to JSON: %v", err) |
| 748 | } |
| 749 | |
| 750 | // Verify continuation is omitted from JSON (due to omitempty tag) |
| 751 | var parsedMap map[string]any |
| 752 | if err := json.Unmarshal(jsonOutput, &parsedMap); err != nil { |
| 753 | t.Fatalf("Failed to unmarshal logs data to map: %v", err) |
| 754 | } |
| 755 | |
| 756 | if _, exists := parsedMap["continuation"]; exists { |
| 757 | t.Error("Expected continuation field to be omitted from JSON when nil") |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | // TestBuildMCPFailuresSummary tests MCP failures aggregation |
| 762 | func TestBuildMCPFailuresSummary(t *testing.T) { |
nothing calls this directly
no test coverage detected