Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
3503c3ea
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 搜索 >>
提交
3503c3ea
编写于
3月 26, 2021
作者:
T
Tharun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add integration test for minikube rm image command
Signed-off-by:
N
Tharun
<
rajendrantharun@live.com
>
上级
77ba3e93
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
9 deletion
+63
-9
test/integration/functional_test.go
test/integration/functional_test.go
+63
-9
未找到文件。
test/integration/functional_test.go
浏览文件 @
3503c3ea
...
...
@@ -133,6 +133,7 @@ func TestFunctional(t *testing.T) {
{
"DockerEnv"
,
validateDockerEnv
},
{
"NodeLabels"
,
validateNodeLabels
},
{
"LoadImage"
,
validateLoadImage
},
{
"RemoveImage"
,
validateRemoveImage
},
}
for
_
,
tc
:=
range
tests
{
tc
:=
tc
...
...
@@ -219,27 +220,80 @@ func validateLoadImage(ctx context.Context, t *testing.T, profile string) {
}
// make sure the image was correctly loaded
rr
,
err
=
inspectImage
(
ctx
,
t
,
profile
,
newImage
)
if
err
!=
nil
{
t
.
Fatalf
(
"listing images: %v
\n
%s"
,
err
,
rr
.
Output
())
}
if
!
strings
.
Contains
(
rr
.
Output
(),
newImage
)
{
t
.
Fatalf
(
"expected %s to be loaded into minikube but the image is not there"
,
newImage
)
}
}
// validateRemoveImage makes sures that `minikube rm image` works as expected
func
validateRemoveImage
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
if
NoneDriver
()
{
t
.
Skip
(
"load image not available on none driver"
)
}
if
GithubActionRunner
()
&&
runtime
.
GOOS
==
"darwin"
{
t
.
Skip
(
"skipping on github actions and darwin, as this test requires a running docker daemon"
)
}
defer
PostMortemLogs
(
t
,
profile
)
// pull busybox
busyboxImage
:=
"busybox:latest"
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"docker"
,
"pull"
,
busyboxImage
))
if
err
!=
nil
{
t
.
Fatalf
(
"failed to setup test (pull image): %v
\n
%s"
,
err
,
rr
.
Output
())
}
// try to load the image into minikube
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"image"
,
"load"
,
busyboxImage
))
if
err
!=
nil
{
t
.
Fatalf
(
"loading image into minikube: %v
\n
%s"
,
err
,
rr
.
Output
())
}
// try to remove the image from minikube
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"image"
,
"rm"
,
busyboxImage
))
if
err
!=
nil
{
t
.
Fatalf
(
"removing image from minikube: %v
\n
%s"
,
err
,
rr
.
Output
())
}
// make sure the image was removed
var
cmd
*
exec
.
Cmd
if
ContainerRuntime
()
==
"docker"
{
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"docker"
,
"image"
,
"inspect"
,
newImage
)
}
else
if
ContainerRuntime
()
==
"containerd"
{
// crictl inspecti busybox:test-example
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"sudo"
,
"crictl"
,
"inspecti"
,
newImage
)
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"docker"
,
"images"
)
}
else
{
// crio adds localhost prefix
// crictl inspecti localhost/busybox:test-example
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"sudo"
,
"crictl"
,
"inspecti"
,
"localhost/"
+
newImage
)
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"sudo"
,
"crictl"
,
"images"
)
}
rr
,
err
=
Run
(
t
,
cmd
)
if
err
!=
nil
{
t
.
Fatalf
(
"listing images: %v
\n
%s"
,
err
,
rr
.
Output
())
}
if
!
strings
.
Contains
(
rr
.
Output
(),
new
Image
)
{
t
.
Fatalf
(
"expected %s to be
loaded into minikube but the image is not there"
,
new
Image
)
if
strings
.
Contains
(
rr
.
Output
(),
busybox
Image
)
{
t
.
Fatalf
(
"expected %s to be
removed from minikube but the image is there"
,
busybox
Image
)
}
}
func
inspectImage
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
,
image
string
)
(
*
RunResult
,
error
)
{
var
cmd
*
exec
.
Cmd
if
ContainerRuntime
()
==
"docker"
{
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"docker"
,
"image"
,
"inspect"
,
image
)
}
else
if
ContainerRuntime
()
==
"containerd"
{
// crictl inspecti busybox:test-example
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"sudo"
,
"crictl"
,
"inspecti"
,
image
)
}
else
{
// crio adds localhost prefix
// crictl inspecti localhost/busybox:test-example
cmd
=
exec
.
CommandContext
(
ctx
,
Target
(),
"ssh"
,
"-p"
,
profile
,
"--"
,
"sudo"
,
"crictl"
,
"inspecti"
,
"localhost/"
+
image
)
}
rr
,
err
:=
Run
(
t
,
cmd
)
if
err
!=
nil
{
return
rr
,
err
}
return
rr
,
nil
}
// check functionality of minikube after evaling docker-env
// TODO: Add validatePodmanEnv for crio runtime: #10231
func
validateDockerEnv
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录