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
e760353b
Commit
e760353b
authored
May 25, 2016
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error checks to volume integration tests
parent
83c78fdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
13 deletions
+53
-13
persistent_volumes_test.go
test/integration/persistent_volumes_test.go
+53
-13
No files found.
test/integration/persistent_volumes_test.go
View file @
e760353b
...
@@ -59,11 +59,21 @@ func TestPersistentVolumeRecycler(t *testing.T) {
...
@@ -59,11 +59,21 @@ func TestPersistentVolumeRecycler(t *testing.T) {
pvc
:=
createPVC
(
"fake-pvc"
,
"5G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteOnce
})
pvc
:=
createPVC
(
"fake-pvc"
,
"5G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteOnce
})
w
,
_
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
w
,
err
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
if
err
!=
nil
{
t
.
Errorf
(
"Failed to watch PersistentVolumes: %v"
,
err
)
}
defer
w
.
Stop
()
defer
w
.
Stop
()
_
,
_
=
testClient
.
PersistentVolumes
()
.
Create
(
pv
)
_
,
err
=
testClient
.
PersistentVolumes
()
.
Create
(
pv
)
_
,
_
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolume: %v"
,
err
)
}
_
,
err
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolumeClaim: %v"
,
err
)
}
// wait until the controller pairs the volume and claim
// wait until the controller pairs the volume and claim
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
...
@@ -85,11 +95,20 @@ func TestPersistentVolumeRecycler(t *testing.T) {
...
@@ -85,11 +95,20 @@ func TestPersistentVolumeRecycler(t *testing.T) {
// change the reclamation policy of the PV for the next test
// change the reclamation policy of the PV for the next test
pv
.
Spec
.
PersistentVolumeReclaimPolicy
=
api
.
PersistentVolumeReclaimDelete
pv
.
Spec
.
PersistentVolumeReclaimPolicy
=
api
.
PersistentVolumeReclaimDelete
w
,
_
=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
w
,
err
=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
if
err
!=
nil
{
t
.
Errorf
(
"Failed to watch PersistentVolumes: %v"
,
err
)
}
defer
w
.
Stop
()
defer
w
.
Stop
()
_
,
_
=
testClient
.
PersistentVolumes
()
.
Create
(
pv
)
_
,
err
=
testClient
.
PersistentVolumes
()
.
Create
(
pv
)
_
,
_
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolume: %v"
,
err
)
}
_
,
err
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolumeClaim: %v"
,
err
)
}
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
...
@@ -171,14 +190,23 @@ func TestPersistentVolumeMultiPVs(t *testing.T) {
...
@@ -171,14 +190,23 @@ func TestPersistentVolumeMultiPVs(t *testing.T) {
pvc
:=
createPVC
(
"pvc-2"
,
strconv
.
Itoa
(
maxPVs
/
2
)
+
"G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteOnce
})
pvc
:=
createPVC
(
"pvc-2"
,
strconv
.
Itoa
(
maxPVs
/
2
)
+
"G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteOnce
})
w
,
_
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
w
,
err
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
if
err
!=
nil
{
t
.
Errorf
(
"Failed to watch PersistentVolumes: %v"
,
err
)
}
defer
w
.
Stop
()
defer
w
.
Stop
()
for
i
:=
0
;
i
<
maxPVs
;
i
++
{
for
i
:=
0
;
i
<
maxPVs
;
i
++
{
_
,
_
=
testClient
.
PersistentVolumes
()
.
Create
(
pvs
[
i
])
_
,
err
=
testClient
.
PersistentVolumes
()
.
Create
(
pvs
[
i
])
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolume %d: %v"
,
i
,
err
)
}
}
}
_
,
_
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
_
,
err
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolumeClaim: %v"
,
err
)
}
// wait until the controller pairs the volume and claim
// wait until the controller pairs the volume and claim
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
...
@@ -236,13 +264,25 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
...
@@ -236,13 +264,25 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
pvc
:=
createPVC
(
"pvc-rwm"
,
"5G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteMany
})
pvc
:=
createPVC
(
"pvc-rwm"
,
"5G"
,
[]
api
.
PersistentVolumeAccessMode
{
api
.
ReadWriteMany
})
w
,
_
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
w
,
err
:=
testClient
.
PersistentVolumes
()
.
Watch
(
api
.
ListOptions
{})
if
err
!=
nil
{
t
.
Errorf
(
"Failed to watch PersistentVolumes: %v"
,
err
)
}
defer
w
.
Stop
()
defer
w
.
Stop
()
_
,
_
=
testClient
.
PersistentVolumes
()
.
Create
(
pv_rwm
)
_
,
err
=
testClient
.
PersistentVolumes
()
.
Create
(
pv_rwm
)
_
,
_
=
testClient
.
PersistentVolumes
()
.
Create
(
pv_rwo
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolume: %v"
,
err
)
}
_
,
err
=
testClient
.
PersistentVolumes
()
.
Create
(
pv_rwo
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolume: %v"
,
err
)
}
_
,
_
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
_
,
err
=
testClient
.
PersistentVolumeClaims
(
api
.
NamespaceDefault
)
.
Create
(
pvc
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to create PersistentVolumeClaim: %v"
,
err
)
}
// wait until the controller pairs the volume and claim
// wait until the controller pairs the volume and claim
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
waitForPersistentVolumePhase
(
w
,
api
.
VolumeBound
)
...
...
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