From 0daba2c3c7afdf3112d4c493b9ec38841ee94ba1 Mon Sep 17 00:00:00 2001 From: Ivan Pedrazas Date: Mon, 12 Dec 2016 14:41:54 +0000 Subject: [PATCH] remove debug from test --- plugin_test.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/plugin_test.go b/plugin_test.go index b62fe9c..19d884a 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -1,7 +1,8 @@ package main import ( - "fmt" + "io/ioutil" + "strings" "testing" ) @@ -21,7 +22,20 @@ func TestInitialiseKubeconfig(t *testing.T) { }, } - initialiseKubeconfig(&plugin.Config, "kubeconfig", "config3.test") + configfile := "config3.test" + initialiseKubeconfig(&plugin.Config, "kubeconfig", configfile) + data, err := ioutil.ReadFile(configfile) + if err != nil { + t.Errorf("Error reading file %v", err) + } + kubeConfigStr := string(data) + + if !strings.Contains(kubeConfigStr, "secret-token") { + t.Errorf("Kubeconfig doesn't render token") + } + if !strings.Contains(kubeConfigStr, "http://myapiserver") { + t.Errorf("Kubeconfig doesn't render APIServer") + } } @@ -40,6 +54,9 @@ func TestGetHelmCommand(t *testing.T) { }, } setHelmCommand(plugin) - fmt.Println(plugin.Config.HelmCommand) - + res := strings.Join(plugin.Config.HelmCommand[:], " ") + expected := "upgrade --install test-release ./chart/test --debug --dry-run" + if res != expected { + t.Errorf("Result is %s and we expected %s", res, expected) + } }