56 lines
2.5 KiB
Go
56 lines
2.5 KiB
Go
package diagnostics
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildDiagnosticsMetadataSuccessPathsMatchArtifactConstants(t *testing.T) {
|
|
runPath := filepath.Join("tmp", "run-123")
|
|
metadata := BuildDiagnosticsMetadata(runPath, true)
|
|
|
|
if metadata.DirectoryPath != runPath {
|
|
t.Fatalf("unexpected diagnostics directory path: got=%q want=%q", metadata.DirectoryPath, runPath)
|
|
}
|
|
if metadata.SourceTranscriptPath != filepath.Join(runPath, ArtifactSourceTranscript) {
|
|
t.Fatalf("unexpected source transcript path: %q", metadata.SourceTranscriptPath)
|
|
}
|
|
if metadata.ParsedSourceTranscriptPath != filepath.Join(runPath, ArtifactParsedSourceTranscript) {
|
|
t.Fatalf("unexpected parsed source transcript path: %q", metadata.ParsedSourceTranscriptPath)
|
|
}
|
|
if metadata.NormalizedTranscriptPath != filepath.Join(runPath, ArtifactNormalizedTranscript) {
|
|
t.Fatalf("unexpected normalized transcript path: %q", metadata.NormalizedTranscriptPath)
|
|
}
|
|
if metadata.NormalizationSummaryPath != filepath.Join(runPath, ArtifactNormalizationSummary) {
|
|
t.Fatalf("unexpected normalization summary path: %q", metadata.NormalizationSummaryPath)
|
|
}
|
|
if metadata.ChunkingSummaryPath != filepath.Join(runPath, ArtifactChunkingSummary) {
|
|
t.Fatalf("unexpected chunking summary path: %q", metadata.ChunkingSummaryPath)
|
|
}
|
|
if metadata.UtilizationSummaryPath != filepath.Join(runPath, ArtifactUtilizationSummary) {
|
|
t.Fatalf("unexpected utilization summary path: %q", metadata.UtilizationSummaryPath)
|
|
}
|
|
if metadata.CorrectionLedgerPath != filepath.Join(runPath, ArtifactCorrectionLedger) {
|
|
t.Fatalf("unexpected correction ledger path: %q", metadata.CorrectionLedgerPath)
|
|
}
|
|
if metadata.InvocationMetadataPath != filepath.Join(runPath, ArtifactInvocationMetadata) {
|
|
t.Fatalf("unexpected invocation metadata path: %q", metadata.InvocationMetadataPath)
|
|
}
|
|
if metadata.RedactedEffectiveConfigPath != filepath.Join(runPath, ArtifactEffectiveConfig) {
|
|
t.Fatalf("unexpected redacted effective config path: %q", metadata.RedactedEffectiveConfigPath)
|
|
}
|
|
if metadata.ErrorLogPath != "" {
|
|
t.Fatalf("did not expect error log path on success: %q", metadata.ErrorLogPath)
|
|
}
|
|
}
|
|
|
|
func TestBuildDiagnosticsMetadataFailureIncludesErrorLogPath(t *testing.T) {
|
|
runPath := filepath.Join("tmp", "run-123")
|
|
metadata := BuildDiagnosticsMetadata(runPath, false)
|
|
|
|
want := filepath.Join(runPath, ArtifactErrorLog)
|
|
if metadata.ErrorLogPath != want {
|
|
t.Fatalf("unexpected error log path: got=%q want=%q", metadata.ErrorLogPath, want)
|
|
}
|
|
}
|