more/changed tests

Signed-off-by: Christopher A. Stelma <stelminator@gmail.com>
pull/5422/head
Christopher A. Stelma 7 years ago
parent 92e375ab33
commit 1f398a59f5

@ -18,6 +18,7 @@ package installer // import "k8s.io/helm/cmd/helm/installer"
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"
@ -104,28 +105,28 @@ func TestEnsureHome(t *testing.T) {
}
foundStable := false
stableCachePath := fmt.Sprintf("%s-index.yaml", stableRepository)
foundLocal := false
localCachePath := fmt.Sprintf("%s-index.yaml", LocalRepository)
for _, rr := range rf.Repositories {
if rr.Name == stableRepository {
foundStable = true
if err != nil {
t.Error(err)
}
if filepath.IsAbs(rr.Cache) {
t.Errorf("%s stable repo cache path is an absolute path", rr.Cache)
}
absCache, err := filepath.Abs(filepath.Join(hh.Cache(), rr.Cache))
if err != nil {
t.Error(err)
if rr.Cache != stableCachePath {
t.Errorf("stable repo cache path is %s, not %s", rr.Cache, stableCachePath)
}
if absCache != hh.CacheIndex(stableRepository) {
t.Errorf("%s stable repo cache path doesn't resolve to absolute cache index path", rr.Cache)
foundStable = true
} else if rr.Name == LocalRepository {
if rr.Cache != localCachePath {
t.Errorf("local repo cache path is %s, not %s", rr.Cache, localCachePath)
}
break
foundLocal = true
}
}
if !foundStable {
t.Errorf("stable repo not found")
}
if !foundLocal {
t.Errorf("local repo not found")
}
expectedDirs := []string{hh.String(), hh.Repository(), hh.Cache(), hh.LocalRepository()}
for _, dir := range expectedDirs {

@ -17,6 +17,7 @@ limitations under the License.
package main
import (
"fmt"
"io"
"os"
"testing"
@ -89,6 +90,20 @@ func TestRepoAdd(t *testing.T) {
t.Error(err)
}
foundTestRepo := false
repoCachePath := fmt.Sprintf("%s-index.yaml", testName)
for _, rr := range f.Repositories {
if rr.Name == testName {
if rr.Cache != repoCachePath {
t.Errorf("%s repo cache path is %s, not %s", testName, rr.Cache, repoCachePath)
}
foundTestRepo = true
}
}
if !foundTestRepo {
t.Errorf("%s repo not found", testName)
}
if !f.Has(testName) {
t.Errorf("%s was not successfully inserted into %s", testName, hh.RepositoryFile())
}

Loading…
Cancel
Save