Skip to content

Commit

Permalink
Merge pull request #4541 from annasong20/bug4487
Browse files Browse the repository at this point in the history
Added test for bug 4487: cannot parse keys with dots
  • Loading branch information
k8s-ci-robot committed Mar 25, 2022
2 parents c4febc5 + 497d2ee commit 866e840
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions kyaml/yaml/rnode_test.go
Expand Up @@ -2310,3 +2310,31 @@ func TestGetAnnotations(t *testing.T) {
t.Fatalf("expected '%s', got '%s'", expected, actual)
}
}

func TestGetFieldValueWithDot(t *testing.T) {
t.Skip()

const input = `
kind: Pod
metadata:
name: hello-world
labels:
app: hello-world-app
foo.appname: hello-world-foo
`
data, err := Parse(input)
require.NoError(t, err)

labelRNode, err := data.Pipe(Lookup("metadata", "labels"))
require.NoError(t, err)

app, err := labelRNode.GetFieldValue("app")
require.NoError(t, err)
require.Equal(t, "hello-world-app", app)

// TODO: doesn't currently work; we expect to be able to escape the dot in future
// https://github.com/kubernetes-sigs/kustomize/issues/4487
fooAppName, err := labelRNode.GetFieldValue(`foo\.appname`)
require.NoError(t, err)
require.Equal(t, "hello-world-foo", fooAppName) // no field named 'foo.appname'
}

0 comments on commit 866e840

Please sign in to comment.