提交 c7e0d3aa 编写于 作者: M Medya Gh

lint and simplify download_only

上级 eef31403
......@@ -43,41 +43,28 @@ func TestDownloadOnly(t *testing.T) {
if !isTestNoneDriver(t) { // none driver doesnt need to be deleted
defer mk.TearDown(t)
}
minHome := constants.GetMinipath()
t.Run("Oldest", func(t *testing.T) {
mk.StartWithFail("--download-only", fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion))
})
t.Run("Newest", func(t *testing.T) {
v := constants.NewestKubernetesVersion
mk.StartWithFail("--download-only", fmt.Sprintf("--kubernetes-version=%s", v))
// checking binaries downloaded
_, imgs := constants.GetKubeadmCachedImages("", v)
for _, img := range imgs {
_, err := os.Stat(filepath.Join(minHome, fmt.Sprintf("images/%s", img)))
if err != nil {
t.Errorf("error expected download-only to cachne image %q but got error %v", img, err)
}
}
// checking binaries downloaded (kubelet,kubeadm)
for _, bin := range constants.GetKubeadmCachedBinaries() {
_, err := os.Stat(filepath.Join(minHome, fmt.Sprintf("cache/%s/%s", v, bin)))
if err != nil {
t.Errorf("error expected download-only to cachne binary %q but got error %v", bin, err)
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 to
_, imgs := constants.GetKubeadmCachedImages("", v)
for _, img := range imgs {
_, err := os.Stat(filepath.Join(minHome, fmt.Sprintf("images/%s", img)))
if err != nil {
t.Errorf("error expected download-only to cachne image %q but got error %v", img, err)
}
}
}
// checking binaries downloaded
for _, bin := range []string{"kublet,kbueadm"} {
_, err := os.Stat(filepath.Join(minHome, fmt.Sprintf("cache/%s/%s", v, bin)))
if err != nil {
t.Errorf("error expected download-only to cachne binary %q but got error %v", bin, err)
// checking binaries downloaded (kubelet,kubeadm)
for _, bin := range constants.GetKubeadmCachedBinaries() {
_, err := os.Stat(filepath.Join(minHome, fmt.Sprintf("cache/%s/%s", v, bin)))
if err != nil {
t.Errorf("error expected download-only to cachne binary %q but got error %v", bin, err)
}
}
}
})
// this downloads the latest published binary from where we publish the minikube binary
......
......@@ -48,9 +48,6 @@ func TestNone(t *testing.T) {
mk := NewMinikubeRunner(t, p, "--wait=false")
mk.RunCommand("delete", false)
stdout, stderr := mk.StartWithFail()
if err != nil {
t.Fatalf("failed to start minikube (for profile %s) failed : %v\nstdout: %s\nstderr: %s", p, err, stdout, stderr)
}
msg := "Configuring local host environment"
if !strings.Contains(stdout, msg) {
t.Errorf("Expected: stdout to contain %q, got: %s", msg, stdout)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册