diff --git a/bundle/config/mutator/apply_presets_catalog_schema.go b/bundle/config/mutator/apply_presets_catalog_schema.go index ad28344447..227a25843b 100644 --- a/bundle/config/mutator/apply_presets_catalog_schema.go +++ b/bundle/config/mutator/apply_presets_catalog_schema.go @@ -240,7 +240,7 @@ func addCatalogSchemaParameters(b *bundle.Bundle, key string, job *resources.Job if param.Name == "catalog" { hasCatalog = true diags = diags.Extend(diag.Diagnostics{{ - Summary: fmt.Sprintf("job %s already has 'catalog' parameter defined; ignoring preset value", key), + Summary: fmt.Sprintf("job '%s' already has 'catalog' parameter defined; ignoring preset value", key), Severity: diag.Warning, Locations: b.Config.GetLocations("resources.jobs." + key + ".parameters"), }}) @@ -248,7 +248,7 @@ func addCatalogSchemaParameters(b *bundle.Bundle, key string, job *resources.Job if param.Name == "schema" { hasSchema = true diags = diags.Extend(diag.Diagnostics{{ - Summary: fmt.Sprintf("job %s already has 'schema' parameter defined; ignoring preset value", key), + Summary: fmt.Sprintf("job '%s' already has 'schema' parameter defined; ignoring preset value", key), Severity: diag.Warning, Locations: []dyn.Location{b.Config.GetLocation("resources.jobs." + key + ".parameters")}, }}) diff --git a/bundle/config/mutator/apply_presets_catalog_schema_test.go b/bundle/config/mutator/apply_presets_catalog_schema_test.go index 5230b205d0..ffcbb1526a 100644 --- a/bundle/config/mutator/apply_presets_catalog_schema_test.go +++ b/bundle/config/mutator/apply_presets_catalog_schema_test.go @@ -27,6 +27,8 @@ type recordedField struct { Expected string } +// mockPresetsCatalogSchema returns a mock bundle with all known resources +// that have catalog/schema fields, with those fields filled in as placeholders. func mockPresetsCatalogSchema() *bundle.Bundle { return &bundle.Bundle{ Config: config.Root{ @@ -162,7 +164,8 @@ func mockPresetsCatalogSchema() *bundle.Bundle { } } -// ignoredFields are fields that should be ignored in the completeness check +// ignoredFields are all paths to fields in resources where we don't want to +// apply the catalog/schema presets. var ignoredFields = map[string]string{ "resources.pipelines.key.schema": "schema is still in private preview", "resources.jobs.key.tasks[0].notebook_task.base_parameters": "catalog/schema are passed via job parameters", @@ -266,7 +269,7 @@ func TestApplyPresetsCatalogSchemaCompleteness(t *testing.T) { // Find all catalog/schema fields that we think should be covered based // on all properties in config.Resources. - expectedFields := findCatalogSchemaFields() + expectedFields := findAllPossibleCatalogSchemaFields() assert.GreaterOrEqual(t, len(expectedFields), 42, "expected at least 42 catalog/schema fields, but got %d", len(expectedFields)) // Verify that all expected fields are there @@ -307,9 +310,10 @@ func recordPlaceholderFields(t *testing.T, b *bundle.Bundle) []recordedField { return recordedFields } -// findCatalogSchemaFields finds all fields in config.Resources that might refer -// to a catalog or schema. Returns a slice of field paths. -func findCatalogSchemaFields() []string { +// findAllPossibleCatalogSchemaFields finds all fields in config.Resources that might refer +// to a catalog or schema. Returns a slice of field paths like +// "resources.pipelines.key.catalog". +func findAllPossibleCatalogSchemaFields() []string { visited := make(map[reflect.Type]struct{}) var results []string diff --git a/bundle/config/mutator/translate_paths.go b/bundle/config/mutator/translate_paths.go index 306efc29dd..be07c77e08 100644 --- a/bundle/config/mutator/translate_paths.go +++ b/bundle/config/mutator/translate_paths.go @@ -59,7 +59,7 @@ type translateContext struct { seen map[string]string } -// GetLocalPath returns the local file system paths for a path referenced from a resource.. +// GetLocalPath returns the local file system paths for a path referenced from a resource. // If it's an absolute path, we treat it as a workspace path and return "". // // Arguments: