acknowledge that creation of a restmapper can fail and that we cannot have a default

This commit is contained in:
David Eads
2018-04-30 08:04:43 -04:00
parent ef0d1ab819
commit 1cb797e355
26 changed files with 130 additions and 85 deletions

View File

@@ -437,8 +437,12 @@ func TestClusterRoleValidate(t *testing.T) {
for name, test := range tests {
t.Run(name, func(t *testing.T) {
test.clusterRoleOptions.Mapper = tf.RESTMapper()
err := test.clusterRoleOptions.Validate()
var err error
test.clusterRoleOptions.Mapper, err = tf.RESTMapper()
if err != nil {
t.Fatal(err)
}
err = test.clusterRoleOptions.Validate()
if test.expectErr && err == nil {
t.Errorf("%s: expect error happens, but validate passes.", name)
}