mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 06:02:58 +02:00
Add App.WithFileSystem (#2638)
Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
This commit is contained in:
@@ -103,6 +103,12 @@ func New(conf ConfigProvider) *App {
|
||||
})
|
||||
}
|
||||
|
||||
// WithFileSystem swaps the FileSystem this App reads through while loading state.
|
||||
func (a *App) WithFileSystem(fs *filesystem.FileSystem) *App {
|
||||
a.fs = fs
|
||||
return a
|
||||
}
|
||||
|
||||
func Init(app *App) *App {
|
||||
var err error
|
||||
app.valsRuntime, err = plugins.ValsInstance()
|
||||
|
||||
@@ -48,6 +48,16 @@ func injectFs(app *App, fs *testhelper.TestFs) *App {
|
||||
return app
|
||||
}
|
||||
|
||||
func TestAppWithFileSystem(t *testing.T) {
|
||||
app := &App{}
|
||||
fs := ffs.DefaultFileSystem()
|
||||
|
||||
got := app.WithFileSystem(fs)
|
||||
|
||||
require.Same(t, app, got)
|
||||
require.Same(t, fs, app.fs)
|
||||
}
|
||||
|
||||
func expectNoCallsToHelm(app *App) {
|
||||
expectNoCallsToHelmVersion(app)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user