Add App.WithFileSystem (#2638)

Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
This commit is contained in:
toyamagu-2021 (gussan)
2026-06-14 09:27:24 +08:00
committed by GitHub
parent f8a7ec2e6f
commit 6cf02956c2
2 changed files with 16 additions and 0 deletions
+6
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()
+10
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)
}