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
8091c797
Commit
8091c797
authored
Aug 17, 2018
by
Michelle Au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integration and e2e tests
parent
01d83fa1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
13 deletions
+41
-13
testing.go
pkg/volume/testing/testing.go
+9
-3
persistent_volumes-local.go
test/e2e/storage/persistent_volumes-local.go
+22
-3
BUILD
test/integration/scheduler/BUILD
+1
-0
util.go
test/integration/scheduler/util.go
+9
-7
volume_binding_test.go
test/integration/scheduler/volume_binding_test.go
+0
-0
No files found.
pkg/volume/testing/testing.go
View file @
8091c797
...
...
@@ -239,6 +239,7 @@ type FakeVolumePlugin struct {
VolumeLimits
map
[
string
]
int64
VolumeLimitsError
error
LimitKey
string
ProvisionDelaySeconds
int
Mounters
[]
*
FakeVolume
Unmounters
[]
*
FakeVolume
...
...
@@ -437,7 +438,7 @@ func (plugin *FakeVolumePlugin) NewProvisioner(options VolumeOptions) (Provision
plugin
.
Lock
()
defer
plugin
.
Unlock
()
plugin
.
LastProvisionerOptions
=
options
return
&
FakeProvisioner
{
options
,
plugin
.
Host
},
nil
return
&
FakeProvisioner
{
options
,
plugin
.
Host
,
plugin
.
ProvisionDelaySeconds
},
nil
}
func
(
plugin
*
FakeVolumePlugin
)
GetAccessModes
()
[]
v1
.
PersistentVolumeAccessMode
{
...
...
@@ -779,8 +780,9 @@ func (fd *FakeDeleter) GetPath() string {
}
type
FakeProvisioner
struct
{
Options
VolumeOptions
Host
VolumeHost
Options
VolumeOptions
Host
VolumeHost
ProvisionDelaySeconds
int
}
func
(
fc
*
FakeProvisioner
)
Provision
(
selectedNode
*
v1
.
Node
,
allowedTopologies
[]
v1
.
TopologySelectorTerm
)
(
*
v1
.
PersistentVolume
,
error
)
{
...
...
@@ -807,6 +809,10 @@ func (fc *FakeProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []
},
}
if
fc
.
ProvisionDelaySeconds
>
0
{
time
.
Sleep
(
time
.
Duration
(
fc
.
ProvisionDelaySeconds
)
*
time
.
Second
)
}
return
pv
,
nil
}
...
...
test/e2e/storage/persistent_volumes-local.go
View file @
8091c797
...
...
@@ -566,13 +566,28 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
framework
.
Skipf
(
"Runs only when number of nodes >= %v"
,
ssReplicas
)
}
By
(
"Creating a StatefulSet with pod anti-affinity on nodes"
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
volsPerNode
,
true
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
volsPerNode
,
true
,
false
)
validateStatefulSet
(
config
,
ss
,
true
)
})
It
(
"should use volumes on one node when pod has affinity"
,
func
()
{
By
(
"Creating a StatefulSet with pod affinity on nodes"
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
volsPerNode
/
ssReplicas
,
false
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
volsPerNode
/
ssReplicas
,
false
,
false
)
validateStatefulSet
(
config
,
ss
,
false
)
})
It
(
"should use volumes spread across nodes when pod management is parallel and pod has anti-affinity"
,
func
()
{
if
len
(
config
.
nodes
)
<
ssReplicas
{
framework
.
Skipf
(
"Runs only when number of nodes >= %v"
,
ssReplicas
)
}
By
(
"Creating a StatefulSet with pod anti-affinity on nodes"
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
1
,
true
,
true
)
validateStatefulSet
(
config
,
ss
,
true
)
})
It
(
"should use volumes on one node when pod management is parallel and pod has affinity"
,
func
()
{
By
(
"Creating a StatefulSet with pod affinity on nodes"
)
ss
:=
createStatefulSet
(
config
,
ssReplicas
,
1
,
false
,
true
)
validateStatefulSet
(
config
,
ss
,
false
)
})
})
...
...
@@ -1830,7 +1845,7 @@ func findLocalPersistentVolume(c clientset.Interface, volumePath string) (*v1.Pe
return
nil
,
nil
}
func
createStatefulSet
(
config
*
localTestConfig
,
ssReplicas
int32
,
volumeCount
int
,
anti
bool
)
*
appsv1
.
StatefulSet
{
func
createStatefulSet
(
config
*
localTestConfig
,
ssReplicas
int32
,
volumeCount
int
,
anti
,
parallel
bool
)
*
appsv1
.
StatefulSet
{
mounts
:=
[]
v1
.
VolumeMount
{}
claims
:=
[]
v1
.
PersistentVolumeClaim
{}
for
i
:=
0
;
i
<
volumeCount
;
i
++
{
...
...
@@ -1897,6 +1912,10 @@ func createStatefulSet(config *localTestConfig, ssReplicas int32, volumeCount in
},
}
if
parallel
{
spec
.
Spec
.
PodManagementPolicy
=
appsv1
.
ParallelPodManagement
}
ss
,
err
:=
config
.
client
.
AppsV1
()
.
StatefulSets
(
config
.
ns
)
.
Create
(
spec
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
...
test/integration/scheduler/BUILD
View file @
8091c797
...
...
@@ -34,6 +34,7 @@ go_test(
"//pkg/kubeapiserver/admission:go_default_library",
"//pkg/scheduler:go_default_library",
"//pkg/scheduler/algorithm:go_default_library",
"//pkg/scheduler/algorithm/predicates:go_default_library",
"//pkg/scheduler/algorithmprovider:go_default_library",
"//pkg/scheduler/api:go_default_library",
"//pkg/scheduler/apis/config:go_default_library",
...
...
test/integration/scheduler/util.go
View file @
8091c797
...
...
@@ -143,7 +143,7 @@ func initTestScheduler(
)
*
TestContext
{
// Pod preemption is enabled by default scheduler configuration, but preemption only happens when PodPriority
// feature gate is enabled at the same time.
return
initTestSchedulerWithOptions
(
t
,
context
,
controllerCh
,
setPodInformer
,
policy
,
false
,
time
.
Second
)
return
initTestSchedulerWithOptions
(
t
,
context
,
controllerCh
,
setPodInformer
,
policy
,
false
,
false
,
time
.
Second
)
}
// initTestSchedulerWithOptions initializes a test environment and creates a scheduler with default
...
...
@@ -155,13 +155,15 @@ func initTestSchedulerWithOptions(
setPodInformer
bool
,
policy
*
schedulerapi
.
Policy
,
disablePreemption
bool
,
disableEquivalenceCache
bool
,
resyncPeriod
time
.
Duration
,
)
*
TestContext
{
// Enable EnableEquivalenceClassCache for all integration tests.
defer
utilfeaturetesting
.
SetFeatureGateDuringTest
(
t
,
utilfeature
.
DefaultFeatureGate
,
features
.
EnableEquivalenceClassCache
,
true
)()
if
!
disableEquivalenceCache
{
defer
utilfeaturetesting
.
SetFeatureGateDuringTest
(
t
,
utilfeature
.
DefaultFeatureGate
,
features
.
EnableEquivalenceClassCache
,
true
)()
}
// 1. Create scheduler
context
.
informerFactory
=
informers
.
NewSharedInformerFactory
(
context
.
clientSet
,
resyncPeriod
)
...
...
@@ -256,7 +258,7 @@ func initTest(t *testing.T, nsPrefix string) *TestContext {
// configuration but with pod preemption disabled.
func
initTestDisablePreemption
(
t
*
testing
.
T
,
nsPrefix
string
)
*
TestContext
{
return
initTestSchedulerWithOptions
(
t
,
initTestMaster
(
t
,
nsPrefix
,
nil
),
nil
,
true
,
nil
,
true
,
time
.
Second
)
t
,
initTestMaster
(
t
,
nsPrefix
,
nil
),
nil
,
true
,
nil
,
true
,
false
,
time
.
Second
)
}
// cleanupTest deletes the scheduler and the test namespace. It should be called
...
...
test/integration/scheduler/volume_binding_test.go
View file @
8091c797
This diff is collapsed.
Click to expand it.
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