Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
76f9a71a
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 搜索 >>
提交
76f9a71a
编写于
5月 27, 2020
作者:
M
Medya Gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
address review comments
上级
70e5b525
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
58 deletion
+8
-58
test/integration/functional_test.go
test/integration/functional_test.go
+4
-4
test/integration/helpers.go
test/integration/helpers.go
+4
-54
未找到文件。
test/integration/functional_test.go
浏览文件 @
76f9a71a
...
...
@@ -159,8 +159,8 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
var
rr
*
RunResult
var
err
error
if
runtime
.
GOOS
==
"windows"
{
c
:=
exec
.
CommandContext
(
mctx
,
Target
()
+
" -p "
+
profile
+
" docker-env | Invoke-Expression ;"
+
Target
()
+
" status -p "
+
profile
)
rr
,
err
=
Run
InPowershell
(
t
,
c
)
c
:=
exec
.
CommandContext
(
mctx
,
"powershell.exe"
,
"-NoProfile"
,
"-NonInteractive"
,
Target
()
+
" -p "
+
profile
+
" docker-env | Invoke-Expression ;"
+
Target
()
+
" status -p "
+
profile
)
rr
,
err
=
Run
(
t
,
c
)
}
else
{
c
:=
exec
.
CommandContext
(
mctx
,
"/bin/bash"
,
"-c"
,
"eval $("
+
Target
()
+
" -p "
+
profile
+
" docker-env) && "
+
Target
()
+
" status -p "
+
profile
)
// we should be able to get minikube status with a bash which evaled docker-env
...
...
@@ -180,8 +180,8 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
defer
cancel
()
// do a eval $(minikube -p profile docker-env) and check if we are point to docker inside minikube
if
runtime
.
GOOS
==
"windows"
{
// testing docker-env eval in powershell
c
:=
exec
.
CommandContext
(
mctx
,
Target
(),
"-p "
+
profile
+
" docker-env | Invoke-Expression ; docker images"
)
rr
,
err
=
Run
InPowershell
(
t
,
c
)
c
:=
exec
.
CommandContext
(
mctx
,
"powershell.exe"
,
"-NoProfile"
,
"-NonInteractive"
,
Target
(),
"-p "
+
profile
+
" docker-env | Invoke-Expression ; docker images"
)
rr
,
err
=
Run
(
t
,
c
)
}
else
{
c
:=
exec
.
CommandContext
(
mctx
,
"/bin/bash"
,
"-c"
,
"eval $("
+
Target
()
+
" -p "
+
profile
+
" docker-env) && docker images"
)
rr
,
err
=
Run
(
t
,
c
)
...
...
test/integration/helpers.go
浏览文件 @
76f9a71a
...
...
@@ -112,40 +112,6 @@ func Run(t *testing.T, cmd *exec.Cmd) (*RunResult, error) {
return
rr
,
err
}
// RunInPowershell is a test helper to log a command being executed in powershell \_(ツ)_/¯
func
RunInPowershell
(
t
*
testing
.
T
,
cmd
*
exec
.
Cmd
)
(
*
RunResult
,
error
)
{
t
.
Helper
()
var
newCmd
*
exec
.
Cmd
args
:=
append
([]
string
{
"-NoProfile"
,
"-NonInteractive"
},
cmd
.
Args
...
)
newCmd
=
exec
.
Command
(
"powershell.exe"
,
args
...
)
newCmd
.
Stdout
=
cmd
.
Stdout
newCmd
.
Stderr
=
cmd
.
Stderr
newCmd
.
Env
=
cmd
.
Env
rr
:=
&
RunResult
{
Args
:
newCmd
.
Args
}
t
.
Logf
(
"(dbg) Run: %v"
,
rr
.
Command
())
var
outb
,
errb
bytes
.
Buffer
newCmd
.
Stdout
,
rr
.
Stdout
=
&
outb
,
&
outb
newCmd
.
Stderr
,
rr
.
Stderr
=
&
errb
,
&
errb
start
:=
time
.
Now
()
err
:=
newCmd
.
Run
()
elapsed
:=
time
.
Since
(
start
)
if
err
==
nil
{
if
elapsed
>
(
1
*
time
.
Second
)
{
t
.
Logf
(
"(dbg) Done: %v: (%s)"
,
rr
.
Command
(),
elapsed
)
}
}
else
{
if
exitError
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
{
rr
.
ExitCode
=
exitError
.
ExitCode
()
}
t
.
Logf
(
"(dbg) Non-zero exit: %v: %v (%s)
\n
%s"
,
rr
.
Command
(),
err
,
elapsed
,
rr
.
Output
())
}
return
rr
,
err
}
// StartSession stores the result of an cmd.Start call
type
StartSession
struct
{
Stdout
*
bufio
.
Reader
...
...
@@ -156,34 +122,18 @@ type StartSession struct {
// Start starts a process in the background, streaming output
func
Start
(
t
*
testing
.
T
,
cmd
*
exec
.
Cmd
,
powershell
...
bool
)
(
*
StartSession
,
error
)
{
t
.
Helper
()
runInPowershell
:=
false
if
len
(
powershell
)
>
0
{
runInPowershell
=
powershell
[
0
]
}
t
.
Logf
(
"(dbg) daemon: %v"
,
cmd
.
Args
)
var
newCmd
*
exec
.
Cmd
if
runInPowershell
{
args
:=
append
([]
string
{
"-NoProfile"
},
cmd
.
Args
...
)
newCmd
=
exec
.
Command
(
"powershell.exe"
,
args
...
)
newCmd
.
Stdout
=
cmd
.
Stdout
newCmd
.
Stderr
=
cmd
.
Stderr
newCmd
.
Env
=
cmd
.
Env
}
else
{
newCmd
=
cmd
}
stdoutPipe
,
err
:=
newCmd
.
StdoutPipe
()
stdoutPipe
,
err
:=
cmd
.
StdoutPipe
()
if
err
!=
nil
{
t
.
Fatalf
(
"stdout pipe failed: %v %v"
,
newCmd
.
Args
,
err
)
}
stderrPipe
,
err
:=
newC
md
.
StderrPipe
()
stderrPipe
,
err
:=
c
md
.
StderrPipe
()
if
err
!=
nil
{
t
.
Fatalf
(
"stderr pipe failed: %v %v"
,
newCmd
.
Args
,
err
)
}
sr
:=
&
StartSession
{
Stdout
:
bufio
.
NewReader
(
stdoutPipe
),
Stderr
:
bufio
.
NewReader
(
stderrPipe
),
cmd
:
newC
md
}
return
sr
,
newC
md
.
Start
()
sr
:=
&
StartSession
{
Stdout
:
bufio
.
NewReader
(
stdoutPipe
),
Stderr
:
bufio
.
NewReader
(
stderrPipe
),
cmd
:
c
md
}
return
sr
,
c
md
.
Start
()
}
// Stop stops the started process
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录