Persist module snapshots for generated reports

This commit is contained in:
2026-06-09 20:58:35 +00:00
parent 40639309b1
commit 2483c2362d
11 changed files with 236 additions and 82 deletions

View File

@@ -28,6 +28,10 @@ func TestRunHelpLongFlag(t *testing.T) {
if !strings.Contains(stdout.String(), "generate daily") {
t.Fatalf("help output missing generate command:\n%s", stdout.String())
}
removedInspectCommand := "inspect " + "briefing"
if !strings.Contains(stdout.String(), "inspect modules") || strings.Contains(stdout.String(), removedInspectCommand) {
t.Fatalf("help output has wrong inspect commands:\n%s", stdout.String())
}
}
func TestRunHelpShortFlag(t *testing.T) {
@@ -729,7 +733,8 @@ func TestRunInspectGeneratedArtifacts(t *testing.T) {
t.Fatalf("inspect reports output missing run:\n%s", stdout.String())
}
for _, command := range []string{"metadata", "briefing", "data-package", "sources"} {
var sourcesOutput string
for _, command := range []string{"metadata", "modules", "data-package", "sources"} {
stdout.Reset()
err = runner.Run(context.Background(), []string{"inspect", command, "--config", configPath, runID}, &stdout, &stderr)
if err != nil {
@@ -738,9 +743,12 @@ func TestRunInspectGeneratedArtifacts(t *testing.T) {
if !strings.Contains(stdout.String(), runID) {
t.Fatalf("inspect %s output missing run id:\n%s", command, stdout.String())
}
if command == "sources" {
sourcesOutput = stdout.String()
}
}
if !strings.Contains(stdout.String(), `"warnings"`) {
t.Fatalf("inspect sources output missing warnings:\n%s", stdout.String())
if !strings.Contains(sourcesOutput, `"warnings"`) {
t.Fatalf("inspect sources output missing warnings:\n%s", sourcesOutput)
}
}
@@ -772,7 +780,7 @@ func TestRunInspectRunCommandsParseRunIDAndConfig(t *testing.T) {
t.Fatalf("write config: %v", err)
}
runner := Runner{Clock: fixedClock()}
commands := []string{"metadata", "briefing", "data-package", "prior", "sources"}
commands := []string{"metadata", "modules", "data-package", "prior", "sources"}
for _, command := range commands {
t.Run(command+" requires run id", func(t *testing.T) {