Drop k8s metatype fields from kustomize.yaml struct

This commit is contained in:
Jeffrey Regan
2018-04-11 17:15:14 -07:00
committed by jregan
parent 444c0cd61c
commit 5c684d789c
22 changed files with 231 additions and 127 deletions

View File

@@ -21,12 +21,12 @@ import (
"strings"
"testing"
manifest "k8s.io/kubectl/pkg/apis/manifest/v1alpha1"
"k8s.io/kubectl/pkg/kustomize/types"
"k8s.io/kubectl/pkg/kustomize/util/fs"
)
func TestWriteAndRead(t *testing.T) {
manifest := &manifest.Manifest{
manifest := &types.Manifest{
NamePrefix: "prefix",
}
@@ -67,21 +67,23 @@ func TestNewNotExist(t *testing.T) {
if err == nil {
t.Fatalf("expect an error")
}
if !strings.Contains(err.Error(), "Run `kustomize init` first") {
t.Fatalf("expect an error contains %q, but got %v", "does not exist", err)
contained := "Missing kustomize config file"
if !strings.Contains(err.Error(), contained) {
t.Fatalf("expect an error contains %q, but got %v", contained, err)
}
_, err = newManifestFile("kustomize.yaml", fakeFS)
if err == nil {
t.Fatalf("expect an error")
}
if !strings.Contains(err.Error(), "Run `kustomize init` first") {
t.Fatalf("expect an error contains %q, but got %v", "does not exist", err)
if !strings.Contains(err.Error(), contained) {
t.Fatalf("expect an error contains %q, but got %v", contained, err)
}
_, err = newManifestFile(badSuffix, fakeFS)
if err == nil {
t.Fatalf("expect an error")
}
if !strings.Contains(err.Error(), "should have .yaml suffix") {
t.Fatalf("expect an error contains %q, but got %v", "does not exist", err)
contained = "should have .yaml suffix"
if !strings.Contains(err.Error(), contained) {
t.Fatalf("expect an error contains %q, but got %v", contained, err)
}
}