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
522b4b3f
Commit
522b4b3f
authored
Jan 09, 2017
by
Matthew Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add expectedSize arg to testDynamicProvisioning
parent
7184977c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
volume_provisioning.go
test/e2e/volume_provisioning.go
+8
-17
No files found.
test/e2e/volume_provisioning.go
View file @
522b4b3f
...
@@ -34,17 +34,11 @@ import (
...
@@ -34,17 +34,11 @@ import (
const
(
const
(
// Requested size of the volume
// Requested size of the volume
requestedSize
=
"1500Mi"
requestedSize
=
"1500Mi"
// Expected size of the volume is 2GiB, because all three supported cloud
// providers allocate volumes in 1GiB chunks.
expectedSize
=
"2Gi"
// Expected size of the externally provisioned volume depends on the external
// provisioner: for nfs-provisioner used here, it's equal to requested
externalExpectedSize
=
"1500Mi"
// Plugin name of the external provisioner
// Plugin name of the external provisioner
externalPluginName
=
"example.com/nfs"
externalPluginName
=
"example.com/nfs"
)
)
func
testDynamicProvisioning
(
client
clientset
.
Interface
,
claim
*
v1
.
PersistentVolumeClaim
,
ex
ternal
bool
)
{
func
testDynamicProvisioning
(
client
clientset
.
Interface
,
claim
*
v1
.
PersistentVolumeClaim
,
ex
pectedSize
string
)
{
err
:=
framework
.
WaitForPersistentVolumeClaimPhase
(
v1
.
ClaimBound
,
client
,
claim
.
Namespace
,
claim
.
Name
,
framework
.
Poll
,
framework
.
ClaimProvisionTimeout
)
err
:=
framework
.
WaitForPersistentVolumeClaimPhase
(
v1
.
ClaimBound
,
client
,
claim
.
Namespace
,
claim
.
Name
,
framework
.
Poll
,
framework
.
ClaimProvisionTimeout
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
@@ -59,9 +53,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
...
@@ -59,9 +53,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
// Check sizes
// Check sizes
expectedCapacity
:=
resource
.
MustParse
(
expectedSize
)
expectedCapacity
:=
resource
.
MustParse
(
expectedSize
)
if
external
{
expectedCapacity
=
resource
.
MustParse
(
externalExpectedSize
)
}
pvCapacity
:=
pv
.
Spec
.
Capacity
[
v1
.
ResourceName
(
v1
.
ResourceStorage
)]
pvCapacity
:=
pv
.
Spec
.
Capacity
[
v1
.
ResourceName
(
v1
.
ResourceStorage
)]
Expect
(
pvCapacity
.
Value
())
.
To
(
Equal
(
expectedCapacity
.
Value
()))
Expect
(
pvCapacity
.
Value
())
.
To
(
Equal
(
expectedCapacity
.
Value
()))
...
@@ -87,7 +78,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
...
@@ -87,7 +78,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
By
(
"checking the created volume is readable and retains data"
)
By
(
"checking the created volume is readable and retains data"
)
runInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
"grep 'hello world' /mnt/test/data"
)
runInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
"grep 'hello world' /mnt/test/data"
)
if
!
external
{
// Ugly hack: if we delete the AWS/GCE/OpenStack volume here, it will
// Ugly hack: if we delete the AWS/GCE/OpenStack volume here, it will
// probably collide with destruction of the pods above - the pods
// probably collide with destruction of the pods above - the pods
// still have the volume attached (kubelet is slow...) and deletion
// still have the volume attached (kubelet is slow...) and deletion
...
@@ -103,7 +93,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
...
@@ -103,7 +93,6 @@ func testDynamicProvisioning(client clientset.Interface, claim *v1.PersistentVol
// We've seen GCE PD detach to take more than 1 minute.
// We've seen GCE PD detach to take more than 1 minute.
By
(
"Sleeping to let kubelet destroy all pods"
)
By
(
"Sleeping to let kubelet destroy all pods"
)
time
.
Sleep
(
3
*
time
.
Minute
)
time
.
Sleep
(
3
*
time
.
Minute
)
}
By
(
"deleting the claim"
)
By
(
"deleting the claim"
)
framework
.
ExpectNoError
(
client
.
Core
()
.
PersistentVolumeClaims
(
claim
.
Namespace
)
.
Delete
(
claim
.
Name
,
nil
))
framework
.
ExpectNoError
(
client
.
Core
()
.
PersistentVolumeClaims
(
claim
.
Namespace
)
.
Delete
(
claim
.
Name
,
nil
))
...
@@ -142,7 +131,9 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
...
@@ -142,7 +131,9 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
claim
,
err
=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
claim
,
err
=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
testDynamicProvisioning
(
c
,
claim
,
false
)
// Expected size of the volume is 2GiB, because all three supported cloud
// providers allocate volumes in 1GiB chunks.
testDynamicProvisioning
(
c
,
claim
,
"2Gi"
)
})
})
})
})
...
@@ -158,7 +149,7 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
...
@@ -158,7 +149,7 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
claim
,
err
:=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
claim
,
err
:=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
testDynamicProvisioning
(
c
,
claim
,
false
)
testDynamicProvisioning
(
c
,
claim
,
"2Gi"
)
})
})
})
})
...
@@ -182,7 +173,9 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
...
@@ -182,7 +173,9 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
claim
,
err
=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
claim
,
err
=
c
.
Core
()
.
PersistentVolumeClaims
(
ns
)
.
Create
(
claim
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
testDynamicProvisioning
(
c
,
claim
,
true
)
// Expected size of the externally provisioned volume depends on the external
// provisioner: for nfs-provisioner used here, it's equal to requested
testDynamicProvisioning
(
c
,
claim
,
requestedSize
)
})
})
})
})
})
})
...
@@ -359,7 +352,5 @@ func startExternalProvisioner(c clientset.Interface, ns string) *v1.Pod {
...
@@ -359,7 +352,5 @@ func startExternalProvisioner(c clientset.Interface, ns string) *v1.Pod {
pod
,
err
:=
podClient
.
Get
(
provisionerPod
.
Name
,
metav1
.
GetOptions
{})
pod
,
err
:=
podClient
.
Get
(
provisionerPod
.
Name
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
,
"Cannot locate the provisioner pod %v: %v"
,
provisionerPod
.
Name
,
err
)
framework
.
ExpectNoError
(
err
,
"Cannot locate the provisioner pod %v: %v"
,
provisionerPod
.
Name
,
err
)
By
(
"sleeping a bit to give the provisioner time to start"
)
time
.
Sleep
(
5
*
time
.
Second
)
return
pod
return
pod
}
}
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