Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
30a714ad
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 搜索 >>
提交
30a714ad
编写于
5月 27, 2020
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
address review comment
上级
9fd88800
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
15 deletion
+15
-15
test/integration/fn_mount_cmd.go
test/integration/fn_mount_cmd.go
+8
-8
test/integration/fn_pvc.go
test/integration/fn_pvc.go
+5
-5
test/integration/fn_tunnel_cmd.go
test/integration/fn_tunnel_cmd.go
+2
-2
未找到文件。
test/integration/fn_mount_cmd.go
浏览文件 @
30a714ad
...
@@ -62,10 +62,10 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -62,10 +62,10 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
t
.
Fatalf
(
"Unexpected error while creating tempDir: %v"
,
err
)
t
.
Fatalf
(
"Unexpected error while creating tempDir: %v"
,
err
)
}
}
m
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
10
))
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
10
))
args
:=
[]
string
{
"mount"
,
"-p"
,
profile
,
fmt
.
Sprintf
(
"%s:%s"
,
tempDir
,
guestMount
),
"--alsologtostderr"
,
"-v=1"
}
args
:=
[]
string
{
"mount"
,
"-p"
,
profile
,
fmt
.
Sprintf
(
"%s:%s"
,
tempDir
,
guestMount
),
"--alsologtostderr"
,
"-v=1"
}
ss
,
err
:=
Start
(
t
,
exec
.
CommandContext
(
m
ctx
,
Target
(),
args
...
))
ss
,
err
:=
Start
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
args
...
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"%v failed: %v"
,
args
,
err
)
t
.
Fatalf
(
"%v failed: %v"
,
args
,
err
)
}
}
...
@@ -107,7 +107,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -107,7 +107,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
// Block until the mount succeeds to avoid file race
// Block until the mount succeeds to avoid file race
checkMount
:=
func
()
error
{
checkMount
:=
func
()
error
{
_
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"findmnt -T /mount-9p | grep 9p"
))
_
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"findmnt -T /mount-9p | grep 9p"
))
return
err
return
err
}
}
...
@@ -121,7 +121,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -121,7 +121,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
}
}
// Assert that we can access the mount without an error. Display for debugging.
// Assert that we can access the mount without an error. Display for debugging.
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"--"
,
"ls"
,
"-la"
,
guestMount
))
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"--"
,
"ls"
,
"-la"
,
guestMount
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed verifying accessing to the mount. args %q : %v"
,
rr
.
Command
(),
err
)
t
.
Fatalf
(
"failed verifying accessing to the mount. args %q : %v"
,
rr
.
Command
(),
err
)
}
}
...
@@ -129,7 +129,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -129,7 +129,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
// Assert that the mount contains our unique test marker, as opposed to a stale mount
// Assert that the mount contains our unique test marker, as opposed to a stale mount
tp
:=
filepath
.
Join
(
"/mount-9p"
,
testMarker
)
tp
:=
filepath
.
Join
(
"/mount-9p"
,
testMarker
)
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"cat"
,
tp
))
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"ssh"
,
"cat"
,
tp
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to verify the mount contains unique test marked: args %q: %v"
,
rr
.
Command
(),
err
)
t
.
Fatalf
(
"failed to verify the mount contains unique test marked: args %q: %v"
,
rr
.
Command
(),
err
)
}
}
...
@@ -140,12 +140,12 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -140,12 +140,12 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
}
}
// Start the "busybox-mount" pod.
// Start the "busybox-mount" pod.
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
"kubectl"
,
"--context"
,
profile
,
"replace"
,
"--force"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"busybox-mount-test.yaml"
)))
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"replace"
,
"--force"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"busybox-mount-test.yaml"
)))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to 'kubectl replace' for busybox-mount-test. args %q : %v"
,
rr
.
Command
(),
err
)
t
.
Fatalf
(
"failed to 'kubectl replace' for busybox-mount-test. args %q : %v"
,
rr
.
Command
(),
err
)
}
}
if
_
,
err
:=
PodWait
(
m
ctx
,
t
,
profile
,
"default"
,
"integration-test=busybox-mount"
,
Minutes
(
4
));
err
!=
nil
{
if
_
,
err
:=
PodWait
(
ctx
,
t
,
profile
,
"default"
,
"integration-test=busybox-mount"
,
Minutes
(
4
));
err
!=
nil
{
t
.
Fatalf
(
"failed waiting for busybox-mount pod: %v"
,
err
)
t
.
Fatalf
(
"failed waiting for busybox-mount pod: %v"
,
err
)
}
}
...
@@ -161,7 +161,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -161,7 +161,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) {
}
}
// test that file written from host was read in by the pod via cat /mount-9p/written-by-host;
// test that file written from host was read in by the pod via cat /mount-9p/written-by-host;
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
"kubectl"
,
"--context"
,
profile
,
"logs"
,
"busybox-mount"
))
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"logs"
,
"busybox-mount"
))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"failed to get kubectl logs for busybox-mount. args %q : %v"
,
rr
.
Command
(),
err
)
t
.
Errorf
(
"failed to get kubectl logs for busybox-mount. args %q : %v"
,
rr
.
Command
(),
err
)
}
}
...
...
test/integration/fn_pvc.go
浏览文件 @
30a714ad
...
@@ -36,15 +36,15 @@ import (
...
@@ -36,15 +36,15 @@ import (
func
validatePersistentVolumeClaim
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
func
validatePersistentVolumeClaim
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
defer
PostMortemLogs
(
t
,
profile
)
defer
PostMortemLogs
(
t
,
profile
)
m
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
10
))
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
10
))
defer
cancel
()
defer
cancel
()
if
_
,
err
:=
PodWait
(
m
ctx
,
t
,
profile
,
"kube-system"
,
"integration-test=storage-provisioner"
,
Minutes
(
4
));
err
!=
nil
{
if
_
,
err
:=
PodWait
(
ctx
,
t
,
profile
,
"kube-system"
,
"integration-test=storage-provisioner"
,
Minutes
(
4
));
err
!=
nil
{
t
.
Fatalf
(
"failed waiting for storage-provisioner: %v"
,
err
)
t
.
Fatalf
(
"failed waiting for storage-provisioner: %v"
,
err
)
}
}
checkStorageClass
:=
func
()
error
{
checkStorageClass
:=
func
()
error
{
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
"kubectl"
,
"--context"
,
profile
,
"get"
,
"storageclass"
,
"-o=json"
))
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"get"
,
"storageclass"
,
"-o=json"
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -64,13 +64,13 @@ func validatePersistentVolumeClaim(ctx context.Context, t *testing.T, profile st
...
@@ -64,13 +64,13 @@ func validatePersistentVolumeClaim(ctx context.Context, t *testing.T, profile st
}
}
// Now create a testpvc
// Now create a testpvc
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
"kubectl"
,
"--context"
,
profile
,
"apply"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"pvc.yaml"
)))
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"apply"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"pvc.yaml"
)))
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"kubectl apply pvc.yaml failed: args %q: %v"
,
rr
.
Command
(),
err
)
t
.
Fatalf
(
"kubectl apply pvc.yaml failed: args %q: %v"
,
rr
.
Command
(),
err
)
}
}
checkStoragePhase
:=
func
()
error
{
checkStoragePhase
:=
func
()
error
{
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
m
ctx
,
"kubectl"
,
"--context"
,
profile
,
"get"
,
"pvc"
,
"testpvc"
,
"-o=json"
))
rr
,
err
:=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"get"
,
"pvc"
,
"testpvc"
,
"-o=json"
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
test/integration/fn_tunnel_cmd.go
浏览文件 @
30a714ad
...
@@ -49,7 +49,7 @@ var (
...
@@ -49,7 +49,7 @@ var (
)
)
func
validateTunnelCmd
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
func
validateTunnelCmd
(
ctx
context
.
Context
,
t
*
testing
.
T
,
profile
string
)
{
m
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
5
))
ctx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
Minutes
(
5
))
type
validateFunc
func
(
context
.
Context
,
*
testing
.
T
,
string
)
type
validateFunc
func
(
context
.
Context
,
*
testing
.
T
,
string
)
defer
cancel
()
defer
cancel
()
...
@@ -70,7 +70,7 @@ func validateTunnelCmd(ctx context.Context, t *testing.T, profile string) {
...
@@ -70,7 +70,7 @@ func validateTunnelCmd(ctx context.Context, t *testing.T, profile string) {
for
_
,
tc
:=
range
tests
{
for
_
,
tc
:=
range
tests
{
tc
:=
tc
tc
:=
tc
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
tc
.
validator
(
m
ctx
,
t
,
profile
)
tc
.
validator
(
ctx
,
t
,
profile
)
})
})
}
}
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录