Consolidate configuration and resolver tests
This commit is contained in:
@@ -91,40 +91,15 @@ func TestProductionCatalogCoversMaintainedConfigurations(t *testing.T) {
|
||||
t.Fatalf("catalog validator chain = %#v, want %#v", got, wantChain)
|
||||
}
|
||||
|
||||
for _, example := range maintainedExampleFiles(t) {
|
||||
cfg := loadMaintainedExample(t, example.path)
|
||||
effective, err := cfg.Resolve(config.ResolveInput{PipelineID: "dnd-session", Catalog: catalog})
|
||||
if err != nil {
|
||||
t.Fatalf("resolve %s: %v", example.name, err)
|
||||
}
|
||||
if effective.ResolvedPipeline.Input.Module != "seriatim" || len(effective.ResolvedPipeline.ArtifactLanes) != 1 || effective.ResolvedPipeline.ArtifactLanes[0].ID != "spells" {
|
||||
t.Fatalf("resolved %s pipeline = %#v, want seriatim and spells", example.name, effective.ResolvedPipeline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultCLICompositionResolvesMaintainedConfigurations(t *testing.T) {
|
||||
catalog, err := effectiveCatalog(Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("resolve default catalog: %v", err)
|
||||
}
|
||||
if isEmptyCatalog(catalog) {
|
||||
t.Fatal("default catalog is empty")
|
||||
}
|
||||
registries, err := effectiveRegistries(Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("resolve default registries: %v", err)
|
||||
}
|
||||
if isEmptyRegistries(registries) {
|
||||
t.Fatal("default registries are empty")
|
||||
}
|
||||
|
||||
for _, example := range maintainedExampleFiles(t) {
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{"config", "validate", "--config", example.path, "--pipeline", "dnd-session"}, &stdout, &stderr, Options{LookupEnv: emptyLookup})
|
||||
if code != 0 || stderr.Len() != 0 {
|
||||
t.Fatalf("validate maintained %s config with defaults: code=%d stdout=%q stderr=%q", example.name, code, stdout.String(), stderr.String())
|
||||
}
|
||||
func TestDefaultCLICompositionValidatesRepresentativeConfiguration(t *testing.T) {
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"config", "validate", "--config", repositoryPath("examples", "dnd-spells.config.yml"), "--pipeline", "dnd-session",
|
||||
}, &stdout, &stderr, Options{})
|
||||
if code != 0 || stderr.Len() != 0 {
|
||||
t.Fatalf("validate representative config with default composition: code=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,14 +187,6 @@ func TestProductionConfigValidationCoversModuleAndVariantFailures(t *testing.T)
|
||||
if code := RunWithOptions([]string{"config", "validate", "--config", validPath, "--pipeline", "dnd-session"}, &stdout, &stderr, options); code != 0 {
|
||||
t.Fatalf("valid production config: code=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
for _, example := range maintainedExampleFiles(t) {
|
||||
var exampleStdout, exampleStderr strings.Builder
|
||||
code := RunWithOptions([]string{"config", "validate", "--config", example.path, "--pipeline", "dnd-session"}, &exampleStdout, &exampleStderr, options)
|
||||
if code != 0 {
|
||||
t.Fatalf("validate maintained %s config: code=%d stdout=%q stderr=%q", example.name, code, exampleStdout.String(), exampleStderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
content string
|
||||
|
||||
Reference in New Issue
Block a user