templatefile/pkg/templater/files_test.go

29 lines
506 B
Go
Raw Normal View History

package templater
import (
"io/ioutil"
"testing"
)
func TestProcessTemplate(t *testing.T) {
goFile := ConfigFile{
Destination: "/loki-config.test",
Source: "loki-local-config.tpl",
TemplateType: "go",
Mode: "700",
TemplateDir: "../../data/templates/",
}
values, err := ioutil.ReadFile("../../data/config/loki-stack.json")
if err != nil {
t.Error(err)
}
data, err := goFile.ProcessTemplate("/tmp/", values)
if err != nil {
t.Errorf(err.Error())
}
t.Log(data)
}