Add report distributor path defaults
This commit is contained in:
@@ -520,6 +520,88 @@ func TestRegistryDefinitionsDeclarePathAndCompatibilityPolicy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeneratedRegistryDefinitionsDeclareDistributorPathDefaults(t *testing.T) {
|
||||
for _, definition := range DefaultRegistry().All() {
|
||||
if !definition.Generated {
|
||||
continue
|
||||
}
|
||||
if len(definition.DistributorPathTemplates) == 0 {
|
||||
t.Fatalf("%s DistributorPathTemplates is empty", definition.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryDefinitionsDeclareDefaultDistributorPathTemplates(t *testing.T) {
|
||||
tests := []struct {
|
||||
id ID
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
id: Hourly,
|
||||
want: []string{
|
||||
"hourly/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: Daily,
|
||||
want: []string{
|
||||
"daily/{valid_start_date}/{run_id}.md",
|
||||
"daily/{valid_start_date}/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: Today,
|
||||
want: []string{
|
||||
"daily/{valid_start_date}/{run_id}.md",
|
||||
"daily/{valid_start_date}/index.md",
|
||||
"today/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: Tomorrow,
|
||||
want: []string{
|
||||
"daily/{valid_start_date}/{run_id}.md",
|
||||
"daily/{valid_start_date}/index.md",
|
||||
"tomorrow/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: ThreeDay,
|
||||
want: []string{
|
||||
"three-day/{valid_start_date}/{run_id}.md",
|
||||
"three-day/{valid_start_date}/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: Weekend,
|
||||
want: []string{
|
||||
"weekend/{valid_start_date}/{run_id}.md",
|
||||
"weekend/{valid_start_date}/index.md",
|
||||
},
|
||||
},
|
||||
{
|
||||
id: Storm,
|
||||
want: []string{
|
||||
"storm/{storm_id}/{run_id}.md",
|
||||
"storm/{storm_id}/index.md",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
registry := DefaultRegistry()
|
||||
for _, tt := range tests {
|
||||
t.Run(string(tt.id), func(t *testing.T) {
|
||||
definition, err := registry.Lookup(tt.id)
|
||||
if err != nil {
|
||||
t.Fatalf("Lookup() error = %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(definition.DistributorPathTemplates, tt.want) {
|
||||
t.Fatalf("DistributorPathTemplates = %#v, want %#v", definition.DistributorPathTemplates, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryDefinitionsDeclareDefaultModules(t *testing.T) {
|
||||
tests := []struct {
|
||||
id ID
|
||||
@@ -682,6 +764,9 @@ func TestRegistryAppliesModuleOverridesWithoutChangingDefaults(t *testing.T) {
|
||||
if len(defaultDefinition.ModuleIDs()) <= len(definition.ModuleIDs()) {
|
||||
t.Fatalf("default ModuleIDs() = %#v, want original defaults unchanged", defaultDefinition.ModuleIDs())
|
||||
}
|
||||
if !reflect.DeepEqual(definition.DistributorPathTemplates, defaultDefinition.DistributorPathTemplates) {
|
||||
t.Fatalf("overridden DistributorPathTemplates = %#v, want %#v", definition.DistributorPathTemplates, defaultDefinition.DistributorPathTemplates)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryRejectsModuleOverrideForUnknownReport(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user