Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
26de1467
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26de1467
编写于
3月 02, 2020
作者:
P
Priya Wadhwa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add integration test for docker download only
上级
05a46f65
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
4 deletion
+60
-4
pkg/minikube/preload/preload.go
pkg/minikube/preload/preload.go
+4
-4
test/integration/aaa_download_only_test.go
test/integration/aaa_download_only_test.go
+56
-0
未找到文件。
pkg/minikube/preload/preload.go
浏览文件 @
26de1467
...
...
@@ -52,8 +52,8 @@ func targetDir() string {
return
localpath
.
MakeMiniPath
(
"cache"
,
"preloaded-tarball"
)
}
// returns path to checksum file
func
c
hecksumFilepath
(
k8sVersion
string
)
string
{
//
ChecksumFilepath
returns path to checksum file
func
C
hecksumFilepath
(
k8sVersion
string
)
string
{
return
path
.
Join
(
targetDir
(),
checksumName
(
k8sVersion
))
}
...
...
@@ -123,7 +123,7 @@ func saveChecksumFile(k8sVersion string) error {
return
errors
.
Wrap
(
err
,
"getting storage object"
)
}
checksum
:=
attrs
.
MD5
return
ioutil
.
WriteFile
(
c
hecksumFilepath
(
k8sVersion
),
checksum
,
0644
)
return
ioutil
.
WriteFile
(
C
hecksumFilepath
(
k8sVersion
),
checksum
,
0644
)
}
// verifyChecksum returns true if the checksum of the local binary matches
...
...
@@ -136,7 +136,7 @@ func verifyChecksum(k8sVersion string) error {
}
checksum
:=
md5
.
Sum
(
contents
)
remoteChecksum
,
err
:=
ioutil
.
ReadFile
(
c
hecksumFilepath
(
k8sVersion
))
remoteChecksum
,
err
:=
ioutil
.
ReadFile
(
C
hecksumFilepath
(
k8sVersion
))
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"reading checksum file"
)
}
...
...
test/integration/aaa_download_only_test.go
浏览文件 @
26de1467
...
...
@@ -20,19 +20,26 @@ package integration
import
(
"context"
"crypto/md5"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/daemon"
"k8s.io/minikube/pkg/drivers/kic"
"k8s.io/minikube/pkg/minikube/bootstrapper/images"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/preload"
)
func
TestDownloadOnly
(
t
*
testing
.
T
)
{
...
...
@@ -160,3 +167,52 @@ func TestDownloadOnly(t *testing.T) {
})
}
func
TestDownloadOnlyDocker
(
t
*
testing
.
T
)
{
if
!
runningDockerDriver
(
StartArgs
())
{
t
.
Skip
(
"this test only runs with the docker driver"
)
}
profile
:=
UniqueProfileName
(
"download-docker"
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
15
*
time
.
Minute
)
defer
Cleanup
(
t
,
profile
,
cancel
)
args
:=
[]
string
{
"start"
,
"--download-only"
,
"-p"
,
profile
,
"--force"
,
"--alsologtostderr"
,
"--vm-driver=docker"
}
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
args
...
))
if
err
!=
nil
{
t
.
Errorf
(
"%s failed: %v:
\n
%s"
,
args
,
err
,
rr
.
Output
())
}
// Make sure the preloaded image tarball exists
tarball
:=
preload
.
TarballFilepath
(
constants
.
DefaultKubernetesVersion
)
contents
,
err
:=
ioutil
.
ReadFile
(
tarball
)
if
err
!=
nil
{
t
.
Errorf
(
"reading tarball: %v"
,
err
)
}
// Make sure it has the correct checksum
checksum
:=
md5
.
Sum
(
contents
)
remoteChecksum
,
err
:=
ioutil
.
ReadFile
(
preload
.
ChecksumFilepath
(
constants
.
DefaultKubernetesVersion
))
if
err
!=
nil
{
t
.
Errorf
(
"reading checksum file: %v"
,
err
)
}
if
string
(
remoteChecksum
)
!=
string
(
checksum
[
:
])
{
t
.
Errorf
(
"checksum of %s does not match remote checksum (%s != %s)"
,
tarball
,
string
(
remoteChecksum
),
string
(
checksum
[
:
]))
}
// Make sure this image exists in the docker daemon
ref
,
err
:=
name
.
ParseReference
(
kic
.
BaseImage
)
if
err
!=
nil
{
t
.
Errorf
(
"parsing reference failed: %v"
,
err
)
}
if
_
,
err
:=
daemon
.
Image
(
ref
);
err
!=
nil
{
t
.
Errorf
(
"expected image does not exist in local daemon: %v"
,
err
)
}
}
func
runningDockerDriver
(
startArgs
[]
string
)
bool
{
for
_
,
s
:=
range
startArgs
{
if
s
==
"--vm-driver=docker"
{
return
true
}
}
return
false
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录