From 97f04723313d18eb98f48e186daa46158b716e51 Mon Sep 17 00:00:00 2001 From: Himanshu Pandey Date: Wed, 15 May 2019 14:55:40 -0700 Subject: [PATCH 1/4] Added test case for minikube config unset --- cmd/minikube/cmd/config/unset_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmd/minikube/cmd/config/unset_test.go diff --git a/cmd/minikube/cmd/config/unset_test.go b/cmd/minikube/cmd/config/unset_test.go new file mode 100644 index 000000000000..1c2be13de395 --- /dev/null +++ b/cmd/minikube/cmd/config/unset_test.go @@ -0,0 +1,27 @@ +/* +Copyright 2019 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import "testing" + +func TestUnsetConfig(t *testing.T) { + err := Set("dashboard", "true") + err = unset("dashboard") + if err != nil { + t.Fatalf("Failed to unset property ") + } +} From c991fe576b2447688193485cc55f4a7316f98acf Mon Sep 17 00:00:00 2001 From: Himanshu Pandey Date: Wed, 15 May 2019 16:05:03 -0700 Subject: [PATCH 2/4] Replaced Fatalf with Errorf --- cmd/minikube/cmd/config/unset_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/minikube/cmd/config/unset_test.go b/cmd/minikube/cmd/config/unset_test.go index 1c2be13de395..0ddbbf51bcbf 100644 --- a/cmd/minikube/cmd/config/unset_test.go +++ b/cmd/minikube/cmd/config/unset_test.go @@ -19,9 +19,14 @@ package config import "testing" func TestUnsetConfig(t *testing.T) { - err := Set("dashboard", "true") - err = unset("dashboard") + propName := "dashboard" + propValue := "true" + err := Set(propName, propValue) if err != nil { - t.Fatalf("Failed to unset property ") + t.Errorf("Failed to set the propert %q", propName) + } + err = unset(propName) + if err != nil { + t.Errorf("Failed to unset property ") } } From 7d3b4036a9b85aecbd5b3b3eb6bc72d0d89f7aa8 Mon Sep 17 00:00:00 2001 From: Himanshu Pandey Date: Thu, 16 May 2019 13:39:21 -0700 Subject: [PATCH 3/4] Minor Formatting changes --- cmd/minikube/cmd/config/unset_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/minikube/cmd/config/unset_test.go b/cmd/minikube/cmd/config/unset_test.go index 0ddbbf51bcbf..506c40d3e462 100644 --- a/cmd/minikube/cmd/config/unset_test.go +++ b/cmd/minikube/cmd/config/unset_test.go @@ -23,10 +23,10 @@ func TestUnsetConfig(t *testing.T) { propValue := "true" err := Set(propName, propValue) if err != nil { - t.Errorf("Failed to set the propert %q", propName) + t.Errorf("Failed to set the property %q", propName) } err = unset(propName) if err != nil { - t.Errorf("Failed to unset property ") + t.Errorf("Failed to unset property") } } From 57db3e9d3947cec39d4eec61a164f6e17ea9f8e5 Mon Sep 17 00:00:00 2001 From: Himanshu Pandey Date: Wed, 22 May 2019 13:43:30 -0700 Subject: [PATCH 4/4] Replaced dashboard with cpus in the test case --- cmd/minikube/cmd/config/unset_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/minikube/cmd/config/unset_test.go b/cmd/minikube/cmd/config/unset_test.go index 506c40d3e462..07f3aebbbf5f 100644 --- a/cmd/minikube/cmd/config/unset_test.go +++ b/cmd/minikube/cmd/config/unset_test.go @@ -19,14 +19,14 @@ package config import "testing" func TestUnsetConfig(t *testing.T) { - propName := "dashboard" - propValue := "true" + propName := "cpus" + propValue := "1" err := Set(propName, propValue) if err != nil { t.Errorf("Failed to set the property %q", propName) } err = unset(propName) if err != nil { - t.Errorf("Failed to unset property") + t.Errorf("Failed to unset property %q", err) } }