Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
e30fe107
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 搜索 >>
提交
e30fe107
编写于
9月 09, 2019
作者:
J
josedonizetti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add debugging information
上级
44889de3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
4 deletion
+21
-4
pkg/drivers/drivers.go
pkg/drivers/drivers.go
+4
-0
test/integration/driver_install_or_update_test.go
test/integration/driver_install_or_update_test.go
+17
-4
未找到文件。
pkg/drivers/drivers.go
浏览文件 @
e30fe107
...
...
@@ -17,6 +17,7 @@ limitations under the License.
package
drivers
import
(
"fmt"
"io"
"io/ioutil"
"os"
...
...
@@ -168,6 +169,8 @@ func InstallOrUpdate(driver, destination string, minikubeVersion semver.Version)
v
:=
ExtractVMDriverVersion
(
string
(
output
))
fmt
.
Printf
(
"InstallOrUpdate extracted version %s
\n
"
,
v
)
// if the driver doesn't return any version, download it
if
len
(
v
)
==
0
{
return
download
(
driver
,
destination
)
...
...
@@ -178,6 +181,7 @@ func InstallOrUpdate(driver, destination string, minikubeVersion semver.Version)
return
errors
.
Wrap
(
err
,
"can't parse driver version"
)
}
fmt
.
Printf
(
"InstallOrUpdate version %s
\n
"
,
minikubeVersion
.
String
())
// if the current driver version is older, download newer
if
vmDriverVersion
.
LT
(
minikubeVersion
)
{
return
download
(
driver
,
destination
)
...
...
test/integration/driver_install_or_update_test.go
浏览文件 @
e30fe107
...
...
@@ -20,7 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path
/filepath
"
"runtime"
"testing"
...
...
@@ -42,8 +42,16 @@ func TestDriverInstallOrUpdate(t *testing.T) {
name
string
path
string
}{
{
name
:
"driver-without-version-support"
,
path
:
path
.
Join
(
*
testdataDir
,
"kvm2-driver-without-version"
)},
{
name
:
"driver-with-older-version"
,
path
:
path
.
Join
(
*
testdataDir
,
"kvm2-driver-without-version"
)},
{
name
:
"driver-without-version-support"
,
path
:
filepath
.
Join
(
*
testdataDir
,
"kvm2-driver-without-version"
)},
{
name
:
"driver-with-older-version"
,
path
:
filepath
.
Join
(
*
testdataDir
,
"kvm2-driver-without-version"
)},
}
ingressPath
:=
filepath
.
Join
(
*
testdataDir
,
"nginx-ing.yaml"
)
_
,
err
:=
os
.
Stat
(
ingressPath
)
if
err
!=
nil
{
t
.
Fatalf
(
"Expected ingress-ing to exist. test: %s, got: %v"
,
"TestDriverInstallOrUpdate"
,
err
)
}
else
{
fmt
.
Printf
(
"TestDriverInstallOrUpdate ingress exist at: %s
\n
"
,
ingressPath
)
}
for
_
,
tc
:=
range
tests
{
...
...
@@ -53,6 +61,11 @@ func TestDriverInstallOrUpdate(t *testing.T) {
}
defer
os
.
RemoveAll
(
dir
)
_
,
err
=
os
.
Stat
(
filepath
.
Join
(
tc
.
path
,
"docker-machine-driver-kvm2"
))
if
err
!=
nil
{
t
.
Fatalf
(
"Expected driver to exist. test: %s, got: %v"
,
tc
.
name
,
err
)
}
os
.
Setenv
(
"PATH"
,
fmt
.
Sprintf
(
"%s:%s"
,
tc
.
path
,
os
.
Getenv
(
"PATH"
)))
newerVersion
,
err
:=
semver
.
Make
(
"1.1.3"
)
...
...
@@ -65,7 +78,7 @@ func TestDriverInstallOrUpdate(t *testing.T) {
t
.
Fatalf
(
"Expected to update driver. test: %s, got: %v"
,
tc
.
name
,
err
)
}
_
,
err
=
os
.
Stat
(
path
.
Join
(
dir
,
"docker-machine-driver-kvm2"
))
_
,
err
=
os
.
Stat
(
file
path
.
Join
(
dir
,
"docker-machine-driver-kvm2"
))
if
err
!=
nil
{
t
.
Fatalf
(
"Expected driver to be download. test: %s, got: %v"
,
tc
.
name
,
err
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录