mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 18:01:21 +00:00
More tests, better errors.
This commit is contained in:
@@ -80,8 +80,6 @@ func NewCmdBuild(out io.Writer) *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
const CWD = "."
|
||||
|
||||
// Validate validates build command.
|
||||
func (o *Options) Validate(args []string) (err error) {
|
||||
if len(args) > 1 {
|
||||
@@ -90,7 +88,7 @@ func (o *Options) Validate(args []string) (err error) {
|
||||
konfig.DefaultKustomizationFileName())
|
||||
}
|
||||
if len(args) == 0 {
|
||||
o.kustomizationPath = CWD
|
||||
o.kustomizationPath = filesys.SelfDir
|
||||
} else {
|
||||
o.kustomizationPath = args[0]
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package build
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/filesys"
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
)
|
||||
|
||||
@@ -22,7 +23,7 @@ func TestBuildValidate(t *testing.T) {
|
||||
path string
|
||||
erMsg string
|
||||
}{
|
||||
{"noargs", []string{}, ".", ""},
|
||||
{"noargs", []string{}, filesys.SelfDir, ""},
|
||||
{"file", []string{"beans"}, "beans", ""},
|
||||
{"path", []string{"a/b/c"}, "a/b/c", ""},
|
||||
{"path", []string{"too", "many"},
|
||||
|
||||
@@ -31,7 +31,7 @@ type createFlags struct {
|
||||
|
||||
// NewCmdCreate returns an instance of 'create' subcommand.
|
||||
func NewCmdCreate(fSys filesys.FileSystem, uf ifc.KunstructuredFactory) *cobra.Command {
|
||||
opts := createFlags{path: "."}
|
||||
opts := createFlags{path: filesys.SelfDir}
|
||||
c := &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create a new kustomization in the current directory",
|
||||
|
||||
Reference in New Issue
Block a user