Files
kustomize/pkg/commands/edit/fix/fix_test.go
2019-09-24 16:40:32 -07:00

33 lines
748 B
Go

// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package fix
import (
"strings"
"testing"
"sigs.k8s.io/kustomize/v3/pkg/fs"
)
func TestFix(t *testing.T) {
fakeFS := fs.MakeFakeFS()
fakeFS.WriteTestKustomizationWith([]byte(`nameprefix: some-prefix-`))
cmd := NewCmdFix(fakeFS)
err := cmd.RunE(cmd, nil)
if err != nil {
t.Errorf("unexpected cmd error: %v", err)
}
content, err := fakeFS.ReadTestKustomization()
if err != nil {
t.Errorf("unexpected read error: %v", err)
}
if !strings.Contains(string(content), "apiVersion: ") {
t.Errorf("expected apiVersion in kustomization")
}
if !strings.Contains(string(content), "kind: Kustomization") {
t.Errorf("expected kind in kustomization")
}
}