예제 #1
0
파일: environment.go 프로젝트: gabrtv/helm
// New returns an environment initialized with the defaults.
func New() *Environment {
	e := engine.New()
	var ey EngineYard = map[string]Engine{
		// Currently, the only template engine we support is the GoTpl one. But
		// we can easily add some here.
		GoTplEngine: e,
	}
	return &Environment{
		Namespace:  DefaultNamespace,
		EngineYard: ey,
		Releases:   storage.NewMemory(),
		KubeClient: kube.New(nil), //&PrintingKubeClient{Out: os.Stdout},
	}
}
예제 #2
0
func mockEnvironment() *environment.Environment {
	e := environment.New()
	e.Releases = storage.NewMemory()
	e.KubeClient = &environment.PrintingKubeClient{Out: os.Stdout}
	return e
}
예제 #3
0
*/

package main

import (
	"testing"

	"k8s.io/helm/cmd/tiller/environment"
	"k8s.io/helm/pkg/engine"
	"k8s.io/helm/pkg/storage"
)

// These are canary tests to make sure that the default server actually
// fulfills its requirements.
var _ environment.Engine = &engine.Engine{}
var _ environment.ReleaseStorage = storage.NewMemory()

func TestInit(t *testing.T) {
	defer func() {
		if recover() != nil {
			t.Fatalf("Panic trapped. Check EngineYard.Default()")
		}
	}()

	// This will panic if it is not correct.
	env.EngineYard.Default()

	e, ok := env.EngineYard.Get(environment.GoTplEngine)
	if !ok {
		t.Fatalf("Could not find GoTplEngine")
	}