summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/container.go')
-rw-r--r--extras/hs-test/container.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 5def2789528..40dc0828376 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"strings"
+ "text/template"
"github.com/edwarnicke/exechelper"
)
@@ -301,3 +302,19 @@ func (c *Container) stop() error {
c.saveLogs()
return exechelper.Run("docker stop " + c.name + " -t 0")
}
+
+func (c *Container) createConfig(targetConfigName string, templateName string, values any) {
+ template := template.Must(template.ParseFiles(templateName))
+
+ f, err := os.CreateTemp("/tmp/hs-test/", "hst-config")
+ c.Suite().assertNil(err)
+ defer os.Remove(f.Name())
+
+ err = template.Execute(f, values)
+ c.Suite().assertNil(err)
+
+ err = f.Close()
+ c.Suite().assertNil(err)
+
+ c.copy(f.Name(), targetConfigName)
+}