Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
35b45d60
Commit
35b45d60
authored
Dec 19, 2016
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Fatalf instead of Errorf when mounter/unmounter if nil in volume tests
parent
2b08d1e5
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
11 deletions
+38
-11
azure_file_test.go
pkg/volume/azure_file/azure_file_test.go
+3
-0
configmap_test.go
pkg/volume/configmap/configmap_test.go
+3
-3
downwardapi_test.go
pkg/volume/downwardapi/downwardapi_test.go
+2
-2
empty_dir_test.go
pkg/volume/empty_dir/empty_dir_test.go
+4
-1
fc_test.go
pkg/volume/fc/fc_test.go
+3
-0
gce_pd_test.go
pkg/volume/gce_pd/gce_pd_test.go
+3
-0
host_path_test.go
pkg/volume/host_path/host_path_test.go
+5
-2
iscsi_test.go
pkg/volume/iscsi/iscsi_test.go
+3
-0
nfs_test.go
pkg/volume/nfs/nfs_test.go
+3
-0
quobyte_test.go
pkg/volume/quobyte/quobyte_test.go
+3
-0
rbd_test.go
pkg/volume/rbd/rbd_test.go
+3
-0
secret_test.go
pkg/volume/secret/secret_test.go
+3
-3
No files found.
pkg/volume/azure_file/azure_file_test.go
View file @
35b45d60
...
@@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/configmap/configmap_test.go
View file @
35b45d60
...
@@ -317,7 +317,7 @@ func TestPlugin(t *testing.T) {
...
@@ -317,7 +317,7 @@ func TestPlugin(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
vName
,
err
:=
plugin
.
GetVolumeName
(
volume
.
NewSpecFromVolume
(
volumeSpec
))
vName
,
err
:=
plugin
.
GetVolumeName
(
volume
.
NewSpecFromVolume
(
volumeSpec
))
...
@@ -381,7 +381,7 @@ func TestPluginReboot(t *testing.T) {
...
@@ -381,7 +381,7 @@ func TestPluginReboot(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
podMetadataDir
:=
fmt
.
Sprintf
(
"%v/pods/test_pod_uid3/plugins/kubernetes.io~configmap/test_volume_name"
,
rootDir
)
podMetadataDir
:=
fmt
.
Sprintf
(
"%v/pods/test_pod_uid3/plugins/kubernetes.io~configmap/test_volume_name"
,
rootDir
)
...
@@ -597,7 +597,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo
...
@@ -597,7 +597,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
}
}
if
unmounter
==
nil
{
if
unmounter
==
nil
{
t
.
Error
f
(
"Got a nil Unmounter"
)
t
.
Fatal
f
(
"Got a nil Unmounter"
)
}
}
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
...
...
pkg/volume/downwardapi/downwardapi_test.go
View file @
35b45d60
...
@@ -241,7 +241,7 @@ func newDownwardAPITest(t *testing.T, name string, volumeFiles, podLabels, podAn
...
@@ -241,7 +241,7 @@ func newDownwardAPITest(t *testing.T, name string, volumeFiles, podLabels, podAn
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
volumePath
:=
mounter
.
GetPath
()
volumePath
:=
mounter
.
GetPath
()
...
@@ -278,7 +278,7 @@ func (test *downwardAPITest) tearDown() {
...
@@ -278,7 +278,7 @@ func (test *downwardAPITest) tearDown() {
test
.
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
test
.
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
}
}
if
unmounter
==
nil
{
if
unmounter
==
nil
{
test
.
t
.
Error
f
(
"Got a nil Unmounter"
)
test
.
t
.
Fatal
f
(
"Got a nil Unmounter"
)
}
}
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
...
...
pkg/volume/empty_dir/empty_dir_test.go
View file @
35b45d60
...
@@ -221,7 +221,7 @@ func TestPluginBackCompat(t *testing.T) {
...
@@ -221,7 +221,7 @@ func TestPluginBackCompat(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
volPath
:=
mounter
.
GetPath
()
volPath
:=
mounter
.
GetPath
()
...
@@ -249,6 +249,9 @@ func TestMetrics(t *testing.T) {
...
@@ -249,6 +249,9 @@ func TestMetrics(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
// Need to create the subdirectory
// Need to create the subdirectory
os
.
MkdirAll
(
mounter
.
GetPath
(),
0755
)
os
.
MkdirAll
(
mounter
.
GetPath
(),
0755
)
...
...
pkg/volume/fc/fc_test.go
View file @
35b45d60
...
@@ -362,6 +362,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -362,6 +362,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/gce_pd/gce_pd_test.go
View file @
35b45d60
...
@@ -251,6 +251,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -251,6 +251,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/host_path/host_path_test.go
View file @
35b45d60
...
@@ -225,7 +225,7 @@ func TestPlugin(t *testing.T) {
...
@@ -225,7 +225,7 @@ func TestPlugin(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
path
:=
mounter
.
GetPath
()
path
:=
mounter
.
GetPath
()
...
@@ -242,7 +242,7 @@ func TestPlugin(t *testing.T) {
...
@@ -242,7 +242,7 @@ func TestPlugin(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
}
}
if
unmounter
==
nil
{
if
unmounter
==
nil
{
t
.
Error
f
(
"Got a nil Unmounter"
)
t
.
Fatal
f
(
"Got a nil Unmounter"
)
}
}
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
...
@@ -288,6 +288,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -288,6 +288,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/iscsi/iscsi_test.go
View file @
35b45d60
...
@@ -283,6 +283,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -283,6 +283,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/nfs/nfs_test.go
View file @
35b45d60
...
@@ -247,6 +247,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -247,6 +247,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/quobyte/quobyte_test.go
View file @
35b45d60
...
@@ -194,6 +194,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -194,6 +194,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/rbd/rbd_test.go
View file @
35b45d60
...
@@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
...
@@ -235,6 +235,9 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
pv
,
true
)
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
types
.
UID
(
"poduid"
)}}
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
mounter
,
_
:=
plug
.
NewMounter
(
spec
,
pod
,
volume
.
VolumeOptions
{})
if
mounter
==
nil
{
t
.
Fatalf
(
"Got a nil Mounter"
)
}
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
if
!
mounter
.
GetAttributes
()
.
ReadOnly
{
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
t
.
Errorf
(
"Expected true for mounter.IsReadOnly"
)
...
...
pkg/volume/secret/secret_test.go
View file @
35b45d60
...
@@ -319,7 +319,7 @@ func TestPlugin(t *testing.T) {
...
@@ -319,7 +319,7 @@ func TestPlugin(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
volumePath
:=
mounter
.
GetPath
()
volumePath
:=
mounter
.
GetPath
()
...
@@ -392,7 +392,7 @@ func TestPluginReboot(t *testing.T) {
...
@@ -392,7 +392,7 @@ func TestPluginReboot(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Mounter: %v"
,
err
)
}
}
if
mounter
==
nil
{
if
mounter
==
nil
{
t
.
Error
f
(
"Got a nil Mounter"
)
t
.
Fatal
f
(
"Got a nil Mounter"
)
}
}
podMetadataDir
:=
fmt
.
Sprintf
(
"%v/pods/test_pod_uid3/plugins/kubernetes.io~secret/test_volume_name"
,
rootDir
)
podMetadataDir
:=
fmt
.
Sprintf
(
"%v/pods/test_pod_uid3/plugins/kubernetes.io~secret/test_volume_name"
,
rootDir
)
...
@@ -617,7 +617,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo
...
@@ -617,7 +617,7 @@ func doTestCleanAndTeardown(plugin volume.VolumePlugin, podUID types.UID, testVo
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
t
.
Errorf
(
"Failed to make a new Unmounter: %v"
,
err
)
}
}
if
unmounter
==
nil
{
if
unmounter
==
nil
{
t
.
Error
f
(
"Got a nil Unmounter"
)
t
.
Fatal
f
(
"Got a nil Unmounter"
)
}
}
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
if
err
:=
unmounter
.
TearDown
();
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment