Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
7367c72a
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,发现更多精彩内容 >>
未验证
提交
7367c72a
编写于
7月 08, 2020
作者:
P
priyawadhwa
提交者:
GitHub
7月 08, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8490 from zhijianli88/cleanup
A few cleanup
上级
9530159a
0b68d1d9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
21 addition
and
51 deletion
+21
-51
Makefile
Makefile
+0
-0
cmd/minikube/cmd/root_test.go
cmd/minikube/cmd/root_test.go
+1
-1
pkg/drivers/common_test.go
pkg/drivers/common_test.go
+1
-1
pkg/drivers/hyperkit/network_test.go
pkg/drivers/hyperkit/network_test.go
+1
-1
pkg/minikube/bootstrapper/certs_test.go
pkg/minikube/bootstrapper/certs_test.go
+1
-1
pkg/minikube/machine/client_test.go
pkg/minikube/machine/client_test.go
+5
-23
pkg/minikube/machine/filesync_test.go
pkg/minikube/machine/filesync_test.go
+3
-22
pkg/minikube/notify/notify_test.go
pkg/minikube/notify/notify_test.go
+2
-2
pkg/minikube/tests/dir_utils.go
pkg/minikube/tests/dir_utils.go
+7
-0
未找到文件。
Makefile
100755 → 100644
浏览文件 @
7367c72a
文件模式从 100755 更改为 100644
cmd/minikube/cmd/root_test.go
浏览文件 @
7367c72a
...
...
@@ -115,7 +115,7 @@ func hideEnv(t *testing.T) func(t *testing.T) {
func
TestPreRunDirectories
(
t
*
testing
.
T
)
{
// Make sure we create the required directories.
tempDir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tempDir
)
defer
tests
.
RemoveTempDir
(
tempDir
)
runCommand
(
RootCmd
.
PersistentPreRun
)
...
...
pkg/drivers/common_test.go
浏览文件 @
7367c72a
...
...
@@ -27,7 +27,7 @@ import (
func
Test_createDiskImage
(
t
*
testing
.
T
)
{
tmpdir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tmpdir
)
defer
tests
.
RemoveTempDir
(
tmpdir
)
sshPath
:=
filepath
.
Join
(
tmpdir
,
"ssh"
)
if
err
:=
ioutil
.
WriteFile
(
sshPath
,
[]
byte
(
"mysshkey"
),
0644
);
err
!=
nil
{
...
...
pkg/drivers/hyperkit/network_test.go
浏览文件 @
7367c72a
...
...
@@ -51,7 +51,7 @@ var validLeases = []byte(`{
func
Test_getIpAddressFromFile
(
t
*
testing
.
T
)
{
tmpdir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tmpdir
)
defer
tests
.
RemoveTempDir
(
tmpdir
)
dhcpFile
:=
filepath
.
Join
(
tmpdir
,
"dhcp"
)
if
err
:=
ioutil
.
WriteFile
(
dhcpFile
,
validLeases
,
0644
);
err
!=
nil
{
...
...
pkg/minikube/bootstrapper/certs_test.go
浏览文件 @
7367c72a
...
...
@@ -30,7 +30,7 @@ import (
func
TestSetupCerts
(
t
*
testing
.
T
)
{
tempDir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tempDir
)
defer
tests
.
RemoveTempDir
(
tempDir
)
k8s
:=
config
.
KubernetesConfig
{
APIServerName
:
constants
.
APIServerName
,
...
...
pkg/minikube/machine/client_test.go
浏览文件 @
7367c72a
...
...
@@ -19,18 +19,15 @@ package machine
import
(
"bufio"
"fmt"
"io/ioutil"
"log"
"net"
"os"
"path/filepath"
"testing"
"github.com/docker/machine/libmachine/drivers/plugin/localbinary"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/localpath"
_
"k8s.io/minikube/pkg/minikube/registry/drvs/virtualbox"
testutil
"k8s.io/minikube/pkg/minikube/tests"
)
const
vboxConfig
=
`
...
...
@@ -113,24 +110,9 @@ func TestLocalClientNewHost(t *testing.T) {
}
}
func
makeTempDir
()
string
{
tempDir
,
err
:=
ioutil
.
TempDir
(
""
,
"minipath"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
tempDir
=
filepath
.
Join
(
tempDir
,
".minikube"
)
os
.
Setenv
(
localpath
.
MinikubeHome
,
tempDir
)
return
localpath
.
MiniPath
()
}
func
TestRunNotDriver
(
t
*
testing
.
T
)
{
tempDir
:=
makeTempDir
()
defer
func
()
{
//clean up tempdir
err
:=
os
.
RemoveAll
(
tempDir
)
if
err
!=
nil
{
t
.
Errorf
(
"failed to clean up temp folder %q"
,
tempDir
)
}
}()
tempDir
:=
testutil
.
MakeTempDir
()
defer
testutil
.
RemoveTempDir
(
tempDir
)
StartDriver
()
if
!
localbinary
.
CurrentBinaryIsDockerMachine
{
t
.
Fatal
(
"CurrentBinaryIsDockerMachine not set. This will break driver initialization."
)
...
...
@@ -140,8 +122,8 @@ func TestRunNotDriver(t *testing.T) {
func
TestRunDriver
(
t
*
testing
.
T
)
{
// This test is a bit complicated. It verifies that when the root command is
// called with the proper environment variables, we setup the libmachine driver.
tempDir
:=
m
akeTempDir
()
defer
os
.
RemoveAll
(
tempDir
)
tempDir
:=
testutil
.
M
akeTempDir
()
defer
testutil
.
RemoveTempDir
(
tempDir
)
os
.
Setenv
(
localbinary
.
PluginEnvKey
,
localbinary
.
PluginEnvVal
)
os
.
Setenv
(
localbinary
.
PluginEnvDriverName
,
driver
.
VirtualBox
)
...
...
pkg/minikube/machine/filesync_test.go
浏览文件 @
7367c72a
...
...
@@ -17,26 +17,16 @@ limitations under the License.
package
machine
import
(
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/google/go-cmp/cmp"
"k8s.io/minikube/pkg/minikube/localpath"
testutil
"k8s.io/minikube/pkg/minikube/tests"
"k8s.io/minikube/pkg/minikube/vmpath"
)
func
setupTestDir
()
(
string
,
error
)
{
path
,
err
:=
ioutil
.
TempDir
(
""
,
"minipath"
)
if
err
!=
nil
{
return
""
,
err
}
os
.
Setenv
(
localpath
.
MinikubeHome
,
path
)
return
path
,
err
}
func
TestAssetsFromDir
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
description
string
...
...
@@ -107,17 +97,8 @@ func TestAssetsFromDir(t *testing.T) {
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
description
,
func
(
t
*
testing
.
T
)
{
testDir
,
err
:=
setupTestDir
()
defer
func
()
{
//clean up tempdir
err
:=
os
.
RemoveAll
(
testDir
)
if
err
!=
nil
{
t
.
Errorf
(
"failed to clean up temp folder %q"
,
testDir
)
}
}()
if
err
!=
nil
{
t
.
Errorf
(
"got unexpected error creating test dir: %v"
,
err
)
return
}
testDir
:=
testutil
.
MakeTempDir
()
defer
testutil
.
RemoveTempDir
(
testDir
)
testDirs
=
append
(
testDirs
,
testDir
)
testFileBaseDir
:=
filepath
.
Join
(
testDir
,
test
.
baseDir
)
...
...
pkg/minikube/notify/notify_test.go
浏览文件 @
7367c72a
...
...
@@ -43,7 +43,7 @@ func TestMaybePrintUpdateTextFromGithub(t *testing.T) {
func
TestShouldCheckURL
(
t
*
testing
.
T
)
{
tempDir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tempDir
)
defer
tests
.
RemoveTempDir
(
tempDir
)
lastUpdateCheckFilePath
:=
filepath
.
Join
(
tempDir
,
"last_update_check"
)
...
...
@@ -152,7 +152,7 @@ func TestGetLatestVersionFromURLMalformed(t *testing.T) {
func
TestMaybePrintUpdateText
(
t
*
testing
.
T
)
{
tempDir
:=
tests
.
MakeTempDir
()
defer
os
.
RemoveAll
(
tempDir
)
defer
tests
.
RemoveTempDir
(
tempDir
)
outputBuffer
:=
tests
.
NewFakeFile
()
out
.
SetErrFile
(
outputBuffer
)
...
...
pkg/minikube/tests/dir_utils.go
浏览文件 @
7367c72a
...
...
@@ -45,6 +45,13 @@ func MakeTempDir() string {
return
localpath
.
MiniPath
()
}
func
RemoveTempDir
(
tempdir
string
)
{
if
filepath
.
Base
(
tempdir
)
==
".minikube"
{
tempdir
=
filepath
.
Dir
(
tempdir
)
}
os
.
RemoveAll
(
tempdir
)
}
// FakeFile satisfies fdWriter
type
FakeFile
struct
{
b
bytes
.
Buffer
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录