address comments

pull/564/head
Jingfang Liu 2019-02-26 13:53:56 -08:00
parent f55d87ab61
commit 127c2f1e74
3 changed files with 9 additions and 4 deletions

View File

@ -140,7 +140,7 @@ func (o *FilenameOptions) validate() []error {
errs = append(errs, fmt.Errorf("only one of -f or -k can be specified"))
}
if len(o.Kustomize) > 0 && o.Recursive {
errs = append(errs, fmt.Errorf("-R is not allowed to work with -k"))
errs = append(errs, fmt.Errorf("the -k flag can't be used with -f or -R"))
}
return errs
}

View File

@ -392,7 +392,7 @@ func TestFilenameOptionsValidate(t *testing.T) {
kustomize: "dir",
recursive: true,
errExp: true,
msgExp: "-R is not allowed to work with -k",
msgExp: "the -k flag can't be used with -f or -R",
},
{
filenames: []string{"file"},
@ -673,6 +673,11 @@ func TestKustomizeDirectoryBuilder(t *testing.T) {
expectErr: false,
expectedNames: []string{"test-the-map", "test-the-deployment", "test-the-service"},
},
{
directory: filepath.Join(dir, "kustomization.yaml"),
expectErr: true,
errMsg: "must be a directory to be a root",
},
{
directory: "../../../artifacts/kustomization/should-not-load.yaml",
expectErr: true,

View File

@ -229,7 +229,7 @@ __EOF__
kube::test::get_object_assert 'deployment test-the-deployment' "{{${id_field}}}" 'test-the-deployment'
kube::test::get_object_assert 'service test-the-service' "{{${id_field}}}" 'test-the-service'
# cleanup
kubectl delete configmap/test-the-map deployment/test-the-deployment service/test-the-service
kubectl delete -k hack/testdata/kustomize
## kubectl apply --kustomize somedir
kubectl apply --kustomize hack/testdata/kustomize
@ -237,7 +237,7 @@ __EOF__
kube::test::get_object_assert 'deployment test-the-deployment' "{{${id_field}}}" 'test-the-deployment'
kube::test::get_object_assert 'service test-the-service' "{{${id_field}}}" 'test-the-service'
# cleanup
kubectl delete -k hack/testdata/kustomize
kubectl delete --kustomize hack/testdata/kustomize
set +o nounset
set +o errexit