Isolate CLI tests from host configuration
This commit is contained in:
@@ -1173,6 +1173,15 @@ func waitForAtomicAtLeast(t *testing.T, value *int32, want int32) {
|
||||
}
|
||||
|
||||
func TestRunProcessReportJSONSuccessIncludesNormalizationSummary(t *testing.T) {
|
||||
// Exercise the no-config metadata contract without consulting system files.
|
||||
t.Setenv("AUDITA_CONFIG", "")
|
||||
if err := os.Unsetenv("AUDITA_CONFIG"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
searchPaths := config.DefaultConfigSearchPaths
|
||||
config.DefaultConfigSearchPaths = nil
|
||||
t.Cleanup(func() { config.DefaultConfigSearchPaths = searchPaths })
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
|
||||
@@ -1350,7 +1359,7 @@ func TestRunProcessReportJSONAndRunDirReportShareDiagnosticsMetadata(t *testing.
|
||||
if externalReport.Diagnostics == nil || runDirReport.Diagnostics == nil {
|
||||
t.Fatalf("expected diagnostics metadata in both reports")
|
||||
}
|
||||
if externalReport.ReportMetadata != runDirReport.ReportMetadata {
|
||||
if !reflect.DeepEqual(externalReport.ReportMetadata, runDirReport.ReportMetadata) {
|
||||
t.Fatalf("expected same report metadata in --report-json and run-dir report\nexternal=%+v\nrun-dir=%+v",
|
||||
externalReport.ReportMetadata, runDirReport.ReportMetadata)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user