Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
a93866e4
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,发现更多精彩内容 >>
提交
a93866e4
编写于
12月 05, 2018
作者:
T
Thomas Stromberg
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into routes
上级
82668a7c
034046e9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
80 addition
and
49 deletion
+80
-49
hack/jenkins/common.sh
hack/jenkins/common.sh
+3
-5
test/integration/cluster_dns_test.go
test/integration/cluster_dns_test.go
+10
-20
test/integration/functional_test.go
test/integration/functional_test.go
+8
-1
test/integration/start_stop_delete_test.go
test/integration/start_stop_delete_test.go
+45
-22
test/integration/util/util.go
test/integration/util/util.go
+14
-1
未找到文件。
hack/jenkins/common.sh
浏览文件 @
a93866e4
...
...
@@ -51,7 +51,7 @@ case "${VM_DRIVER}" in
esac
echo
""
mkdir
-p
out/ testdata/
"
${
TEST_HOME
}
"
mkdir
-p
out/ testdata/
# Install gsutil if necessary.
if
!
type
-P
gsutil
>
/dev/null
;
then
...
...
@@ -153,7 +153,7 @@ fi
if
[[
"
${
VM_DRIVER
}
"
==
"hyperkit"
]]
;
then
if
[[
-e
out/docker-machine-driver-hyperkit
]]
;
then
sudo chown
root:wheel out/docker-machine-driver-hyperkit
||
true
sudo chmod
u+s out/docker-machine-driver-hyperkit
||
true
sudo chmod
u+s out/docker-machine-driver-hyperkit
||
true
fi
fi
...
...
@@ -163,11 +163,9 @@ if pgrep kubectl; then
pgrep kubectl | xargs
kill
||
true
fi
# Respected by minikube
mkdir
-p
"
${
TEST_HOME
}
"
export
MINIKUBE_HOME
=
"
${
TEST_HOME
}
/.minikube"
export
MINIKUBE_WANTREPORTERRORPROMPT
=
False
# Respected by kubectl
export
KUBECONFIG
=
"
${
TEST_HOME
}
/kubeconfig"
# Display the default image URL
...
...
test/integration/cluster_dns_test.go
浏览文件 @
a93866e4
...
...
@@ -25,10 +25,7 @@ import (
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
commonutil
"k8s.io/minikube/pkg/util"
pkgutil
"k8s.io/minikube/pkg/util"
"k8s.io/minikube/test/integration/util"
)
...
...
@@ -39,31 +36,24 @@ func testClusterDNS(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"Error getting kubernetes client %v"
,
err
)
}
waitForDNS
(
t
,
client
)
kr
:=
util
.
NewKubectlRunner
(
t
)
busybox
:=
busyBoxPod
(
t
,
client
,
kr
)
defer
kr
.
RunCommand
([]
string
{
"delete"
,
"po"
,
busybox
})
// The query result is not as important as service reachability
out
,
err
:=
kr
.
RunCommand
([]
string
{
"exec"
,
busybox
,
"nslookup"
,
"localhost"
})
if
err
!=
nil
{
t
.
Errorf
(
"nslookup within busybox failed: %v"
,
err
)
out
:=
[]
byte
{}
nslookup
:=
func
()
error
{
out
,
err
=
kr
.
RunCommand
([]
string
{
"exec"
,
busybox
,
"nslookup"
,
"kubernetes.default"
})
return
err
}
clusterIP
:=
[]
byte
(
"10.96.0.1"
)
if
!
bytes
.
Contains
(
out
,
clusterIP
)
{
t
.
Errorf
(
"nslookup did not mention %s:
\n
%s"
,
clusterIP
,
out
)
if
err
:=
util
.
Retry
(
t
,
nslookup
,
3
*
time
.
Second
,
60
);
err
!=
nil
{
t
.
Fatalf
(
err
.
Error
())
}
}
func
waitForDNS
(
t
*
testing
.
T
,
c
kubernetes
.
Interface
)
{
// Implementation note: both kube-dns and coredns have k8s-app=kube-dns labels.
sel
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"k8s-app"
:
"kube-dns"
}))
if
err
:=
commonutil
.
WaitForPodsWithLabelRunning
(
c
,
"kube-system"
,
sel
);
err
!=
nil
{
t
.
Fatalf
(
"Waited too long for k8s-app=kube-dns pods"
)
}
if
err
:=
commonutil
.
WaitForDeploymentToStabilize
(
c
,
"kube-system"
,
"kube-dns"
,
time
.
Minute
*
2
);
err
!=
nil
{
t
.
Fatalf
(
"kube-dns deployment failed to stabilize within 2 minutes"
)
clusterIP
:=
[]
byte
(
"10.96.0.1"
)
if
!
bytes
.
Contains
(
out
,
clusterIP
)
{
t
.
Errorf
(
"output did not contain expected IP:
\n
%s"
,
out
)
}
}
...
...
test/integration/functional_test.go
浏览文件 @
a93866e4
...
...
@@ -21,6 +21,8 @@ package integration
import
(
"strings"
"testing"
"k8s.io/minikube/test/integration/util"
)
func
TestFunctional
(
t
*
testing
.
T
)
{
...
...
@@ -38,10 +40,15 @@ func TestFunctional(t *testing.T) {
t
.
Run
(
"Provisioning"
,
testProvisioning
)
t
.
Run
(
"Tunnel"
,
testTunnel
)
if
!
strings
.
Contains
(
minikubeRunner
.
StartArgs
,
"--vm-driver=none"
)
{
if
!
usingNoneDriver
(
minikubeRunner
)
{
t
.
Run
(
"EnvVars"
,
testClusterEnv
)
t
.
Run
(
"SSH"
,
testClusterSSH
)
t
.
Run
(
"IngressController"
,
testIngressController
)
t
.
Run
(
"Mounting"
,
testMounting
)
}
}
// usingNoneDriver returns true if using the none driver
func
usingNoneDriver
(
runner
util
.
MinikubeRunner
)
bool
{
return
strings
.
Contains
(
runner
.
StartArgs
,
"--vm-driver=none"
)
}
test/integration/start_stop_delete_test.go
浏览文件 @
a93866e4
...
...
@@ -25,37 +25,60 @@ import (
"time"
"github.com/docker/machine/libmachine/state"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/test/integration/util"
)
func
TestStartStop
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
runtime
string
}{
{
name
:
"default"
,
runtime
:
""
,
},
{
name
:
"start stop with containerd runtime"
,
runtime
:
constants
.
ContainerdRuntime
,
},
}
runner
:=
NewMinikubeRunner
(
t
)
runner
.
RunCommand
(
"config set WantReportErrorPrompt false"
,
true
)
runner
.
RunCommand
(
"delete"
,
false
)
runner
.
CheckStatus
(
state
.
None
.
String
())
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
runner
:=
NewMinikubeRunner
(
t
)
if
test
.
runtime
!=
""
&&
usingNoneDriver
(
runner
)
{
t
.
Skipf
(
"skipping, can't use %s with none driver"
,
test
.
runtime
)
}
runner
.
Start
()
runner
.
CheckStatus
(
state
.
Running
.
String
())
runner
.
RunCommand
(
"config set WantReportErrorPrompt false"
,
true
)
runner
.
RunCommand
(
"delete"
,
false
)
runner
.
CheckStatus
(
state
.
None
.
String
())
ip
:=
runner
.
RunCommand
(
"ip"
,
true
)
ip
=
strings
.
TrimRight
(
ip
,
"
\n
"
)
if
net
.
ParseIP
(
ip
)
==
nil
{
t
.
Fatalf
(
"IP command returned an invalid address: %s"
,
ip
)
}
runner
.
SetRuntime
(
test
.
runtime
)
runner
.
Start
()
runner
.
CheckStatus
(
state
.
Running
.
String
())
checkStop
:=
func
()
error
{
runner
.
RunCommand
(
"stop"
,
true
)
return
runner
.
CheckStatusNoFail
(
state
.
Stopped
.
String
())
}
ip
:=
runner
.
RunCommand
(
"ip"
,
true
)
ip
=
strings
.
TrimRight
(
ip
,
"
\n
"
)
if
net
.
ParseIP
(
ip
)
==
nil
{
t
.
Fatalf
(
"IP command returned an invalid address: %s"
,
ip
)
}
if
err
:=
util
.
Retry
(
t
,
checkStop
,
5
*
time
.
Second
,
6
);
err
!=
nil
{
t
.
Fatalf
(
"timed out while checking stopped status: %v"
,
err
)
}
checkStop
:=
func
()
error
{
runner
.
RunCommand
(
"stop"
,
true
)
return
runner
.
CheckStatusNoFail
(
state
.
Stopped
.
String
())
}
if
err
:=
util
.
Retry
(
t
,
checkStop
,
5
*
time
.
Second
,
6
);
err
!=
nil
{
t
.
Fatalf
(
"timed out while checking stopped status: %v"
,
err
)
}
runner
.
Start
()
runner
.
CheckStatus
(
state
.
Running
.
String
())
runner
.
Start
()
runner
.
CheckStatus
(
state
.
Running
.
String
())
runner
.
RunCommand
(
"delete"
,
true
)
runner
.
CheckStatus
(
state
.
None
.
String
())
runner
.
RunCommand
(
"delete"
,
true
)
runner
.
CheckStatus
(
state
.
None
.
String
())
})
}
}
test/integration/util/util.go
浏览文件 @
a93866e4
...
...
@@ -33,6 +33,7 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/constants"
commonutil
"k8s.io/minikube/pkg/util"
)
...
...
@@ -43,6 +44,7 @@ type MinikubeRunner struct {
BinaryPath
string
Args
string
StartArgs
string
Runtime
string
}
func
(
m
*
MinikubeRunner
)
Run
(
cmd
string
)
error
{
...
...
@@ -105,6 +107,11 @@ func (m *MinikubeRunner) RunDaemon(command string) (*exec.Cmd, *bufio.Reader) {
}
// SetRuntime saves the runtime backend
func
(
m
*
MinikubeRunner
)
SetRuntime
(
runtime
string
)
{
m
.
Runtime
=
runtime
}
func
(
m
*
MinikubeRunner
)
SSH
(
command
string
)
(
string
,
error
)
{
path
,
_
:=
filepath
.
Abs
(
m
.
BinaryPath
)
cmd
:=
exec
.
Command
(
path
,
"ssh"
,
command
)
...
...
@@ -117,7 +124,13 @@ func (m *MinikubeRunner) SSH(command string) (string, error) {
}
func
(
m
*
MinikubeRunner
)
Start
()
{
m
.
RunCommand
(
fmt
.
Sprintf
(
"start %s %s"
,
m
.
StartArgs
,
m
.
Args
),
true
)
switch
r
:=
m
.
Runtime
;
r
{
case
constants
.
ContainerdRuntime
:
containerdFlags
:=
"--container-runtime=containerd --network-plugin=cni --docker-opt containerd=/var/run/containerd/containerd.sock"
m
.
RunCommand
(
fmt
.
Sprintf
(
"start %s %s %s"
,
m
.
StartArgs
,
m
.
Args
,
containerdFlags
),
true
)
default
:
m
.
RunCommand
(
fmt
.
Sprintf
(
"start %s %s"
,
m
.
StartArgs
,
m
.
Args
),
true
)
}
}
func
(
m
*
MinikubeRunner
)
EnsureRunning
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录