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
246b3892
Commit
246b3892
authored
Feb 29, 2016
by
Tim St. Clair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test-only volume files to test-only volume package
parent
83d74dd9
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
114 additions
and
85 deletions
+114
-85
persistentvolume_claim_binder_controller_test.go
...ntvolume/persistentvolume_claim_binder_controller_test.go
+5
-4
persistentvolume_provisioner_controller_test.go
...entvolume/persistentvolume_provisioner_controller_test.go
+3
-3
persistentvolume_recycler_controller_test.go
...istentvolume/persistentvolume_recycler_controller_test.go
+3
-2
kubelet_test.go
pkg/kubelet/kubelet_test.go
+6
-5
aws_ebs_test.go
pkg/volume/aws_ebs/aws_ebs_test.go
+6
-5
azure_file_test.go
pkg/volume/azure_file/azure_file_test.go
+6
-5
cephfs_test.go
pkg/volume/cephfs/cephfs_test.go
+3
-2
cinder_test.go
pkg/volume/cinder/cinder_test.go
+4
-3
configmap_test.go
pkg/volume/configmap/configmap_test.go
+2
-1
downwardapi_test.go
pkg/volume/downwardapi/downwardapi_test.go
+2
-1
empty_dir_test.go
pkg/volume/empty_dir/empty_dir_test.go
+3
-2
fc_test.go
pkg/volume/fc/fc_test.go
+5
-4
flexvolume_test.go
pkg/volume/flexvolume/flexvolume_test.go
+5
-4
plugin_test.go
pkg/volume/flocker/plugin_test.go
+2
-1
gce_pd_test.go
pkg/volume/gce_pd/gce_pd_test.go
+5
-4
git_repo_test.go
pkg/volume/git_repo/git_repo_test.go
+2
-1
glusterfs_test.go
pkg/volume/glusterfs/glusterfs_test.go
+5
-4
host_path_test.go
pkg/volume/host_path/host_path_test.go
+12
-11
iscsi_test.go
pkg/volume/iscsi/iscsi_test.go
+5
-4
metrics_du_test.go
pkg/volume/metrics_du_test.go
+5
-3
nfs_test.go
pkg/volume/nfs/nfs_test.go
+6
-5
persistent_claim_test.go
pkg/volume/persistent_claim/persistent_claim_test.go
+3
-2
rbd_test.go
pkg/volume/rbd/rbd_test.go
+4
-3
secret_test.go
pkg/volume/secret/secret_test.go
+2
-1
mock_volume.go
pkg/volume/testing/mock_volume.go
+5
-2
testing.go
pkg/volume/testing/testing.go
+2
-1
persistent_volumes_test.go
test/integration/persistent_volumes_test.go
+3
-2
No files found.
pkg/controller/persistentvolume/persistentvolume_claim_binder_controller_test.go
View file @
246b3892
...
...
@@ -33,6 +33,7 @@ import (
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/host_path"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestRunStop
(
t
*
testing
.
T
)
{
...
...
@@ -123,7 +124,7 @@ func TestClaimRace(t *testing.T) {
mockClient
.
volume
=
v
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
// adds the volume to the index, making the volume available
syncVolume
(
volumeIndex
,
mockClient
,
v
)
if
mockClient
.
volume
.
Status
.
Phase
!=
api
.
VolumeAvailable
{
...
...
@@ -209,7 +210,7 @@ func TestNewClaimWithSameNameAsOldClaim(t *testing.T) {
}
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
syncVolume
(
volumeIndex
,
mockClient
,
v
)
if
mockClient
.
volume
.
Status
.
Phase
!=
api
.
VolumeReleased
{
...
...
@@ -282,7 +283,7 @@ func TestClaimSyncAfterVolumeProvisioning(t *testing.T) {
}
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
// adds the volume to the index, making the volume available.
// pv also completed provisioning, so syncClaim should cause claim's phase to advance to Bound
...
...
@@ -461,7 +462,7 @@ func TestBindingWithExamples(t *testing.T) {
}
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
recycler
:=
&
PersistentVolumeRecycler
{
kubeClient
:
clientset
,
...
...
pkg/controller/persistentvolume/persistentvolume_provisioner_controller_test.go
View file @
246b3892
...
...
@@ -28,7 +28,7 @@ import (
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
fake_cloud
"k8s.io/kubernetes/pkg/cloudprovider/providers/fake"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/volume
"
volumetest
"k8s.io/kubernetes/pkg/volume/testing
"
"k8s.io/kubernetes/pkg/watch"
)
...
...
@@ -92,9 +92,9 @@ func makeTestClaim() *api.PersistentVolumeClaim {
}
}
func
makeTestController
()
(
*
PersistentVolumeProvisionerController
,
*
mockControllerClient
,
*
volume
.
FakeVolumePlugin
)
{
func
makeTestController
()
(
*
PersistentVolumeProvisionerController
,
*
mockControllerClient
,
*
volume
test
.
FakeVolumePlugin
)
{
mockClient
:=
&
mockControllerClient
{}
mockVolumePlugin
:=
&
volume
.
FakeVolumePlugin
{}
mockVolumePlugin
:=
&
volume
test
.
FakeVolumePlugin
{}
controller
,
_
:=
NewPersistentVolumeProvisionerController
(
mockClient
,
1
*
time
.
Second
,
"fake-kubernetes"
,
nil
,
mockVolumePlugin
,
&
fake_cloud
.
FakeCloud
{})
return
controller
,
mockClient
,
mockVolumePlugin
}
...
...
pkg/controller/persistentvolume/persistentvolume_recycler_controller_test.go
View file @
246b3892
...
...
@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/host_path"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
const
(
...
...
@@ -84,7 +85,7 @@ func TestRecyclingRetry(t *testing.T) {
plugMgr
:=
volume
.
VolumePluginMgr
{}
// Use a fake NewRecycler function
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newFailingMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newFailingMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
// Reset a global call counter
failedCallCount
=
0
...
...
@@ -126,7 +127,7 @@ func TestRecyclingRetryAlwaysFail(t *testing.T) {
plugMgr
:=
volume
.
VolumePluginMgr
{}
// Use a fake NewRecycler function
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newAlwaysFailingMockRecycler
,
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
host_path
.
ProbeRecyclableVolumePlugins
(
newAlwaysFailingMockRecycler
,
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
// Reset a global call counter
failedCallCount
=
0
...
...
pkg/kubelet/kubelet_test.go
View file @
246b3892
...
...
@@ -66,6 +66,7 @@ import (
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/pkg/volume"
_
"k8s.io/kubernetes/pkg/volume/host_path"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
init
()
{
...
...
@@ -483,7 +484,7 @@ func TestSyncPodsDeletesWhenSourcesAreReady(t *testing.T) {
func
TestMountExternalVolumes
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
)
kubelet
:=
testKubelet
.
kubelet
plug
:=
&
volume
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
plug
:=
&
volume
test
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
kubelet
.
volumePluginMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
plug
},
&
volumeHost
{
kubelet
})
pod
:=
api
.
Pod
{
...
...
@@ -522,7 +523,7 @@ func TestMountExternalVolumes(t *testing.T) {
func
TestGetPodVolumesFromDisk
(
t
*
testing
.
T
)
{
testKubelet
:=
newTestKubelet
(
t
)
kubelet
:=
testKubelet
.
kubelet
plug
:=
&
volume
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
plug
:=
&
volume
test
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
kubelet
.
volumePluginMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
plug
},
&
volumeHost
{
kubelet
})
volsOnDisk
:=
[]
struct
{
...
...
@@ -536,7 +537,7 @@ func TestGetPodVolumesFromDisk(t *testing.T) {
expectedPaths
:=
[]
string
{}
for
i
:=
range
volsOnDisk
{
fv
:=
volume
.
FakeVolume
{
PodUID
:
volsOnDisk
[
i
]
.
podUID
,
VolName
:
volsOnDisk
[
i
]
.
volName
,
Plugin
:
plug
}
fv
:=
volume
test
.
FakeVolume
{
PodUID
:
volsOnDisk
[
i
]
.
podUID
,
VolName
:
volsOnDisk
[
i
]
.
volName
,
Plugin
:
plug
}
fv
.
SetUp
(
nil
)
expectedPaths
=
append
(
expectedPaths
,
fv
.
GetPath
())
}
...
...
@@ -568,7 +569,7 @@ func TestCleanupOrphanedVolumes(t *testing.T) {
kubelet
:=
testKubelet
.
kubelet
kubelet
.
mounter
=
&
mount
.
FakeMounter
{}
kubeClient
:=
testKubelet
.
fakeKubeClient
plug
:=
&
volume
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
plug
:=
&
volume
test
.
FakeVolumePlugin
{
PluginName
:
"fake"
,
Host
:
nil
}
kubelet
.
volumePluginMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
plug
},
&
volumeHost
{
kubelet
})
// create a volume "on disk"
...
...
@@ -581,7 +582,7 @@ func TestCleanupOrphanedVolumes(t *testing.T) {
pathsOnDisk
:=
[]
string
{}
for
i
:=
range
volsOnDisk
{
fv
:=
volume
.
FakeVolume
{
PodUID
:
volsOnDisk
[
i
]
.
podUID
,
VolName
:
volsOnDisk
[
i
]
.
volName
,
Plugin
:
plug
}
fv
:=
volume
test
.
FakeVolume
{
PodUID
:
volsOnDisk
[
i
]
.
podUID
,
VolName
:
volsOnDisk
[
i
]
.
volName
,
Plugin
:
plug
}
fv
.
SetUp
(
nil
)
pathsOnDisk
=
append
(
pathsOnDisk
,
fv
.
GetPath
())
}
...
...
pkg/volume/aws_ebs/aws_ebs_test.go
View file @
246b3892
...
...
@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -38,7 +39,7 @@ func TestCanSupport(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/aws-ebs"
)
if
err
!=
nil
{
...
...
@@ -62,7 +63,7 @@ func TestGetAccessModes(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/aws-ebs"
)
if
err
!=
nil
{
...
...
@@ -134,7 +135,7 @@ func TestPlugin(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/aws-ebs"
)
if
err
!=
nil
{
...
...
@@ -285,7 +286,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
clientset
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
clientset
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
awsElasticBlockStorePluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
@@ -305,7 +306,7 @@ func TestBuilderAndCleanerTypeAssert(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/aws-ebs"
)
if
err
!=
nil
{
...
...
pkg/volume/azure_file/azure_file_test.go
View file @
246b3892
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -36,7 +37,7 @@ func TestCanSupport(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/azure-file"
)
if
err
!=
nil
{
...
...
@@ -60,7 +61,7 @@ func TestGetAccessModes(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/azure-file"
)
if
err
!=
nil
{
...
...
@@ -87,7 +88,7 @@ func TestPlugin(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/azure-file"
)
if
err
!=
nil
{
...
...
@@ -184,7 +185,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
azureFilePluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
@@ -210,7 +211,7 @@ func TestBuilderAndCleanerTypeAssert(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/azure-file"
)
if
err
!=
nil
{
...
...
pkg/volume/cephfs/cephfs_test.go
View file @
246b3892
...
...
@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -35,7 +36,7 @@ func TestCanSupport(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/cephfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -58,7 +59,7 @@ func TestPlugin(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/cephfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
pkg/volume/cinder/cinder_test.go
View file @
246b3892
...
...
@@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -42,7 +43,7 @@ func TestCanSupport(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/cinder"
)
if
err
!=
nil
{
...
...
@@ -138,7 +139,7 @@ func TestPlugin(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/cinder"
)
if
err
!=
nil
{
...
...
@@ -251,7 +252,7 @@ func TestAttachDetachRace(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
host
:=
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
)
host
:=
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
host
)
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/cinder"
)
...
...
pkg/volume/configmap/configmap_test.go
View file @
246b3892
...
...
@@ -31,6 +31,7 @@ import (
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/volume/util"
)
...
...
@@ -183,7 +184,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
t
.
Fatalf
(
"can't make a temp rootdir: %v"
,
err
)
}
return
tempDir
,
volume
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
return
tempDir
,
volume
test
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
}
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
pkg/volume/downwardapi/downwardapi_test.go
View file @
246b3892
...
...
@@ -30,6 +30,7 @@ import (
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
formatMap
(
m
map
[
string
]
string
)
(
fmtstr
string
)
{
...
...
@@ -45,7 +46,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
if
err
!=
nil
{
t
.
Fatalf
(
"can't make a temp rootdir: %v"
,
err
)
}
return
tempDir
,
volume
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
return
tempDir
,
volume
test
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
}
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
pkg/volume/empty_dir/empty_dir_test.go
View file @
246b3892
...
...
@@ -28,13 +28,14 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/volume/util"
)
// Construct an instance of a plugin, by name.
func
makePluginUnderTest
(
t
*
testing
.
T
,
plugName
,
basePath
string
)
volume
.
VolumePlugin
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
basePath
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
basePath
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
plugName
)
if
err
!=
nil
{
...
...
@@ -300,7 +301,7 @@ func TestMetrics(t *testing.T) {
// Need to create the subdirectory
os
.
MkdirAll
(
builder
.
GetPath
(),
0755
)
expectedEmptyDirUsage
,
err
:=
volume
.
FindEmptyDirectoryUsageOnTmpfs
()
expectedEmptyDirUsage
,
err
:=
volume
test
.
FindEmptyDirectoryUsageOnTmpfs
()
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error finding expected empty directory usage on tmpfs: %v"
,
err
)
}
...
...
pkg/volume/fc/fc_test.go
View file @
246b3892
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -37,7 +38,7 @@ func TestCanSupport(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/fc"
)
if
err
!=
nil
{
...
...
@@ -59,7 +60,7 @@ func TestGetAccessModes(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/fc"
)
if
err
!=
nil
{
...
...
@@ -130,7 +131,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/fc"
)
if
err
!=
nil
{
...
...
@@ -273,7 +274,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
fcPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/flexvolume/flexvolume_test.go
View file @
246b3892
...
...
@@ -30,6 +30,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
const
execScriptTempl1
=
`#!/bin/bash
...
...
@@ -180,7 +181,7 @@ func TestCanSupport(t *testing.T) {
plugMgr
:=
volume
.
VolumePluginMgr
{}
installPluginUnderTest
(
t
,
"kubernetes.io"
,
"fakeAttacher"
,
tmpDir
,
execScriptTempl1
,
nil
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
test
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plugin
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/fakeAttacher"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -208,7 +209,7 @@ func TestGetAccessModes(t *testing.T) {
plugMgr
:=
volume
.
VolumePluginMgr
{}
installPluginUnderTest
(
t
,
"kubernetes.io"
,
"fakeAttacher"
,
tmpDir
,
execScriptTempl1
,
nil
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugin
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/fakeAttacher"
)
if
err
!=
nil
{
...
...
@@ -231,7 +232,7 @@ func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeA
func
doTestPluginAttachDetach
(
t
*
testing
.
T
,
spec
*
volume
.
Spec
,
tmpDir
string
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
installPluginUnderTest
(
t
,
"kubernetes.io"
,
"fakeAttacher"
,
tmpDir
,
execScriptTempl1
,
nil
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugin
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/fakeAttacher"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -310,7 +311,7 @@ func doTestPluginMountUnmount(t *testing.T, spec *volume.Spec, tmpDir string) {
plugMgr
:=
volume
.
VolumePluginMgr
{}
installPluginUnderTest
(
t
,
"kubernetes.io"
,
"fakeMounter"
,
tmpDir
,
execScriptTempl2
,
nil
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
tmpDir
),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugin
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/fakeMounter"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
pkg/volume/flocker/plugin_test.go
View file @
246b3892
...
...
@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/types"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
const
pluginName
=
"kubernetes.io/flocker"
...
...
@@ -34,7 +35,7 @@ func newInitializedVolumePlugMgr(t *testing.T) (volume.VolumePluginMgr, string)
plugMgr
:=
volume
.
VolumePluginMgr
{}
dir
,
err
:=
utiltesting
.
MkTmpdir
(
"flocker"
)
assert
.
NoError
(
t
,
err
)
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
dir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
dir
,
nil
,
nil
))
return
plugMgr
,
dir
}
...
...
pkg/volume/gce_pd/gce_pd_test.go
View file @
246b3892
...
...
@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -38,7 +39,7 @@ func TestCanSupport(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/gce-pd"
)
if
err
!=
nil
{
...
...
@@ -62,7 +63,7 @@ func TestGetAccessModes(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/gce-pd"
)
if
err
!=
nil
{
...
...
@@ -130,7 +131,7 @@ func TestPlugin(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/gce-pd"
)
if
err
!=
nil
{
...
...
@@ -281,7 +282,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
}
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
gcePersistentDiskPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/git_repo/git_repo_test.go
View file @
246b3892
...
...
@@ -30,6 +30,7 @@ import (
"k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
newTestHost
(
t
*
testing
.
T
)
(
string
,
volume
.
VolumeHost
)
{
...
...
@@ -37,7 +38,7 @@ func newTestHost(t *testing.T) (string, volume.VolumeHost) {
if
err
!=
nil
{
t
.
Fatalf
(
"can't make a temp rootdir: %v"
,
err
)
}
return
tempDir
,
volume
.
NewFakeVolumeHost
(
tempDir
,
nil
,
empty_dir
.
ProbeVolumePlugins
())
return
tempDir
,
volume
test
.
NewFakeVolumeHost
(
tempDir
,
nil
,
empty_dir
.
ProbeVolumePlugins
())
}
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
pkg/volume/glusterfs/glusterfs_test.go
View file @
246b3892
...
...
@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -38,7 +39,7 @@ func TestCanSupport(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/glusterfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -62,7 +63,7 @@ func TestGetAccessModes(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/glusterfs"
)
if
err
!=
nil
{
...
...
@@ -90,7 +91,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/glusterfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -222,7 +223,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
,
ep
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
glusterfsPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/host_path/host_path_test.go
View file @
246b3892
...
...
@@ -30,11 +30,12 @@ import (
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/host-path"
)
if
err
!=
nil
{
...
...
@@ -56,7 +57,7 @@ func TestCanSupport(t *testing.T) {
func
TestGetAccessModes
(
t
*
testing
.
T
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/host-path"
)
if
err
!=
nil
{
...
...
@@ -69,8 +70,8 @@ func TestGetAccessModes(t *testing.T) {
func
TestRecycler
(
t
*
testing
.
T
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
pluginHost
:=
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
)
plugMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
&
hostPathPlugin
{
nil
,
volume
.
NewFakeRecycler
,
nil
,
nil
,
volume
.
VolumeConfig
{}}},
pluginHost
)
pluginHost
:=
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
)
plugMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
&
hostPathPlugin
{
nil
,
volume
test
.
NewFakeRecycler
,
nil
,
nil
,
volume
.
VolumeConfig
{}}},
pluginHost
)
spec
:=
&
volume
.
Spec
{
PersistentVolume
:
&
api
.
PersistentVolume
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
HostPath
:
&
api
.
HostPathVolumeSource
{
Path
:
"/foo"
}}}}}
plug
,
err
:=
plugMgr
.
FindRecyclablePluginBySpec
(
spec
)
...
...
@@ -99,7 +100,7 @@ func TestDeleter(t *testing.T) {
}
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
spec
:=
&
volume
.
Spec
{
PersistentVolume
:
&
api
.
PersistentVolume
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
HostPath
:
&
api
.
HostPathVolumeSource
{
Path
:
tempPath
}}}}}
plug
,
err
:=
plugMgr
.
FindDeletablePluginBySpec
(
spec
)
...
...
@@ -133,7 +134,7 @@ func TestDeleterTempDir(t *testing.T) {
for
name
,
test
:=
range
tests
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
spec
:=
&
volume
.
Spec
{
PersistentVolume
:
&
api
.
PersistentVolume
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
HostPath
:
&
api
.
HostPathVolumeSource
{
Path
:
test
.
path
}}}}}
plug
,
_
:=
plugMgr
.
FindDeletablePluginBySpec
(
spec
)
deleter
,
_
:=
plug
.
NewDeleter
(
spec
)
...
...
@@ -153,7 +154,7 @@ func TestProvisioner(t *testing.T) {
err
:=
os
.
MkdirAll
(
tempPath
,
0750
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
))
spec
:=
&
volume
.
Spec
{
PersistentVolume
:
&
api
.
PersistentVolume
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
HostPath
:
&
api
.
HostPathVolumeSource
{
Path
:
tempPath
}}}}}
plug
,
err
:=
plugMgr
.
FindCreatablePluginBySpec
(
spec
)
if
err
!=
nil
{
...
...
@@ -187,7 +188,7 @@ func TestProvisioner(t *testing.T) {
func
TestPlugin
(
t
*
testing
.
T
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"fake"
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/host-path"
)
if
err
!=
nil
{
...
...
@@ -259,7 +260,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
hostPathPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
@@ -282,7 +283,7 @@ func TestMetrics(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/host-path"
)
if
err
!=
nil
{
...
...
@@ -298,7 +299,7 @@ func TestMetrics(t *testing.T) {
t
.
Errorf
(
"Failed to make a new Builder: %v"
,
err
)
}
expectedEmptyDirUsage
,
err
:=
volume
.
FindEmptyDirectoryUsageOnTmpfs
()
expectedEmptyDirUsage
,
err
:=
volume
test
.
FindEmptyDirectoryUsageOnTmpfs
()
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error finding expected empty directory usage on tmpfs: %v"
,
err
)
}
...
...
pkg/volume/iscsi/iscsi_test.go
View file @
246b3892
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -37,7 +38,7 @@ func TestCanSupport(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/iscsi"
)
if
err
!=
nil
{
...
...
@@ -59,7 +60,7 @@ func TestGetAccessModes(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/iscsi"
)
if
err
!=
nil
{
...
...
@@ -130,7 +131,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/iscsi"
)
if
err
!=
nil
{
...
...
@@ -273,7 +274,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
iscsiPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/metrics_du_test.go
View file @
246b3892
...
...
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
volume
package
volume
_test
import
(
"io/ioutil"
...
...
@@ -25,6 +25,8 @@ import (
"testing"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
.
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
const
expectedBlockSize
=
4096
...
...
@@ -39,7 +41,7 @@ func TestMetricsDuGetCapacity(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
metrics
:=
NewMetricsDu
(
tmpDir
)
expectedEmptyDirUsage
,
err
:=
FindEmptyDirectoryUsageOnTmpfs
()
expectedEmptyDirUsage
,
err
:=
volumetest
.
FindEmptyDirectoryUsageOnTmpfs
()
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error finding expected empty directory usage on tmpfs: %v"
,
err
)
}
...
...
@@ -75,7 +77,7 @@ func TestMetricsDuGetCapacity(t *testing.T) {
// TestMetricsDuRequireInit tests that if MetricsDu is not initialized with a path, GetMetrics
// returns an error
func
TestMetricsDuRequirePath
(
t
*
testing
.
T
)
{
metrics
:=
&
metricsDu
{}
metrics
:=
NewMetricsDu
(
""
)
actual
,
err
:=
metrics
.
GetMetrics
()
expected
:=
&
Metrics
{}
if
*
actual
!=
*
expected
{
...
...
pkg/volume/nfs/nfs_test.go
View file @
246b3892
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -37,7 +38,7 @@ func TestCanSupport(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/nfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -64,7 +65,7 @@ func TestGetAccessModes(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPersistentPluginByName
(
"kubernetes.io/nfs"
)
if
err
!=
nil
{
...
...
@@ -83,7 +84,7 @@ func TestRecycler(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
&
nfsPlugin
{
nil
,
newMockRecycler
,
volume
.
VolumeConfig
{}}},
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
([]
volume
.
VolumePlugin
{
&
nfsPlugin
{
nil
,
newMockRecycler
,
volume
.
VolumeConfig
{}}},
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
spec
:=
&
volume
.
Spec
{
PersistentVolume
:
&
api
.
PersistentVolume
{
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeSource
:
api
.
PersistentVolumeSource
{
NFS
:
&
api
.
NFSVolumeSource
{
Path
:
"/foo"
}}}}}
plug
,
err
:=
plugMgr
.
FindRecyclablePluginBySpec
(
spec
)
...
...
@@ -140,7 +141,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/nfs"
)
if
err
!=
nil
{
t
.
Errorf
(
"Can't find the plugin by name"
)
...
...
@@ -268,7 +269,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(
volume
.
VolumeConfig
{}),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
nfsPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/persistent_claim/persistent_claim_test.go
View file @
246b3892
...
...
@@ -31,6 +31,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/gce_pd"
"k8s.io/kubernetes/pkg/volume/host_path"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
// newTestHost returns the temp directory and the VolumeHost created.
...
...
@@ -40,12 +41,12 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
if
err
!=
nil
{
t
.
Fatalf
(
"can't make a temp rootdir: %v"
,
err
)
}
return
tempDir
,
volume
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
testProbeVolumePlugins
())
return
tempDir
,
volume
test
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
testProbeVolumePlugins
())
}
func
TestCanSupport
(
t
*
testing
.
T
)
{
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
"/somepath/fake"
,
nil
,
ProbeVolumePlugins
()))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
"/somepath/fake"
,
nil
,
ProbeVolumePlugins
()))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/persistent-claim"
)
if
err
!=
nil
{
...
...
pkg/volume/rbd/rbd_test.go
View file @
246b3892
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utiltesting
"k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
)
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
@@ -37,7 +38,7 @@ func TestCanSupport(t *testing.T) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/rbd"
)
if
err
!=
nil
{
...
...
@@ -94,7 +95,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
defer
os
.
RemoveAll
(
tmpDir
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
nil
,
nil
))
plug
,
err
:=
plugMgr
.
FindPluginByName
(
"kubernetes.io/rbd"
)
if
err
!=
nil
{
...
...
@@ -225,7 +226,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
client
:=
fake
.
NewSimpleClientset
(
pv
,
claim
)
plugMgr
:=
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
volume
test
.
NewFakeVolumeHost
(
tmpDir
,
client
,
nil
))
plug
,
_
:=
plugMgr
.
FindPluginByName
(
rbdPluginName
)
// readOnly bool is supplied by persistent-claim volume source when its builder creates other volumes
...
...
pkg/volume/secret/secret_test.go
View file @
246b3892
...
...
@@ -32,6 +32,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/empty_dir"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/volume/util"
"github.com/stretchr/testify/assert"
...
...
@@ -43,7 +44,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
t
.
Fatalf
(
"can't make a temp rootdir: %v"
,
err
)
}
return
tempDir
,
volume
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
return
tempDir
,
volume
test
.
NewFakeVolumeHost
(
tempDir
,
clientset
,
empty_dir
.
ProbeVolumePlugins
())
}
func
TestCanSupport
(
t
*
testing
.
T
)
{
...
...
pkg/volume/mock_volume.go
→
pkg/volume/
testing/
mock_volume.go
View file @
246b3892
...
...
@@ -14,9 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
volume
package
testing
import
"github.com/stretchr/testify/mock"
import
(
"github.com/stretchr/testify/mock"
.
"k8s.io/kubernetes/pkg/volume"
)
// ORIGINALLY GENERATED BY mockery with hand edits
...
...
pkg/volume/testing.go
→
pkg/volume/testing
/testing
.go
View file @
246b3892
...
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package
volume
package
testing
import
(
"fmt"
...
...
@@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/util/io"
"k8s.io/kubernetes/pkg/util/mount"
utilstrings
"k8s.io/kubernetes/pkg/util/strings"
.
"k8s.io/kubernetes/pkg/volume"
)
// fakeVolumeHost is useful for testing volume plugins.
...
...
test/integration/persistent_volumes_test.go
View file @
246b3892
...
...
@@ -33,6 +33,7 @@ import (
persistentvolumecontroller
"k8s.io/kubernetes/pkg/controller/persistentvolume"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/volume"
volumetest
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/test/integration/framework"
)
...
...
@@ -52,9 +53,9 @@ func TestPersistentVolumeRecycler(t *testing.T) {
binderClient
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
s
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()},
QPS
:
1000
,
Burst
:
100000
})
recyclerClient
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
s
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()},
QPS
:
1000
,
Burst
:
100000
})
testClient
:=
clientset
.
NewForConfigOrDie
(
&
restclient
.
Config
{
Host
:
s
.
URL
,
ContentConfig
:
restclient
.
ContentConfig
{
GroupVersion
:
testapi
.
Default
.
GroupVersion
()},
QPS
:
1000
,
Burst
:
100000
})
host
:=
volume
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
)
host
:=
volume
test
.
NewFakeVolumeHost
(
"/tmp/fake"
,
nil
,
nil
)
plugins
:=
[]
volume
.
VolumePlugin
{
&
volume
.
FakeVolumePlugin
{
"plugin-name"
,
host
,
volume
.
VolumeConfig
{},
volume
.
VolumeOptions
{},
0
,
0
}}
plugins
:=
[]
volume
.
VolumePlugin
{
&
volume
test
.
FakeVolumePlugin
{
"plugin-name"
,
host
,
volume
.
VolumeConfig
{},
volume
.
VolumeOptions
{},
0
,
0
}}
cloud
:=
&
fake_cloud
.
FakeCloud
{}
binder
:=
persistentvolumecontroller
.
NewPersistentVolumeClaimBinder
(
binderClient
,
10
*
time
.
Second
)
...
...
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