You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helm/cmd/tiller/environment/environment_test.go

33 lines
727 B

package environment
import (
"testing"
"github.com/deis/tiller/pkg/hapi"
)
type mockEngine struct {
out []byte
}
func (e *mockEngine) Render(chrt *hapi.Chart, v *hapi.Values) ([]byte, error) {
return e.out, nil
}
var _ Engine = &mockEngine{}
func TestEngine(t *testing.T) {
eng := &mockEngine{out: []byte("test")}
env := New()
env.EngineYard = EngineYard(map[string]Engine{"test": eng})
if engine, ok := env.EngineYard.Get("test"); !ok {
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))
}
}