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:
Arkaitz Jimenez
2022-08-24 12:58:43 +09:00
committed by GitHub
parent a626664f46
commit cc33e7b7d8
44 changed files with 513 additions and 425 deletions
+4 -3
View File
@@ -1,10 +1,11 @@
package tmpl
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/helmfile/helmfile/pkg/filesystem"
)
// TestTextRenderer tests the text renderer.
@@ -12,7 +13,7 @@ func TestNewTextRenderer(t *testing.T) {
tData := map[string]interface{}{
"foo": "bar",
}
tr := NewTextRenderer(os.ReadFile, ".", tData)
tr := NewTextRenderer(filesystem.DefaultFileSystem(), ".", tData)
require.Equal(t, tData, tr.Data)
require.Equal(t, ".", tr.Context.basePath)
}
@@ -22,7 +23,7 @@ func TestTextRender(t *testing.T) {
tData := map[string]interface{}{
"foot": "bart",
}
tr := NewTextRenderer(os.ReadFile, ".", tData)
tr := NewTextRenderer(filesystem.DefaultFileSystem(), ".", tData)
tests := []struct {
text string