Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
aeaa5733
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 搜索 >>
提交
aeaa5733
编写于
7月 23, 2019
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
consistant naming for kubectl runner
上级
673b82a1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
27 deletion
+27
-27
test/integration/cluster_status_test.go
test/integration/cluster_status_test.go
+2
-2
test/integration/mount_test.go
test/integration/mount_test.go
+6
-6
test/integration/persistence_test.go
test/integration/persistence_test.go
+2
-2
test/integration/pv_test.go
test/integration/pv_test.go
+5
-5
test/integration/start_stop_delete_test.go
test/integration/start_stop_delete_test.go
+2
-2
test/integration/tunnel_test.go
test/integration/tunnel_test.go
+10
-10
未找到文件。
test/integration/cluster_status_test.go
浏览文件 @
aeaa5733
...
...
@@ -28,12 +28,12 @@ import (
)
func
testClusterStatus
(
t
*
testing
.
T
)
{
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
kr
:=
util
.
NewKubectlRunner
(
t
)
cs
:=
api
.
ComponentStatusList
{}
healthy
:=
func
()
error
{
t
.
Log
(
"Checking if cluster is healthy."
)
if
err
:=
k
ubectlRunne
r
.
RunCommandParseOutput
([]
string
{
"get"
,
"cs"
},
&
cs
);
err
!=
nil
{
if
err
:=
kr
.
RunCommandParseOutput
([]
string
{
"get"
,
"cs"
},
&
cs
);
err
!=
nil
{
return
err
}
for
_
,
i
:=
range
cs
.
Items
{
...
...
test/integration/mount_test.go
浏览文件 @
aeaa5733
...
...
@@ -60,7 +60,7 @@ func testMounting(t *testing.T) {
}
}()
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
kr
:=
util
.
NewKubectlRunner
(
t
)
podName
:=
"busybox-mount"
curdir
,
err
:=
filepath
.
Abs
(
""
)
if
err
!=
nil
{
...
...
@@ -77,14 +77,14 @@ func testMounting(t *testing.T) {
// Create the pods we need outside the main test loop.
setupTest
:=
func
()
error
{
t
.
Logf
(
"Deploying pod from: %s"
,
podPath
)
if
_
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"create"
,
"-f"
,
podPath
});
err
!=
nil
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"create"
,
"-f"
,
podPath
});
err
!=
nil
{
return
err
}
return
nil
}
defer
func
()
{
t
.
Logf
(
"Deleting pod from: %s"
,
podPath
)
if
out
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"delete"
,
"-f"
,
podPath
});
err
!=
nil
{
if
out
,
err
:=
kr
.
RunCommand
([]
string
{
"delete"
,
"-f"
,
podPath
});
err
!=
nil
{
t
.
Logf
(
"delete -f %s failed: %v
\n
output: %s
\n
"
,
podPath
,
err
,
out
)
}
}()
...
...
@@ -99,7 +99,7 @@ func testMounting(t *testing.T) {
t
.
Logf
(
"Pods appear to be running"
)
mountTest
:=
func
()
error
{
if
err
:=
verifyFiles
(
mk
,
k
ubectlRunne
r
,
tempDir
,
podName
,
expected
);
err
!=
nil
{
if
err
:=
verifyFiles
(
mk
,
kr
,
tempDir
,
podName
,
expected
);
err
!=
nil
{
t
.
Fatalf
(
err
.
Error
())
}
...
...
@@ -144,7 +144,7 @@ func waitForPods(s map[string]string) error {
return
nil
}
func
verifyFiles
(
mk
util
.
MinikubeRunner
,
k
ubectlRunne
r
*
util
.
KubectlRunner
,
tempDir
string
,
podName
string
,
expected
string
)
error
{
func
verifyFiles
(
mk
util
.
MinikubeRunner
,
kr
*
util
.
KubectlRunner
,
tempDir
string
,
podName
string
,
expected
string
)
error
{
path
:=
filepath
.
Join
(
tempDir
,
"frompod"
)
out
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
!=
nil
{
...
...
@@ -156,7 +156,7 @@ func verifyFiles(mk util.MinikubeRunner, kubectlRunner *util.KubectlRunner, temp
}
// test that file written from host was read in by the pod via cat /mount-9p/fromhost;
if
out
,
err
=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"logs"
,
podName
});
err
!=
nil
{
if
out
,
err
=
kr
.
RunCommand
([]
string
{
"logs"
,
podName
});
err
!=
nil
{
return
err
}
if
string
(
out
)
!=
expected
{
...
...
test/integration/persistence_test.go
浏览文件 @
aeaa5733
...
...
@@ -35,7 +35,7 @@ func TestPersistence(t *testing.T) {
}
mk
.
EnsureRunning
()
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
kr
:=
util
.
NewKubectlRunner
(
t
)
curdir
,
err
:=
filepath
.
Abs
(
""
)
if
err
!=
nil
{
t
.
Errorf
(
"Error getting the file path for current directory: %s"
,
curdir
)
...
...
@@ -43,7 +43,7 @@ func TestPersistence(t *testing.T) {
podPath
:=
path
.
Join
(
curdir
,
"testdata"
,
"busybox.yaml"
)
// Create a pod and wait for it to be running.
if
_
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"create"
,
"-f"
,
podPath
});
err
!=
nil
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"create"
,
"-f"
,
podPath
});
err
!=
nil
{
t
.
Fatalf
(
"Error creating test pod: %v"
,
err
)
}
...
...
test/integration/pv_test.go
浏览文件 @
aeaa5733
...
...
@@ -40,10 +40,10 @@ var (
func
testProvisioning
(
t
*
testing
.
T
)
{
t
.
Parallel
()
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
kr
:=
util
.
NewKubectlRunner
(
t
)
defer
func
()
{
if
out
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"delete"
,
"pvc"
,
pvcName
});
err
!=
nil
{
if
out
,
err
:=
kr
.
RunCommand
([]
string
{
"delete"
,
"pvc"
,
pvcName
});
err
!=
nil
{
t
.
Logf
(
"delete pvc %s failed: %v
\n
output: %s
\n
"
,
pvcName
,
err
,
out
)
}
}()
...
...
@@ -53,7 +53,7 @@ func testProvisioning(t *testing.T) {
checkStorageClass
:=
func
()
error
{
scl
:=
storage
.
StorageClassList
{}
if
err
:=
k
ubectlRunne
r
.
RunCommandParseOutput
([]
string
{
"get"
,
"storageclass"
},
&
scl
);
err
!=
nil
{
if
err
:=
kr
.
RunCommandParseOutput
([]
string
{
"get"
,
"storageclass"
},
&
scl
);
err
!=
nil
{
return
fmt
.
Errorf
(
"get storageclass: %v"
,
err
)
}
...
...
@@ -88,14 +88,14 @@ func testProvisioning(t *testing.T) {
// Now create the PVC
pvcPath
:=
filepath
.
Join
(
*
testdataDir
,
"pvc.yaml"
)
if
_
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"create"
,
"-f"
,
pvcPath
});
err
!=
nil
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"create"
,
"-f"
,
pvcPath
});
err
!=
nil
{
t
.
Fatalf
(
"Error creating pvc: %v"
,
err
)
}
// And check that it gets bound to a PV.
checkStorage
:=
func
()
error
{
pvc
:=
core
.
PersistentVolumeClaim
{}
if
err
:=
k
ubectlRunne
r
.
RunCommandParseOutput
(
pvcCmd
,
&
pvc
);
err
!=
nil
{
if
err
:=
kr
.
RunCommandParseOutput
(
pvcCmd
,
&
pvc
);
err
!=
nil
{
return
err
}
// The test passes if the volume claim gets bound.
...
...
test/integration/start_stop_delete_test.go
浏览文件 @
aeaa5733
...
...
@@ -83,8 +83,8 @@ func TestStartStop(t *testing.T) {
}
// check for the current-context before and after the stop
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
currentContext
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"config"
,
"current-context"
})
kr
:=
util
.
NewKubectlRunner
(
t
)
currentContext
,
err
:=
kr
.
RunCommand
([]
string
{
"config"
,
"current-context"
})
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to fetch current-context"
)
}
...
...
test/integration/tunnel_test.go
浏览文件 @
aeaa5733
...
...
@@ -46,9 +46,9 @@ func testTunnel(t *testing.T) {
}
t
.
Log
(
"starting tunnel test..."
)
mk
:=
NewMinikubeRunner
(
t
,
"--wait=false"
)
mkNewMinikubeRunner
(
t
,
"--wait=false"
)
go
func
()
{
output
:=
mk
.
Run
Command
(
"tunnel --alsologtostderr -v 8 --logtostderr"
,
true
)
output
:=
mkCommand
(
"tunnel --alsologtostderr -v 8 --logtostderr"
,
true
)
if
t
.
Failed
()
{
fmt
.
Println
(
output
)
}
...
...
@@ -60,7 +60,7 @@ func testTunnel(t *testing.T) {
t
.
Fatal
(
errors
.
Wrap
(
err
,
"cleaning up tunnels"
))
}
k
ubectlRunne
r
:=
util
.
NewKubectlRunner
(
t
)
kr
:=
util
.
NewKubectlRunner
(
t
)
t
.
Log
(
"deploying nginx..."
)
curdir
,
err
:=
filepath
.
Abs
(
""
)
...
...
@@ -68,7 +68,7 @@ func testTunnel(t *testing.T) {
t
.
Errorf
(
"Error getting the file path for current directory: %s"
,
curdir
)
}
podPath
:=
path
.
Join
(
curdir
,
"testdata"
,
"testsvc.yaml"
)
if
_
,
err
:=
k
ubectlRunne
r
.
RunCommand
([]
string
{
"apply"
,
"-f"
,
podPath
});
err
!=
nil
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"apply"
,
"-f"
,
podPath
});
err
!=
nil
{
t
.
Fatalf
(
"creating nginx ingress resource: %s"
,
err
)
}
...
...
@@ -89,13 +89,13 @@ func testTunnel(t *testing.T) {
t
.
Log
(
"getting nginx ingress..."
)
nginxIP
,
err
:=
getIngress
(
k
ubectlRunne
r
)
nginxIP
,
err
:=
getIngress
(
kr
)
if
err
!=
nil
{
t
.
Errorf
(
"error getting ingress IP for nginx: %s"
,
err
)
}
if
len
(
nginxIP
)
==
0
{
stdout
,
err
:=
describeIngress
(
k
ubectlRunne
r
)
stdout
,
err
:=
describeIngress
(
kr
)
if
err
!=
nil
{
t
.
Errorf
(
"error debugging nginx service: %s"
,
err
)
...
...
@@ -113,12 +113,12 @@ func testTunnel(t *testing.T) {
}
}
func
getIngress
(
k
ubectlRunne
r
*
util
.
KubectlRunner
)
(
string
,
error
)
{
func
getIngress
(
kr
*
util
.
KubectlRunner
)
(
string
,
error
)
{
nginxIP
:=
""
var
ret
error
err
:=
wait
.
PollImmediate
(
1
*
time
.
Second
,
1
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
cmd
:=
[]
string
{
"get"
,
"svc"
,
"nginx-svc"
,
"-o"
,
"jsonpath={.status.loadBalancer.ingress[0].ip}"
}
stdout
,
err
:=
k
ubectlRunne
r
.
RunCommand
(
cmd
)
stdout
,
err
:=
kr
.
RunCommand
(
cmd
)
switch
{
case
err
==
nil
:
nginxIP
=
string
(
stdout
)
...
...
@@ -137,8 +137,8 @@ func getIngress(kubectlRunner *util.KubectlRunner) (string, error) {
return
nginxIP
,
ret
}
func
describeIngress
(
k
ubectlRunne
r
*
util
.
KubectlRunner
)
([]
byte
,
error
)
{
return
k
ubectlRunne
r
.
RunCommand
([]
string
{
"get"
,
"svc"
,
"nginx-svc"
,
"-o"
,
"jsonpath={.status}"
})
func
describeIngress
(
kr
*
util
.
KubectlRunner
)
([]
byte
,
error
)
{
return
kr
.
RunCommand
([]
string
{
"get"
,
"svc"
,
"nginx-svc"
,
"-o"
,
"jsonpath={.status}"
})
}
// getResponseBody returns the contents of a URL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录