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
95f04eeb
Commit
95f04eeb
authored
Feb 05, 2018
by
Michelle Au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix local PV node affinity tests and only run once
parent
b80ee8c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
61 deletions
+78
-61
persistent_volumes-local.go
test/e2e/storage/persistent_volumes-local.go
+78
-61
No files found.
test/e2e/storage/persistent_volumes-local.go
View file @
95f04eeb
...
@@ -168,6 +168,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
...
@@ -168,6 +168,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
}
}
})
})
// TODO: move this under volumeType loop
Context
(
"when one pod requests one prebound PVC"
,
func
()
{
Context
(
"when one pod requests one prebound PVC"
,
func
()
{
var
testVol
*
localTestVolume
var
testVol
*
localTestVolume
...
@@ -257,74 +258,90 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
...
@@ -257,74 +258,90 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
})
})
})
})
Context
(
"when pod using local volume with non-existant path"
,
func
()
{
})
}
ep
:=
&
eventPatterns
{
reason
:
"FailedMount"
,
pattern
:
make
([]
string
,
2
)}
ep
.
pattern
=
append
(
ep
.
pattern
,
"MountVolume.SetUp failed"
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"does not exist"
)
It
(
"should not be able to mount"
,
func
()
{
testVol
:=
&
localTestVolume
{
node
:
config
.
node0
,
hostDir
:
"/non-existent/location/nowhere"
,
localVolumeType
:
testVolType
,
}
By
(
"Creating local PVC and PV"
)
createLocalPVCsPVs
(
config
,
[]
*
localTestVolume
{
testVol
},
testMode
)
pod
,
err
:=
createLocalPod
(
config
,
testVol
)
Expect
(
err
)
.
To
(
HaveOccurred
())
checkPodEvents
(
config
,
pod
.
Name
,
ep
)
verifyLocalVolume
(
config
,
testVol
)
cleanupLocalPVCsPVs
(
config
,
[]
*
localTestVolume
{
testVol
})
})
})
Context
(
"when pod's node is different from PV's NodeAffinity"
,
func
()
{
Context
(
"when local volume cannot be mounted [Slow]"
,
func
()
{
// TODO:
// - make the pod create timeout shorter
// - check for these errors in unit tests intead
It
(
"should fail mount due to non-existant path"
,
func
()
{
ep
:=
&
eventPatterns
{
reason
:
"FailedMount"
,
pattern
:
make
([]
string
,
2
)}
ep
.
pattern
=
append
(
ep
.
pattern
,
"MountVolume.SetUp failed"
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"does not exist"
)
testVol
:=
&
localTestVolume
{
node
:
config
.
node0
,
hostDir
:
"/non-existent/location/nowhere"
,
localVolumeType
:
DirectoryLocalVolumeType
,
}
By
(
"Creating local PVC and PV"
)
createLocalPVCsPVs
(
config
,
[]
*
localTestVolume
{
testVol
},
immediateMode
)
pod
,
err
:=
createLocalPod
(
config
,
testVol
)
Expect
(
err
)
.
To
(
HaveOccurred
())
checkPodEvents
(
config
,
pod
.
Name
,
ep
)
verifyLocalVolume
(
config
,
testVol
)
cleanupLocalPVCsPVs
(
config
,
[]
*
localTestVolume
{
testVol
})
})
BeforeEach
(
func
()
{
It
(
"should fail mount due to wrong node"
,
func
()
{
if
len
(
config
.
nodes
)
<
2
{
if
len
(
config
.
nodes
)
<
2
{
framework
.
Skipf
(
"Runs only when number of nodes >= 2"
)
framework
.
Skipf
(
"Runs only when number of nodes >= 2"
)
}
}
})
ep
:=
&
eventPatterns
{
ep
:=
&
eventPatterns
{
reason
:
"FailedScheduling
"
,
reason
:
"FailedMount
"
,
pattern
:
make
([]
string
,
2
)}
pattern
:
make
([]
string
,
2
)}
ep
.
pattern
=
append
(
ep
.
pattern
,
"MatchNodeSelector
"
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"NodeSelectorTerm
"
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"VolumeNodeAffinityConflict
"
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"MountVolume.NodeAffinity check failed
"
)
It
(
"should not be able to mount due to different NodeAffinity"
,
func
()
{
testVols
:=
setupLocalVolumesPVCsPVs
(
config
,
DirectoryLocalVolumeType
,
config
.
node0
,
1
,
immediateMode
)
testPodWithNodeName
(
config
,
testVolType
,
ep
,
config
.
nodes
[
1
]
.
Name
,
makeLocalPodWithNodeAffinity
,
testMode
)
testVol
:=
testVols
[
0
]
})
It
(
"should not be able to mount due to different NodeSelector"
,
func
()
{
pod
:=
makeLocalPodWithNodeName
(
config
,
testVol
,
config
.
nodes
[
1
]
.
Name
)
testPodWithNodeName
(
config
,
testVolType
,
ep
,
config
.
nodes
[
1
]
.
Name
,
makeLocalPodWithNodeSelector
,
testMode
)
pod
,
err
:=
config
.
client
.
CoreV1
()
.
Pods
(
config
.
ns
)
.
Create
(
pod
)
}
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
)
})
err
=
framework
.
WaitForPodNameRunningInNamespace
(
config
.
client
,
pod
.
Name
,
pod
.
Namespace
)
Expect
(
err
)
.
To
(
HaveOccurred
())
checkPodEvents
(
config
,
pod
.
Name
,
ep
)
Context
(
"when pod's node is different from PV's NodeName"
,
func
()
{
cleanupLocalVolumes
(
config
,
[]
*
localTestVolume
{
testVol
})
})
})
BeforeEach
(
func
()
{
Context
(
"when pod's node is different from PV's NodeAffinity"
,
func
()
{
if
len
(
config
.
nodes
)
<
2
{
var
(
framework
.
Skipf
(
"Runs only when number of nodes >= 2"
)
testVol
*
localTestVolume
}
volumeType
localVolumeType
})
)
BeforeEach
(
func
()
{
if
len
(
config
.
nodes
)
<
2
{
framework
.
Skipf
(
"Runs only when number of nodes >= 2"
)
}
ep
:=
&
eventPatterns
{
volumeType
=
DirectoryLocalVolumeType
reason
:
"FailedMount"
,
setupStorageClass
(
config
,
&
immediateMode
)
pattern
:
make
([]
string
,
2
)}
testVols
:=
setupLocalVolumesPVCsPVs
(
config
,
volumeType
,
config
.
node0
,
1
,
immediateMode
)
ep
.
pattern
=
append
(
ep
.
pattern
,
"NodeSelectorTerm"
)
testVol
=
testVols
[
0
]
ep
.
pattern
=
append
(
ep
.
pattern
,
"MountVolume.NodeAffinity check failed"
)
}
)
It
(
"should not be able to mount due to different NodeName"
,
func
()
{
AfterEach
(
func
()
{
testPodWithNodeName
(
config
,
testVolType
,
ep
,
config
.
nodes
[
1
]
.
Name
,
makeLocalPodWithNodeName
,
testMode
)
cleanupLocalVolumes
(
config
,
[]
*
localTestVolume
{
testVol
})
})
cleanupStorageClass
(
config
)
})
})
})
}
It
(
"should not be able to mount due to different NodeAffinity"
,
func
()
{
testPodWithNodeConflict
(
config
,
volumeType
,
config
.
nodes
[
1
]
.
Name
,
makeLocalPodWithNodeAffinity
,
immediateMode
)
})
It
(
"should not be able to mount due to different NodeSelector"
,
func
()
{
testPodWithNodeConflict
(
config
,
volumeType
,
config
.
nodes
[
1
]
.
Name
,
makeLocalPodWithNodeSelector
,
immediateMode
)
})
})
Context
(
"when using local volume provisioner"
,
func
()
{
Context
(
"when using local volume provisioner"
,
func
()
{
var
volumePath
string
var
volumePath
string
...
@@ -424,7 +441,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
...
@@ -424,7 +441,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local [Feature:LocalPersistentVolum
type
makeLocalPodWith
func
(
config
*
localTestConfig
,
volume
*
localTestVolume
,
nodeName
string
)
*
v1
.
Pod
type
makeLocalPodWith
func
(
config
*
localTestConfig
,
volume
*
localTestVolume
,
nodeName
string
)
*
v1
.
Pod
func
testPodWithNode
Name
(
config
*
localTestConfig
,
testVolType
localVolumeType
,
ep
*
eventPatterns
,
nodeName
string
,
makeLocalPodFunc
makeLocalPodWith
,
bindingMode
storagev1
.
VolumeBindingMode
)
{
func
testPodWithNode
Conflict
(
config
*
localTestConfig
,
testVolType
localVolumeType
,
nodeName
string
,
makeLocalPodFunc
makeLocalPodWith
,
bindingMode
storagev1
.
VolumeBindingMode
)
{
By
(
fmt
.
Sprintf
(
"local-volume-type: %s"
,
testVolType
))
By
(
fmt
.
Sprintf
(
"local-volume-type: %s"
,
testVolType
))
testVols
:=
setupLocalVolumesPVCsPVs
(
config
,
testVolType
,
config
.
node0
,
1
,
bindingMode
)
testVols
:=
setupLocalVolumesPVCsPVs
(
config
,
testVolType
,
config
.
node0
,
1
,
bindingMode
)
testVol
:=
testVols
[
0
]
testVol
:=
testVols
[
0
]
...
@@ -432,9 +449,9 @@ func testPodWithNodeName(config *localTestConfig, testVolType localVolumeType, e
...
@@ -432,9 +449,9 @@ func testPodWithNodeName(config *localTestConfig, testVolType localVolumeType, e
pod
:=
makeLocalPodFunc
(
config
,
testVol
,
nodeName
)
pod
:=
makeLocalPodFunc
(
config
,
testVol
,
nodeName
)
pod
,
err
:=
config
.
client
.
CoreV1
()
.
Pods
(
config
.
ns
)
.
Create
(
pod
)
pod
,
err
:=
config
.
client
.
CoreV1
()
.
Pods
(
config
.
ns
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitForPodRunningInNamespace
(
config
.
client
,
pod
)
Expect
(
err
)
.
To
(
HaveOccurred
()
)
err
=
framework
.
WaitForPodNameUnschedulableInNamespace
(
config
.
client
,
pod
.
Name
,
pod
.
Namespace
)
checkPodEvents
(
config
,
pod
.
Name
,
ep
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
()
)
cleanupLocalVolumes
(
config
,
[]
*
localTestVolume
{
testVol
})
cleanupLocalVolumes
(
config
,
[]
*
localTestVolume
{
testVol
})
}
}
...
...
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