Add App.WithFileSystem

Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
This commit is contained in:
toyamagu-2021 2026-06-13 23:47:17 +09:00 committed by yxxhero
parent f8a7ec2e6f
commit a279ee710a
2 changed files with 16 additions and 0 deletions

View File

@ -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()

View File

@ -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)
}