|
|
@ -43,22 +43,20 @@ func TestInitCmd(t *testing.T) {
|
|
|
|
defer os.Remove(home)
|
|
|
|
defer os.Remove(home)
|
|
|
|
|
|
|
|
|
|
|
|
var buf bytes.Buffer
|
|
|
|
var buf bytes.Buffer
|
|
|
|
|
|
|
|
fc := fake.NewSimpleClientset()
|
|
|
|
fake := testclient.Fake{}
|
|
|
|
|
|
|
|
cmd := &initCmd{
|
|
|
|
cmd := &initCmd{
|
|
|
|
out: &buf,
|
|
|
|
out: &buf,
|
|
|
|
home: helmpath.Home(home),
|
|
|
|
home: helmpath.Home(home),
|
|
|
|
kubeClient: fake.Extensions(),
|
|
|
|
kubeClient: fc.Extensions(),
|
|
|
|
|
|
|
|
namespace: api.NamespaceDefault,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := cmd.run(); err != nil {
|
|
|
|
if err := cmd.run(); err != nil {
|
|
|
|
t.Errorf("expected error: %v", err)
|
|
|
|
t.Errorf("expected error: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
action := fc.Actions()[0]
|
|
|
|
actions := fake.Actions()
|
|
|
|
if !action.Matches("create", "deployments") {
|
|
|
|
if action, ok := actions[0].(testclient.CreateAction); !ok || action.GetResource() != "deployments" {
|
|
|
|
t.Errorf("unexpected action: %v, expected create deployment", action)
|
|
|
|
t.Errorf("unexpected action: %v, expected create deployment", actions[0])
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expected := "Tiller (the helm server side component) has been installed into your Kubernetes Cluster."
|
|
|
|
expected := "Tiller (the helm server side component) has been installed into your Kubernetes Cluster."
|
|
|
|
if !strings.Contains(buf.String(), expected) {
|
|
|
|
if !strings.Contains(buf.String(), expected) {
|
|
|
|
t.Errorf("expected %q, got %q", expected, buf.String())
|
|
|
|
t.Errorf("expected %q, got %q", expected, buf.String())
|
|
|
|