Finalize and close the distributor report path refactor roadmap
This commit is contained in:
@@ -113,7 +113,7 @@ func traverseReportDistributorPathOverrides(cfg Config) (map[report.ID][]string,
|
||||
if !reportCfg.Distributor.pathTemplatesSet {
|
||||
continue
|
||||
}
|
||||
if err := validateReportDistributorPathTemplates(key, reportCfg.Distributor.PathTemplates); err != nil {
|
||||
if err := validateReportDistributorPathTemplates(key, reportID, reportCfg.Distributor.PathTemplates); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
overrides[reportID] = append([]string(nil), reportCfg.Distributor.PathTemplates...)
|
||||
@@ -121,13 +121,21 @@ func traverseReportDistributorPathOverrides(cfg Config) (map[report.ID][]string,
|
||||
return overrides, nil
|
||||
}
|
||||
|
||||
func validateReportDistributorPathTemplates(reportKey string, templates []string) error {
|
||||
func validateReportDistributorPathTemplates(reportKey string, reportID report.ID, templates []string) error {
|
||||
name := fmt.Sprintf("reports.%s.distributor.path_templates", reportKey)
|
||||
_, err := RenderDistributorReportPaths(name, templates, sampleDistributorTemplateValues())
|
||||
_, err := RenderDistributorReportPaths(name, templates, sampleDistributorTemplateValuesForReport(reportID))
|
||||
return err
|
||||
}
|
||||
|
||||
func sampleDistributorTemplateValues() DistributorTemplateValues {
|
||||
return sampleDistributorTemplateValuesForReport(report.Storm)
|
||||
}
|
||||
|
||||
func sampleDistributorTemplateValuesForReport(reportID report.ID) DistributorTemplateValues {
|
||||
stormID := ""
|
||||
if reportID == report.Storm {
|
||||
stormID = "2026-05-29T0000-2026-05-30T0000"
|
||||
}
|
||||
return DistributorTemplateValues{
|
||||
LocationID: "location",
|
||||
ReportID: "report",
|
||||
@@ -140,7 +148,7 @@ func sampleDistributorTemplateValues() DistributorTemplateValues {
|
||||
ValidEndTime: "0000",
|
||||
ValidStartStamp: "2026-05-29T0000",
|
||||
ValidEndStamp: "2026-05-30T0000",
|
||||
StormID: "2026-05-29T0000-2026-05-30T0000",
|
||||
StormID: stormID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user