From 586ebdb337d2e936bf40810011d231d644217d4c Mon Sep 17 00:00:00 2001 From: zhengjiajin <393926893@qq.com> Date: Sat, 27 May 2017 22:25:57 +0800 Subject: [PATCH] add error info --- pkg/kubectl/cmd/config/current_context_test.go | 7 +++++-- pkg/kubectl/cmd/config/delete_cluster_test.go | 7 +++++-- pkg/kubectl/cmd/config/delete_context_test.go | 7 +++++-- pkg/kubectl/cmd/config/get_clusters_test.go | 7 +++++-- pkg/kubectl/cmd/config/get_contexts_test.go | 7 +++++-- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pkg/kubectl/cmd/config/current_context_test.go b/pkg/kubectl/cmd/config/current_context_test.go index 1b3f386c24e09..69b466f426311 100644 --- a/pkg/kubectl/cmd/config/current_context_test.go +++ b/pkg/kubectl/cmd/config/current_context_test.go @@ -57,9 +57,12 @@ func TestCurrentContextWithUnsetContext(t *testing.T) { } func (test currentContextTest) run(t *testing.T) { - fakeKubeFile, _ := ioutil.TempFile("", "") + fakeKubeFile, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } defer os.Remove(fakeKubeFile.Name()) - err := clientcmd.WriteToFile(test.startingConfig, fakeKubeFile.Name()) + err = clientcmd.WriteToFile(test.startingConfig, fakeKubeFile.Name()) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/pkg/kubectl/cmd/config/delete_cluster_test.go b/pkg/kubectl/cmd/config/delete_cluster_test.go index 684e47bf795b9..5e7457a68cc52 100644 --- a/pkg/kubectl/cmd/config/delete_cluster_test.go +++ b/pkg/kubectl/cmd/config/delete_cluster_test.go @@ -53,9 +53,12 @@ func TestDeleteCluster(t *testing.T) { } func (test deleteClusterTest) run(t *testing.T) { - fakeKubeFile, _ := ioutil.TempFile("", "") + fakeKubeFile, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } defer os.Remove(fakeKubeFile.Name()) - err := clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) + err = clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/pkg/kubectl/cmd/config/delete_context_test.go b/pkg/kubectl/cmd/config/delete_context_test.go index 36bad7c9fe614..8f7b958264455 100644 --- a/pkg/kubectl/cmd/config/delete_context_test.go +++ b/pkg/kubectl/cmd/config/delete_context_test.go @@ -53,9 +53,12 @@ func TestDeleteContext(t *testing.T) { } func (test deleteContextTest) run(t *testing.T) { - fakeKubeFile, _ := ioutil.TempFile("", "") + fakeKubeFile, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } defer os.Remove(fakeKubeFile.Name()) - err := clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) + err = clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/pkg/kubectl/cmd/config/get_clusters_test.go b/pkg/kubectl/cmd/config/get_clusters_test.go index 4c9d3da892673..9eaf808f0bd26 100644 --- a/pkg/kubectl/cmd/config/get_clusters_test.go +++ b/pkg/kubectl/cmd/config/get_clusters_test.go @@ -57,9 +57,12 @@ func TestGetClustersEmpty(t *testing.T) { } func (test getClustersTest) run(t *testing.T) { - fakeKubeFile, _ := ioutil.TempFile("", "") + fakeKubeFile, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } defer os.Remove(fakeKubeFile.Name()) - err := clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) + err = clientcmd.WriteToFile(test.config, fakeKubeFile.Name()) if err != nil { t.Fatalf("unexpected error: %v", err) } diff --git a/pkg/kubectl/cmd/config/get_contexts_test.go b/pkg/kubectl/cmd/config/get_contexts_test.go index 5a7da24ebb0ba..8d84b7f9a409f 100644 --- a/pkg/kubectl/cmd/config/get_contexts_test.go +++ b/pkg/kubectl/cmd/config/get_contexts_test.go @@ -123,9 +123,12 @@ func TestGetContextsSelectOneOfTwo(t *testing.T) { } func (test getContextsTest) run(t *testing.T) { - fakeKubeFile, _ := ioutil.TempFile("", "") + fakeKubeFile, err := ioutil.TempFile("", "") + if err != nil { + t.Fatalf("unexpected error: %v", err) + } defer os.Remove(fakeKubeFile.Name()) - err := clientcmd.WriteToFile(test.startingConfig, fakeKubeFile.Name()) + err = clientcmd.WriteToFile(test.startingConfig, fakeKubeFile.Name()) if err != nil { t.Fatalf("unexpected error: %v", err) }