Skip to content

Commit

Permalink
structure change for cluster config func
Browse files Browse the repository at this point in the history
  • Loading branch information
ShwethaKumbla committed May 20, 2021
1 parent 031cd5c commit 0671cfa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion klient/klient.go → klient/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package klient
package conf

import (
"flag"
Expand Down
11 changes: 7 additions & 4 deletions klient/klient_test.go → klient/conf/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package klient
package conf

import (
"flag"
"os"
"path/filepath"
"testing"

"k8s.io/client-go/util/homedir"
)

var kubeconfig string
Expand All @@ -29,13 +31,14 @@ func init() {
}

func TestResolveKubeConfigFile(t *testing.T) {
flag.Set("kubeconfig", os.Getenv("HOME")+"/.kube/config")
home := homedir.HomeDir()
flag.Set("kubeconfig", filepath.Join(home, ".kube", "config"))

flag.Parse()

filename := ResolveKubeConfigFile()

if filename != os.Getenv("HOME")+"/.kube/config" {
if filename != filepath.Join(home, ".kube", "config") {
t.Errorf("unexpected config path: %s", filename)
}

Expand Down

0 comments on commit 0671cfa

Please sign in to comment.