skip cache imge test for none

pull/5150/head
Medya Gh 2019-08-21 10:19:02 -07:00
parent b3c9eea3d8
commit 8796539112
1 changed files with 26 additions and 21 deletions

View File

@ -44,31 +44,36 @@ func TestDownloadOnly(t *testing.T) {
if !isTestNoneDriver(t) { // none driver doesnt need to be deleted
defer mk.TearDown(t)
}
t.Run("OldestNewest", func(t *testing.T) {
minHome := constants.GetMinipath()
for _, v := range []string{constants.OldestKubernetesVersion, constants.NewestKubernetesVersion} {
mk.StartWithFail("--download-only", fmt.Sprintf("--kubernetes-version=%s", v))
// checking if cached images are downloaded for example (kube-apiserver_v1.15.2, kube-scheduler_v1.15.2, ...)
_, imgs := constants.GetKubeadmCachedImages("", v)
for _, img := range imgs {
img = strings.Replace(img, ":", "_", 1) // for example kube-scheduler:v1.15.2 --> kube-scheduler_v1.15.2
fp := filepath.Join(minHome, "cache", "images", img)
_, err := os.Stat(fp)
if err != nil {
t.Errorf("expected image file exist at %q but got error: %v", fp, err)
}
t.Run("group", func(t *testing.T) {
t.Run("CacheOldestNewest", func(t *testing.T) {
if !isTestNoneDriver(t) { // don't cache images
t.Skip("skipping test for none driver as it doesn't cache images")
}
// checking binaries downloaded (kubelet,kubeadm)
for _, bin := range constants.GetKubeadmCachedBinaries() {
fp := filepath.Join(minHome, "cache", v, bin)
_, err := os.Stat(fp)
if err != nil {
t.Errorf("expected the file for binary exist at %q but got error %v", fp, err)
minHome := constants.GetMinipath()
for _, v := range []string{constants.OldestKubernetesVersion, constants.NewestKubernetesVersion} {
mk.StartWithFail("--download-only", fmt.Sprintf("--kubernetes-version=%s", v))
// checking if cached images are downloaded for example (kube-apiserver_v1.15.2, kube-scheduler_v1.15.2, ...)
_, imgs := constants.GetKubeadmCachedImages("", v)
for _, img := range imgs {
img = strings.Replace(img, ":", "_", 1) // for example kube-scheduler:v1.15.2 --> kube-scheduler_v1.15.2
fp := filepath.Join(minHome, "cache", "images", img)
_, err := os.Stat(fp)
if err != nil {
t.Errorf("expected image file exist at %q but got error: %v", fp, err)
}
}
// checking binaries downloaded (kubelet,kubeadm)
for _, bin := range constants.GetKubeadmCachedBinaries() {
fp := filepath.Join(minHome, "cache", v, bin)
_, err := os.Stat(fp)
if err != nil {
t.Errorf("expected the file for binary exist at %q but got error %v", fp, err)
}
}
}
}
})
})
// this downloads the latest published binary from where we publish the minikube binary