Persist module snapshots for generated reports
This commit is contained in:
@@ -26,7 +26,7 @@ Usage:
|
||||
weatherreporter run evening [--config PATH] [--units VALUE] [--tz NAME] [--out-dir PATH]
|
||||
weatherreporter inspect reports [--config PATH] [--limit N]
|
||||
weatherreporter inspect metadata [--config PATH] RUN_ID
|
||||
weatherreporter inspect briefing [--config PATH] RUN_ID
|
||||
weatherreporter inspect modules [--config PATH] RUN_ID
|
||||
weatherreporter inspect data-package [--config PATH] RUN_ID
|
||||
weatherreporter inspect prior [--config PATH] RUN_ID
|
||||
weatherreporter inspect sources [--config PATH] RUN_ID
|
||||
@@ -118,8 +118,8 @@ var inspectRunCommands = []inspectRunCommand{
|
||||
{Name: "metadata", Inspect: func(ctx context.Context, req app.InspectRunRequest) (any, error) {
|
||||
return app.InspectMetadata(ctx, req)
|
||||
}},
|
||||
{Name: "briefing", Inspect: func(ctx context.Context, req app.InspectRunRequest) (any, error) {
|
||||
return app.InspectBriefing(ctx, req)
|
||||
{Name: "modules", Inspect: func(ctx context.Context, req app.InspectRunRequest) (any, error) {
|
||||
return app.InspectModules(ctx, req)
|
||||
}},
|
||||
{Name: "data-package", Inspect: func(ctx context.Context, req app.InspectRunRequest) (any, error) {
|
||||
return app.InspectDataPackage(ctx, req)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user