mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-07 13:58:58 +02:00
Introduce Helmfile's own filesystem abstraction to correctly unit test some components (#307)
Use abstracted FS Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com> Signed-off-by: Arkaitz Jimenez <arkaitzj@gmail.com>
This commit is contained in:
+6
-9
@@ -1,12 +1,13 @@
|
||||
package tmpl
|
||||
|
||||
import "io/fs"
|
||||
import (
|
||||
"github.com/helmfile/helmfile/pkg/filesystem"
|
||||
)
|
||||
|
||||
type Context struct {
|
||||
preRender bool
|
||||
basePath string
|
||||
readFile func(string) ([]byte, error)
|
||||
readDir func(string) ([]fs.DirEntry, error)
|
||||
fs *filesystem.FileSystem
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for the template
|
||||
@@ -14,10 +15,6 @@ func (c *Context) SetBasePath(path string) {
|
||||
c.basePath = path
|
||||
}
|
||||
|
||||
func (c *Context) SetReadFile(f func(string) ([]byte, error)) {
|
||||
c.readFile = f
|
||||
}
|
||||
|
||||
func (c *Context) SetReadDir(f func(string) ([]fs.DirEntry, error)) {
|
||||
c.readDir = f
|
||||
func (c *Context) SetFileSystem(fs *filesystem.FileSystem) {
|
||||
c.fs = fs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user