Add App.WithFileSystem
Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
This commit is contained in:
parent
f8a7ec2e6f
commit
a279ee710a
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue