mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-09 21:49:57 +00:00
33 lines
748 B
Go
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")
|
|
}
|
|
}
|