Add tests in support of Issue 3489.

This commit is contained in:
monopole
2021-02-02 18:22:33 -08:00
parent 3892e3c910
commit aae2be1a79
8 changed files with 130 additions and 22 deletions

View File

@@ -528,7 +528,7 @@ func TestNameReferenceUnhappyRun(t *testing.T) {
`: considering field 'rules/resourceNames' of object
{"apiVersion": "rbac.authorization.k8s.io/v1", "kind": "ClusterRole", "metadata": {
"name": "cr"}, "rules": [{"resourceNames": {"foo": "bar"}, "resources": ["secrets"]}]}
: visit traversal on path: [resourceNames]: no 'name' field in node`,
: visit traversal on path: [resourceNames]: path config error; no 'name' field in node`,
`updating name reference in 'rules/resourceNames' field of `+
`'rbac.authorization.k8s.io_v1_ClusterRole|~X|cr'`+
`: considering field 'rules/resourceNames' of object
@@ -541,7 +541,7 @@ rules:
foo: bar
resources:
- secrets
: visit traversal on path: [resourceNames]: no 'name' field in node`)},
: visit traversal on path: [resourceNames]: path config error; no 'name' field in node`)},
}
nrt := newNameReferenceTransformer(builtinconfig.MakeDefaultConfig().NameReference)