github.com/strongmonkey/helm@v2.7.2+incompatible/pkg/helm/helmpath/helmhome_unix_test.go (about)

     1  // Copyright 2016 The Kubernetes Authors All rights reserved.
     2  // Licensed under the Apache License, Version 2.0 (the "License");
     3  // you may not use this file except in compliance with the License.
     4  // You may obtain a copy of the License at
     5  //
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
    15  // +build !windows
    16  
    17  package helmpath
    18  
    19  import (
    20  	"runtime"
    21  	"testing"
    22  )
    23  
    24  func TestHelmHome(t *testing.T) {
    25  	hh := Home("/r")
    26  	isEq := func(t *testing.T, a, b string) {
    27  		if a != b {
    28  			t.Error(runtime.GOOS)
    29  			t.Errorf("Expected %q, got %q", a, b)
    30  		}
    31  	}
    32  
    33  	isEq(t, hh.String(), "/r")
    34  	isEq(t, hh.Repository(), "/r/repository")
    35  	isEq(t, hh.RepositoryFile(), "/r/repository/repositories.yaml")
    36  	isEq(t, hh.LocalRepository(), "/r/repository/local")
    37  	isEq(t, hh.Cache(), "/r/repository/cache")
    38  	isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml")
    39  	isEq(t, hh.Starters(), "/r/starters")
    40  	isEq(t, hh.Archive(), "/r/cache/archive")
    41  }
    42  
    43  func TestHelmHome_expand(t *testing.T) {
    44  	if Home("$HOME").String() == "$HOME" {
    45  		t.Error("expected variable expansion")
    46  	}
    47  }