Initial commit: AetherForge Linux (forge-mesh) v0.1.0-dev
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
This commit is contained in:
29
internal/api/handlers/install_tmpl_test.go
Normal file
29
internal/api/handlers/install_tmpl_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func TestInstallTemplateExecute(t *testing.T) {
|
||||
root, _ := filepath.Abs(filepath.Join("..", "..", ".."))
|
||||
tmplPath := filepath.Join(root, "scripts", "install.sh.tpl")
|
||||
b, err := os.ReadFile(tmplPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tmpl, err := template.New("install.sh").Parse(string(b))
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
data := installData{
|
||||
DeckURL: "http://localhost:8989", PublicKey: "abc", FleetSecret: "sec",
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
if err := tmpl.Execute(&buf, data); err != nil {
|
||||
t.Fatalf("execute: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user