Commit 913905a5 authored by Matt Butcher's avatar Matt Butcher

fix(tiller): change environment.Engine signature

parent fa387494
......@@ -17,10 +17,13 @@ func (y EngineYard) Get(k string) (Engine, bool) {
// For some engines, "rendering" includes both compiling and executing. (Other
// engines do not distinguish between phases.)
//
// The engine returns a map where the key is the named output entity (usually
// a file name) and the value is the rendered content of the template.
//
// An Engine must be capable of executing multiple concurrent requests, but
// without tainting one request's environment with data from another request.
type Engine interface {
Render(*hapi.Chart, *hapi.Values) ([]byte, error)
Render(*hapi.Chart, *hapi.Values) (map[string]string, error)
}
// ReleaseStorage represents a storage engine for a Release.
......
......@@ -7,10 +7,10 @@ import (
)
type mockEngine struct {
out []byte
out map[string]string
}
func (e *mockEngine) Render(chrt *hapi.Chart, v *hapi.Values) ([]byte, error) {
func (e *mockEngine) Render(chrt *hapi.Chart, v *hapi.Values) (map[string]string, error) {
return e.out, nil
}
......@@ -39,7 +39,7 @@ var _ ReleaseStorage = &mockReleaseStorage{}
var _ KubeClient = &mockKubeClient{}
func TestEngine(t *testing.T) {
eng := &mockEngine{out: []byte("test")}
eng := &mockEngine{out: map[string]string{"albatross": "test"}}
env := New()
env.EngineYard = EngineYard(map[string]Engine{"test": eng})
......@@ -48,8 +48,8 @@ func TestEngine(t *testing.T) {
t.Errorf("failed to get engine from EngineYard")
} else if out, err := engine.Render(&hapi.Chart{}, &hapi.Values{}); err != nil {
t.Errorf("unexpected template error: %s", err)
} else if string(out) != "test" {
t.Errorf("expected 'test', got %q", string(out))
} else if out["albatross"] != "test" {
t.Errorf("expected 'test', got %q", out["albatross"])
}
}
......
......@@ -4,8 +4,12 @@ import (
"fmt"
"sync"
"testing"
"github.com/deis/tiller/cmd/tiller/environment"
)
var _ environment.Engine = &Engine{}
func TestEngine(t *testing.T) {
e := New()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment