mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-25 08:17:02 +00:00
use FakeFileSystem in configmapandsecret tests
This commit is contained in:
@@ -91,7 +91,7 @@ func TestConstructConfigMap(t *testing.T) {
|
||||
input: types.ConfigMapArgs{
|
||||
Name: "envConfigMap",
|
||||
DataSources: types.DataSources{
|
||||
EnvSource: "../../../pkg/examplelayout/simple/instances/exampleinstance/configmap/app.env",
|
||||
EnvSource: "configmap/app.env",
|
||||
},
|
||||
},
|
||||
expected: makeEnvConfigMap("envConfigMap"),
|
||||
@@ -101,7 +101,7 @@ func TestConstructConfigMap(t *testing.T) {
|
||||
input: types.ConfigMapArgs{
|
||||
Name: "fileConfigMap",
|
||||
DataSources: types.DataSources{
|
||||
FileSources: []string{"../../../pkg/examplelayout/simple/instances/exampleinstance/configmap/app-init.ini"},
|
||||
FileSources: []string{"configmap/app-init.ini"},
|
||||
},
|
||||
},
|
||||
expected: makeFileConfigMap("fileConfigMap"),
|
||||
@@ -118,8 +118,9 @@ func TestConstructConfigMap(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: all tests should use a FakeFs
|
||||
fSys := fs.MakeRealFS()
|
||||
fSys := fs.MakeFakeFS()
|
||||
fSys.WriteFile("configmap/app.env", []byte("DB_USERNAME=admin\nDB_PASSWORD=somepw\n"))
|
||||
fSys.WriteFile("configmap/app-init.ini", []byte("FOO=bar\nBAR=baz\n"))
|
||||
f := NewConfigMapFactory(fSys, loader.NewFileLoader(fSys))
|
||||
for _, tc := range testCases {
|
||||
cm, err := f.MakeConfigMap(&tc.input)
|
||||
|
||||
Reference in New Issue
Block a user