Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
77ba3e93
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,体验更适合开发者的 AI 搜索 >>
提交
77ba3e93
编写于
3月 26, 2021
作者:
T
Tharun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refractor TestImageExists method
Signed-off-by:
N
Tharun
<
rajendrantharun@live.com
>
上级
82d7fcc6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
9 deletion
+14
-9
pkg/minikube/cruntime/cruntime_test.go
pkg/minikube/cruntime/cruntime_test.go
+14
-9
未找到文件。
pkg/minikube/cruntime/cruntime_test.go
浏览文件 @
77ba3e93
...
...
@@ -63,14 +63,19 @@ func TestImageExists(t *testing.T) {
sha
string
want
bool
}{
{
"docker"
,
"missing"
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
false
},
{
"docker"
,
"image"
,
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
true
},
{
"crio"
,
"missing"
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
false
},
{
"crio"
,
"image"
,
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
true
},
{
"docker"
,
"missing
-image
"
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
false
},
{
"docker"
,
"
available-
image"
,
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
true
},
{
"crio"
,
"missing
-image
"
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
false
},
{
"crio"
,
"
available-
image"
,
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
true
},
}
for
_
,
tc
:=
range
tests
{
runner
:=
NewFakeRunner
(
t
)
runner
.
images
=
map
[
string
]
string
{
"available-image"
:
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
}
t
.
Run
(
tc
.
runtime
,
func
(
t
*
testing
.
T
)
{
r
,
err
:=
New
(
Config
{
Type
:
tc
.
runtime
,
Runner
:
NewFakeRunner
(
t
)})
r
,
err
:=
New
(
Config
{
Type
:
tc
.
runtime
,
Runner
:
runner
})
if
err
!=
nil
{
t
.
Fatalf
(
"New(%s): %v"
,
tc
.
runtime
,
err
)
}
...
...
@@ -279,10 +284,11 @@ func (f *FakeRunner) dockerRm(args []string) (string, error) {
func
(
f
*
FakeRunner
)
dockerInspect
(
args
[]
string
)
(
string
,
error
)
{
if
args
[
1
]
==
"--format"
&&
args
[
2
]
==
"{{.Id}}"
{
if
args
[
3
]
==
"missing"
{
image
,
ok
:=
f
.
images
[
args
[
3
]]
if
!
ok
{
return
""
,
&
exec
.
ExitError
{
Stderr
:
[]
byte
(
"Error: No such object: missing"
)}
}
return
"sha256:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
,
nil
return
"sha256:
"
+
image
,
nil
}
return
""
,
nil
}
...
...
@@ -685,7 +691,7 @@ func TestContainerFunctions(t *testing.T) {
"xyz2"
:
prefix
+
"storage"
,
}
runner
.
images
=
map
[
string
]
string
{
"image1"
:
"
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
"
,
"image1"
:
"
latest
"
,
}
cr
,
err
:=
New
(
Config
{
Type
:
tc
.
runtime
,
Runner
:
runner
})
if
err
!=
nil
{
...
...
@@ -741,7 +747,6 @@ func TestContainerFunctions(t *testing.T) {
if
err
:=
cr
.
RemoveImage
(
"image1"
);
err
!=
nil
{
t
.
Fatalf
(
"RemoveImage: %v"
,
err
)
}
// imageExists := cr.ImageExists("image1", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
if
len
(
runner
.
images
)
>
0
{
t
.
Errorf
(
"RemoveImage = %v, want 0 items"
,
len
(
runner
.
images
))
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录