mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix(tiller): change environment.Engine signature
This commit is contained in:
parent
fa387494fb
commit
913905a54f
3 changed files with 13 additions and 6 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue