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
ba345916
Unverified
Commit
ba345916
authored
Feb 28, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74716 from cofyc/fix73559
Add new e2e test for local PV "Pods sharing a single local PV [Serial]"
parents
f6d05d63
1bfd3838
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
persistent_volumes-local.go
test/e2e/storage/persistent_volumes-local.go
+63
-0
No files found.
test/e2e/storage/persistent_volumes-local.go
View file @
ba345916
...
...
@@ -613,6 +613,69 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
})
})
Context
(
"Pods sharing a single local PV [Serial]"
,
func
()
{
var
(
pv
*
v1
.
PersistentVolume
)
BeforeEach
(
func
()
{
localVolume
:=
&
localTestVolume
{
node
:
config
.
node0
,
hostDir
:
"/tmp"
,
localVolumeType
:
DirectoryLocalVolumeType
,
}
pvConfig
:=
makeLocalPVConfig
(
config
,
localVolume
)
var
err
error
pv
,
err
=
framework
.
CreatePV
(
config
.
client
,
framework
.
MakePersistentVolume
(
pvConfig
))
framework
.
ExpectNoError
(
err
)
})
AfterEach
(
func
()
{
if
pv
==
nil
{
return
}
By
(
fmt
.
Sprintf
(
"Clean PV %s"
,
pv
.
Name
))
err
:=
config
.
client
.
CoreV1
()
.
PersistentVolumes
()
.
Delete
(
pv
.
Name
,
&
metav1
.
DeleteOptions
{})
framework
.
ExpectNoError
(
err
)
})
It
(
"all pods should be running"
,
func
()
{
var
(
pvc
*
v1
.
PersistentVolumeClaim
pods
=
map
[
string
]
*
v1
.
Pod
{}
count
=
50
err
error
)
pvc
=
framework
.
MakePersistentVolumeClaim
(
makeLocalPVCConfig
(
config
,
DirectoryLocalVolumeType
),
config
.
ns
)
By
(
fmt
.
Sprintf
(
"Create a PVC %s"
,
pvc
.
Name
))
pvc
,
err
=
framework
.
CreatePVC
(
config
.
client
,
config
.
ns
,
pvc
)
framework
.
ExpectNoError
(
err
)
By
(
fmt
.
Sprintf
(
"Create %d pods to use this PVC"
,
count
))
for
i
:=
0
;
i
<
count
;
i
++
{
pod
:=
framework
.
MakeSecPod
(
config
.
ns
,
[]
*
v1
.
PersistentVolumeClaim
{
pvc
},
false
,
""
,
false
,
false
,
selinuxLabel
,
nil
)
pod
,
err
:=
config
.
client
.
CoreV1
()
.
Pods
(
config
.
ns
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
pods
[
pod
.
Name
]
=
pod
}
By
(
"Wait for all pods are running"
)
err
=
wait
.
PollImmediate
(
time
.
Second
,
5
*
time
.
Minute
,
func
()
(
done
bool
,
err
error
)
{
podsList
,
err
:=
config
.
client
.
CoreV1
()
.
Pods
(
config
.
ns
)
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
return
false
,
err
}
runningPods
:=
0
for
_
,
pod
:=
range
podsList
.
Items
{
switch
pod
.
Status
.
Phase
{
case
v1
.
PodRunning
:
runningPods
++
}
}
return
runningPods
==
count
,
nil
})
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
})
})
})
func
deletePodAndPVCs
(
config
*
localTestConfig
,
pod
*
v1
.
Pod
)
error
{
...
...
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