improve gvk and resid strings for error messages

This commit is contained in:
natasha41575
2021-12-21 18:58:01 -08:00
parent ec38bbeb99
commit 6dfc238aa2
14 changed files with 85 additions and 155 deletions

View File

@@ -172,7 +172,7 @@ func getReplacement(nodes []*yaml.RNode, r *types.Replacement) (*yaml.RNode, err
return nil, err
}
if rn.IsNilOrEmpty() {
return nil, fmt.Errorf("fieldPath `%s` is missing for replacement source %s", r.Source.FieldPath, r.Source)
return nil, fmt.Errorf("fieldPath `%s` is missing for replacement source %s", r.Source.FieldPath, r.Source.ResId)
}
return getRefinedValue(r.Source.Options, rn)

View File

@@ -269,7 +269,7 @@ spec:
- select:
kind: Deployment
`,
expectedErr: "multiple matches for selector ~G_~V_Deployment|~X|~N",
expectedErr: "multiple matches for selector Deployment.[noVer].[noGrp]/[noName].[noNs]",
},
"replacement has no source": {
input: `apiVersion: v1
@@ -1586,7 +1586,7 @@ data:
options:
create: true
`,
expectedErr: "fieldPath `data.httpPort` is missing for replacement source ~G_~V_ConfigMap|~X|ports-from:data.httpPort",
expectedErr: "fieldPath `data.httpPort` is missing for replacement source ConfigMap.[noVer].[noGrp]/ports-from.[noNs]",
},
"annotationSelector": {
input: `apiVersion: v1