Make kusttestharness shareable.

This commit is contained in:
Jeffrey Regan
2019-05-07 14:18:35 -07:00
parent 8c5d4128e0
commit bcc7412ef2
23 changed files with 389 additions and 343 deletions

View File

@@ -85,6 +85,19 @@ func (rf *Factory) SliceFromPatches(
return result, nil
}
// FromBytes unmarshalls bytes into one Resource.
func (rf *Factory) FromBytes(in []byte) (*Resource, error) {
result, err := rf.SliceFromBytes(in)
if err != nil {
return nil, err
}
if len(result) != 1 {
return nil, fmt.Errorf(
"expected 1 resource, found %d in %v", len(result), in)
}
return result[0], nil
}
// SliceFromBytes unmarshalls bytes into a Resource slice.
func (rf *Factory) SliceFromBytes(in []byte) ([]*Resource, error) {
kunStructs, err := rf.kf.SliceFromBytes(in)