diff --git a/cmd/options/options_test.go b/cmd/options/options_test.go index b5255af5..2ee69e0f 100644 --- a/cmd/options/options_test.go +++ b/cmd/options/options_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 The Kubernetes Authors. + +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 options import ( @@ -13,7 +29,7 @@ type Options struct { HostnameOverride string } -//TestSetNodeNameOrDie tests for permutations of nodename, hostname and hostnameoverride +// TestSetNodeNameOrDie tests for permutations of nodename, hostname and hostnameoverride func TestSetNodeNameOrDie(t *testing.T) { options := map[string]struct { Expected Options @@ -88,11 +104,11 @@ func TestSetNodeNameOrDie(t *testing.T) { } if opt.Expected.Hostname != "" { - //Changing hostname + // Changing hostname cmd := exec.Command("hostname", opt.Expected.Hostname) _, err := cmd.CombinedOutput() if err != nil { - //If changing hostname requires admin privilege + // If changing hostname requires admin privilege cmd = exec.Command("sudo", "hostname", opt.Expected.Hostname) _, err := cmd.CombinedOutput() if err != nil { @@ -120,7 +136,7 @@ func TestSetNodeNameOrDie(t *testing.T) { } } - + // Setting back the original attributes err = os.Setenv("NODE_NAME", orig_node_name) if err != nil { fmt.Println("Unable to set original : env NODE_NAME")