mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-01 18:30:15 +00:00
add builtin files plugin
This commit is contained in:
58
pkg/target/builtinplugins_test.go
Normal file
58
pkg/target/builtinplugins_test.go
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package target_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuiltinPlugins(t *testing.T) {
|
||||
th := NewKustTestHarness(t, "/app")
|
||||
th.writeK("/app", `
|
||||
secretGenerator:
|
||||
- name: bob
|
||||
kvSources:
|
||||
- pluginType: builtin
|
||||
name: literals
|
||||
args:
|
||||
- FRUIT=apple
|
||||
- VEGETABLE=carrot
|
||||
- pluginType: builtin
|
||||
name: files
|
||||
args:
|
||||
- foo.env
|
||||
`)
|
||||
th.writeF("/app/foo.env", `
|
||||
MOUNTAIN=everest
|
||||
OCEAN=pacific
|
||||
`)
|
||||
m, err := th.makeKustTarget().MakeCustomizedResMap()
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.assertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
FRUIT: YXBwbGU=
|
||||
VEGETABLE: Y2Fycm90
|
||||
foo.env: Ck1PVU5UQUlOPWV2ZXJlc3QKT0NFQU49cGFjaWZpYwo=
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: bob-hhdkd5cbt9
|
||||
type: Opaque
|
||||
`)
|
||||
}
|
||||
@@ -240,31 +240,3 @@ metadata:
|
||||
name: p2-com2-c4b8md75k9
|
||||
`)
|
||||
}
|
||||
|
||||
func TestGeneratorPlugins(t *testing.T) {
|
||||
th := NewKustTestHarness(t, "/app")
|
||||
th.writeK("/app", `
|
||||
secretGenerator:
|
||||
- name: bob
|
||||
kvSources:
|
||||
- pluginType: builtin
|
||||
name: literals
|
||||
args:
|
||||
- FRUIT=apple
|
||||
- VEGETABLE=carrot
|
||||
`)
|
||||
m, err := th.makeKustTarget().MakeCustomizedResMap()
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
th.assertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
FRUIT: YXBwbGU=
|
||||
VEGETABLE: Y2Fycm90
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: bob-bgtct8h699
|
||||
type: Opaque
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user