Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
d47d51d8
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 搜索 >>
提交
d47d51d8
编写于
7月 23, 2019
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding optional set kubecontext
上级
59fd6df3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
21 deletion
+26
-21
test/integration/addons_test.go
test/integration/addons_test.go
+4
-2
test/integration/cluster_dns_test.go
test/integration/cluster_dns_test.go
+3
-3
test/integration/mount_test.go
test/integration/mount_test.go
+3
-3
test/integration/pv_test.go
test/integration/pv_test.go
+1
-1
test/integration/start_stop_delete_test.go
test/integration/start_stop_delete_test.go
+3
-3
test/integration/tunnel_test.go
test/integration/tunnel_test.go
+1
-1
test/integration/util/kubectl_runner.go
test/integration/util/kubectl_runner.go
+11
-8
未找到文件。
test/integration/addons_test.go
浏览文件 @
d47d51d8
...
...
@@ -40,7 +40,8 @@ import (
func
testAddons
(
t
*
testing
.
T
)
{
t
.
Parallel
()
client
,
err
:=
pkgutil
.
GetClient
()
p
:=
"minikube"
client
,
err
:=
pkgutil
.
GetClient
(
p
)
if
err
!=
nil
{
t
.
Fatalf
(
"Could not get kubernetes client: %v"
,
err
)
}
...
...
@@ -76,7 +77,8 @@ func readLineWithTimeout(b *bufio.Reader, timeout time.Duration) (string, error)
func
testDashboard
(
t
*
testing
.
T
)
{
t
.
Parallel
()
mk
:=
NewMinikubeRunner
(
t
,
"--wait=false"
)
p
:=
"minikube"
mk
:=
NewMinikubeRunner
(
t
,
p
,
"--wait=false"
)
cmd
,
out
:=
mk
.
RunDaemon
(
"dashboard --url"
)
defer
func
()
{
err
:=
cmd
.
Process
.
Kill
()
...
...
test/integration/cluster_dns_test.go
浏览文件 @
d47d51d8
...
...
@@ -39,7 +39,7 @@ func testClusterDNS(t *testing.T) {
}
kr
:=
util
.
NewKubectlRunner
(
t
,
p
)
busybox
:=
busyBoxPod
(
t
,
client
,
kr
)
busybox
:=
busyBoxPod
(
t
,
client
,
kr
,
p
)
defer
func
()
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"delete"
,
"po"
,
busybox
});
err
!=
nil
{
t
.
Errorf
(
"delete failed: %v"
,
err
)
...
...
@@ -62,12 +62,12 @@ func testClusterDNS(t *testing.T) {
}
}
func
busyBoxPod
(
t
*
testing
.
T
,
c
kubernetes
.
Interface
,
kr
*
util
.
KubectlRunner
)
string
{
func
busyBoxPod
(
t
*
testing
.
T
,
c
kubernetes
.
Interface
,
kr
*
util
.
KubectlRunner
,
profile
string
)
string
{
if
_
,
err
:=
kr
.
RunCommand
([]
string
{
"create"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"busybox.yaml"
)});
err
!=
nil
{
t
.
Fatalf
(
"creating busybox pod: %s"
,
err
)
}
// TODO(tstromberg): Refactor WaitForBusyboxRunning to return name of pod.
if
err
:=
util
.
WaitForBusyboxRunning
(
t
,
"default"
,
"minikube"
);
err
!=
nil
{
if
err
:=
util
.
WaitForBusyboxRunning
(
t
,
"default"
,
profile
);
err
!=
nil
{
t
.
Fatalf
(
"Waiting for busybox pod to be up: %v"
,
err
)
}
...
...
test/integration/mount_test.go
浏览文件 @
d47d51d8
...
...
@@ -94,7 +94,7 @@ func testMounting(t *testing.T) {
t
.
Fatal
(
"mountTest failed with error:"
,
err
)
}
if
err
:=
waitForPods
(
map
[
string
]
string
{
"integration-test"
:
"busybox-mount"
});
err
!=
nil
{
if
err
:=
waitForPods
(
map
[
string
]
string
{
"integration-test"
:
"busybox-mount"
}
,
p
);
err
!=
nil
{
t
.
Fatalf
(
"Error waiting for busybox mount pod to be up: %v"
,
err
)
}
t
.
Logf
(
"Pods appear to be running"
)
...
...
@@ -133,8 +133,8 @@ func writeFilesFromHost(mountedDir string, files []string, content string) error
return
nil
}
func
waitForPods
(
s
map
[
string
]
string
)
error
{
client
,
err
:=
pkgutil
.
GetClient
()
func
waitForPods
(
s
map
[
string
]
string
,
profile
string
)
error
{
client
,
err
:=
pkgutil
.
GetClient
(
profile
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"getting kubernetes client: %v"
,
err
)
}
...
...
test/integration/pv_test.go
浏览文件 @
d47d51d8
...
...
@@ -71,7 +71,7 @@ func testProvisioning(t *testing.T) {
// Check that the storage provisioner pod is running
checkPodRunning
:=
func
()
error
{
client
,
err
:=
commonutil
.
GetClient
()
client
,
err
:=
commonutil
.
GetClient
(
p
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"getting kubernetes client"
)
}
...
...
test/integration/start_stop_delete_test.go
浏览文件 @
d47d51d8
...
...
@@ -85,12 +85,12 @@ func TestStartStop(t *testing.T) {
// check for the current-context before and after the stop
kr
:=
util
.
NewKubectlRunner
(
t
,
p
)
currentContext
,
err
:=
kr
.
RunCommand
([]
string
{
"config"
,
"current-context"
})
currentContext
,
err
:=
kr
.
RunCommand
([]
string
{
"config"
,
"current-context"
}
,
false
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed to fetch current-context"
)
}
if
strings
.
TrimRight
(
string
(
currentContext
),
"
\n
"
)
!=
"minikube"
{
t
.
Fatalf
(
"got current-context - %q, want current-context %q"
,
string
(
currentContext
),
"minikube"
)
if
strings
.
TrimRight
(
string
(
currentContext
),
"
\n
"
)
!=
p
{
t
.
Fatalf
(
"got current-context - %q, want current-context %q"
,
string
(
currentContext
),
p
)
}
checkStop
:=
func
()
error
{
...
...
test/integration/tunnel_test.go
浏览文件 @
d47d51d8
...
...
@@ -73,7 +73,7 @@ func testTunnel(t *testing.T) {
t
.
Fatalf
(
"creating nginx ingress resource: %s"
,
err
)
}
client
,
err
:=
commonutil
.
GetClient
()
client
,
err
:=
commonutil
.
GetClient
(
p
)
if
err
!=
nil
{
t
.
Fatal
(
errors
.
Wrap
(
err
,
"getting kubernetes client"
))
...
...
test/integration/util/kubectl_runner.go
浏览文件 @
d47d51d8
...
...
@@ -51,12 +51,9 @@ func NewKubectlRunner(t *testing.T, profile ...string) *KubectlRunner {
}
// RunCommandParseOutput runs a command and parses the JSON output
func
(
k
*
KubectlRunner
)
RunCommandParseOutput
(
args
[]
string
,
outputObj
interface
{},
setKubeContext
...
bool
)
error
{
kubecContextArg
:=
fmt
.
Sprintf
(
" --context=%s"
,
k
.
Profile
)
args
=
append
([]
string
{
kubecContextArg
},
args
...
)
// prepending --context so it can be with with -- space
func
(
k
*
KubectlRunner
)
RunCommandParseOutput
(
args
[]
string
,
outputObj
interface
{},
useKubeContext
...
bool
)
error
{
args
=
append
(
args
,
"-o=json"
)
output
,
err
:=
k
.
RunCommand
(
args
)
output
,
err
:=
k
.
RunCommand
(
args
,
useKubeContext
...
)
if
err
!=
nil
{
return
err
}
...
...
@@ -68,9 +65,15 @@ func (k *KubectlRunner) RunCommandParseOutput(args []string, outputObj interface
}
// RunCommand runs a command, returning stdout
func
(
k
*
KubectlRunner
)
RunCommand
(
args
[]
string
)
(
stdout
[]
byte
,
err
error
)
{
kubecContextArg
:=
fmt
.
Sprintf
(
" --context=%s"
,
k
.
Profile
)
args
=
append
([]
string
{
kubecContextArg
},
args
...
)
// prepending --context so it can be with with -- space
func
(
k
*
KubectlRunner
)
RunCommand
(
args
[]
string
,
useKubeContext
...
bool
)
(
stdout
[]
byte
,
err
error
)
{
if
useKubeContext
==
nil
{
useKubeContext
=
[]
bool
{
true
}
}
if
useKubeContext
[
0
]
{
kubecContextArg
:=
fmt
.
Sprintf
(
"--context=%s"
,
k
.
Profile
)
args
=
append
([]
string
{
kubecContextArg
},
args
...
)
// prepending --context so it can be with with -- space
}
inner
:=
func
()
error
{
cmd
:=
exec
.
Command
(
k
.
BinaryPath
,
args
...
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录