mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Make new nesting place for generated builtin code.
This commit is contained in:
37
api/plugins/builtinconfig/loaddefaultconfig_test.go
Normal file
37
api/plugins/builtinconfig/loaddefaultconfig_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package builtinconfig
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/v3/api/internal/loadertest"
|
||||
"sigs.k8s.io/kustomize/v3/api/resid"
|
||||
"sigs.k8s.io/kustomize/v3/api/types"
|
||||
)
|
||||
|
||||
func TestLoadDefaultConfigsFromFiles(t *testing.T) {
|
||||
ldr := loadertest.NewFakeLoader("/app")
|
||||
ldr.AddFile("/app/config.yaml", []byte(`
|
||||
namePrefix:
|
||||
- path: nameprefix/path
|
||||
kind: SomeKind
|
||||
`))
|
||||
tcfg, err := loadDefaultConfig(ldr, []string{"/app/config.yaml"})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
expected := &TransformerConfig{
|
||||
NamePrefix: []types.FieldSpec{
|
||||
{
|
||||
Gvk: resid.Gvk{Kind: "SomeKind"},
|
||||
Path: "nameprefix/path",
|
||||
},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(tcfg, expected) {
|
||||
t.Fatalf("expected %v\n but go6t %v\n", expected, tcfg)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user