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
7c8498ab
Commit
7c8498ab
authored
Feb 25, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint failures for test/e2e/upgrades/storage
parent
8916ccab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
.golint_failures
hack/.golint_failures
+0
-1
persistent_volumes.go
test/e2e/upgrades/storage/persistent_volumes.go
+8
-7
volume_mode.go
test/e2e/upgrades/storage/volume_mode.go
+18
-16
No files found.
hack/.golint_failures
View file @
7c8498ab
...
@@ -688,7 +688,6 @@ test/e2e/storage/utils
...
@@ -688,7 +688,6 @@ test/e2e/storage/utils
test/e2e/storage/vsphere
test/e2e/storage/vsphere
test/e2e/ui
test/e2e/ui
test/e2e/upgrades
test/e2e/upgrades
test/e2e/upgrades/storage
test/e2e/windows
test/e2e/windows
test/e2e_kubeadm
test/e2e_kubeadm
test/e2e_node
test/e2e_node
...
...
test/e2e/upgrades/storage/persistent_volumes.go
View file @
7c8498ab
...
@@ -21,8 +21,8 @@ import (
...
@@ -21,8 +21,8 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
.
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e/upgrades"
"k8s.io/kubernetes/test/e2e/upgrades"
)
)
...
@@ -33,6 +33,7 @@ type PersistentVolumeUpgradeTest struct {
...
@@ -33,6 +33,7 @@ type PersistentVolumeUpgradeTest struct {
pvc
*
v1
.
PersistentVolumeClaim
pvc
*
v1
.
PersistentVolumeClaim
}
}
// Name returns the tracking name of the test.
func
(
PersistentVolumeUpgradeTest
)
Name
()
string
{
return
"[sig-storage] persistent-volume-upgrade"
}
func
(
PersistentVolumeUpgradeTest
)
Name
()
string
{
return
"[sig-storage] persistent-volume-upgrade"
}
const
(
const
(
...
@@ -55,7 +56,7 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
...
@@ -55,7 +56,7 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
ns
:=
f
.
Namespace
.
Name
ns
:=
f
.
Namespace
.
Name
By
(
"Initializing PV source"
)
ginkgo
.
By
(
"Initializing PV source"
)
t
.
pvSource
,
_
=
framework
.
CreateGCEVolume
()
t
.
pvSource
,
_
=
framework
.
CreateGCEVolume
()
pvConfig
:=
framework
.
PersistentVolumeConfig
{
pvConfig
:=
framework
.
PersistentVolumeConfig
{
NamePrefix
:
"pv-upgrade"
,
NamePrefix
:
"pv-upgrade"
,
...
@@ -65,12 +66,12 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
...
@@ -65,12 +66,12 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
emptyStorageClass
:=
""
emptyStorageClass
:=
""
pvcConfig
:=
framework
.
PersistentVolumeClaimConfig
{
StorageClassName
:
&
emptyStorageClass
}
pvcConfig
:=
framework
.
PersistentVolumeClaimConfig
{
StorageClassName
:
&
emptyStorageClass
}
By
(
"Creating the PV and PVC"
)
ginkgo
.
By
(
"Creating the PV and PVC"
)
t
.
pv
,
t
.
pvc
,
err
=
framework
.
CreatePVPVC
(
f
.
ClientSet
,
pvConfig
,
pvcConfig
,
ns
,
true
)
t
.
pv
,
t
.
pvc
,
err
=
framework
.
CreatePVPVC
(
f
.
ClientSet
,
pvConfig
,
pvcConfig
,
ns
,
true
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
framework
.
ExpectNoError
(
framework
.
WaitOnPVandPVC
(
f
.
ClientSet
,
ns
,
t
.
pv
,
t
.
pvc
))
framework
.
ExpectNoError
(
framework
.
WaitOnPVandPVC
(
f
.
ClientSet
,
ns
,
t
.
pv
,
t
.
pvc
))
By
(
"Consuming the PV before upgrade"
)
ginkgo
.
By
(
"Consuming the PV before upgrade"
)
t
.
testPod
(
f
,
pvWriteCmd
+
";"
+
pvReadCmd
)
t
.
testPod
(
f
,
pvWriteCmd
+
";"
+
pvReadCmd
)
}
}
...
@@ -78,7 +79,7 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
...
@@ -78,7 +79,7 @@ func (t *PersistentVolumeUpgradeTest) Setup(f *framework.Framework) {
// and that the volume data persists.
// and that the volume data persists.
func
(
t
*
PersistentVolumeUpgradeTest
)
Test
(
f
*
framework
.
Framework
,
done
<-
chan
struct
{},
upgrade
upgrades
.
UpgradeType
)
{
func
(
t
*
PersistentVolumeUpgradeTest
)
Test
(
f
*
framework
.
Framework
,
done
<-
chan
struct
{},
upgrade
upgrades
.
UpgradeType
)
{
<-
done
<-
done
By
(
"Consuming the PV after upgrade"
)
ginkgo
.
By
(
"Consuming the PV after upgrade"
)
t
.
testPod
(
f
,
pvReadCmd
)
t
.
testPod
(
f
,
pvReadCmd
)
}
}
...
...
test/e2e/upgrades/storage/volume_mode.go
View file @
7c8498ab
...
@@ -27,8 +27,8 @@ import (
...
@@ -27,8 +27,8 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
"k8s.io/kubernetes/test/e2e/storage/utils"
"k8s.io/kubernetes/test/e2e/upgrades"
"k8s.io/kubernetes/test/e2e/upgrades"
.
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"github.com/onsi/gomega"
)
)
const
devicePath
=
"/mnt/volume1"
const
devicePath
=
"/mnt/volume1"
...
@@ -43,10 +43,12 @@ type VolumeModeDowngradeTest struct {
...
@@ -43,10 +43,12 @@ type VolumeModeDowngradeTest struct {
pod
*
v1
.
Pod
pod
*
v1
.
Pod
}
}
// Name returns the tracking name of the test.
func
(
VolumeModeDowngradeTest
)
Name
()
string
{
func
(
VolumeModeDowngradeTest
)
Name
()
string
{
return
"[sig-storage] volume-mode-downgrade"
return
"[sig-storage] volume-mode-downgrade"
}
}
// Skip returns true when this test can be skipped.
func
(
t
*
VolumeModeDowngradeTest
)
Skip
(
upgCtx
upgrades
.
UpgradeContext
)
bool
{
func
(
t
*
VolumeModeDowngradeTest
)
Skip
(
upgCtx
upgrades
.
UpgradeContext
)
bool
{
if
!
framework
.
ProviderIs
(
"openstack"
,
"gce"
,
"aws"
,
"gke"
,
"vsphere"
,
"azure"
)
{
if
!
framework
.
ProviderIs
(
"openstack"
,
"gce"
,
"aws"
,
"gke"
,
"vsphere"
,
"azure"
)
{
return
true
return
true
...
@@ -72,7 +74,7 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
...
@@ -72,7 +74,7 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
cs
:=
f
.
ClientSet
cs
:=
f
.
ClientSet
ns
:=
f
.
Namespace
.
Name
ns
:=
f
.
Namespace
.
Name
By
(
"Creating a PVC"
)
ginkgo
.
By
(
"Creating a PVC"
)
block
:=
v1
.
PersistentVolumeBlock
block
:=
v1
.
PersistentVolumeBlock
pvcConfig
:=
framework
.
PersistentVolumeClaimConfig
{
pvcConfig
:=
framework
.
PersistentVolumeClaimConfig
{
StorageClassName
:
nil
,
StorageClassName
:
nil
,
...
@@ -80,46 +82,46 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
...
@@ -80,46 +82,46 @@ func (t *VolumeModeDowngradeTest) Setup(f *framework.Framework) {
}
}
t
.
pvc
=
framework
.
MakePersistentVolumeClaim
(
pvcConfig
,
ns
)
t
.
pvc
=
framework
.
MakePersistentVolumeClaim
(
pvcConfig
,
ns
)
t
.
pvc
,
err
=
framework
.
CreatePVC
(
cs
,
ns
,
t
.
pvc
)
t
.
pvc
,
err
=
framework
.
CreatePVC
(
cs
,
ns
,
t
.
pvc
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
err
=
framework
.
WaitForPersistentVolumeClaimPhase
(
v1
.
ClaimBound
,
cs
,
ns
,
t
.
pvc
.
Name
,
framework
.
Poll
,
framework
.
ClaimProvisionTimeout
)
err
=
framework
.
WaitForPersistentVolumeClaimPhase
(
v1
.
ClaimBound
,
cs
,
ns
,
t
.
pvc
.
Name
,
framework
.
Poll
,
framework
.
ClaimProvisionTimeout
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
t
.
pvc
,
err
=
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
t
.
pvc
.
Namespace
)
.
Get
(
t
.
pvc
.
Name
,
metav1
.
GetOptions
{})
t
.
pvc
,
err
=
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
t
.
pvc
.
Namespace
)
.
Get
(
t
.
pvc
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
t
.
pv
,
err
=
cs
.
CoreV1
()
.
PersistentVolumes
()
.
Get
(
t
.
pvc
.
Spec
.
VolumeName
,
metav1
.
GetOptions
{})
t
.
pv
,
err
=
cs
.
CoreV1
()
.
PersistentVolumes
()
.
Get
(
t
.
pvc
.
Spec
.
VolumeName
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
By
(
"Consuming the PVC before downgrade"
)
ginkgo
.
By
(
"Consuming the PVC before downgrade"
)
t
.
pod
,
err
=
framework
.
CreateSecPod
(
cs
,
ns
,
[]
*
v1
.
PersistentVolumeClaim
{
t
.
pvc
},
false
,
""
,
false
,
false
,
framework
.
SELinuxLabel
,
nil
,
framework
.
PodStartTimeout
)
t
.
pod
,
err
=
framework
.
CreateSecPod
(
cs
,
ns
,
[]
*
v1
.
PersistentVolumeClaim
{
t
.
pvc
},
false
,
""
,
false
,
false
,
framework
.
SELinuxLabel
,
nil
,
framework
.
PodStartTimeout
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
gomega
.
Expect
(
err
)
.
NotTo
(
gomega
.
HaveOccurred
())
By
(
"Checking if PV exists as expected volume mode"
)
ginkgo
.
By
(
"Checking if PV exists as expected volume mode"
)
utils
.
CheckVolumeModeOfPath
(
t
.
pod
,
block
,
devicePath
)
utils
.
CheckVolumeModeOfPath
(
t
.
pod
,
block
,
devicePath
)
By
(
"Checking if read/write to PV works properly"
)
ginkgo
.
By
(
"Checking if read/write to PV works properly"
)
utils
.
CheckReadWriteToPath
(
t
.
pod
,
block
,
devicePath
)
utils
.
CheckReadWriteToPath
(
t
.
pod
,
block
,
devicePath
)
}
}
// Test waits for the downgrade to complete, and then verifies that a pod can no
// Test waits for the downgrade to complete, and then verifies that a pod can no
// longer consume the pv as it is not mapped nor mounted into the pod
// longer consume the pv as it is not mapped nor mounted into the pod
func
(
t
*
VolumeModeDowngradeTest
)
Test
(
f
*
framework
.
Framework
,
done
<-
chan
struct
{},
upgrade
upgrades
.
UpgradeType
)
{
func
(
t
*
VolumeModeDowngradeTest
)
Test
(
f
*
framework
.
Framework
,
done
<-
chan
struct
{},
upgrade
upgrades
.
UpgradeType
)
{
By
(
"Waiting for downgrade to finish"
)
ginkgo
.
By
(
"Waiting for downgrade to finish"
)
<-
done
<-
done
By
(
"Verifying that nothing exists at the device path in the pod"
)
ginkgo
.
By
(
"Verifying that nothing exists at the device path in the pod"
)
utils
.
VerifyExecInPodFail
(
t
.
pod
,
fmt
.
Sprintf
(
"test -e %s"
,
devicePath
),
1
)
utils
.
VerifyExecInPodFail
(
t
.
pod
,
fmt
.
Sprintf
(
"test -e %s"
,
devicePath
),
1
)
}
}
// Teardown cleans up any remaining resources.
// Teardown cleans up any remaining resources.
func
(
t
*
VolumeModeDowngradeTest
)
Teardown
(
f
*
framework
.
Framework
)
{
func
(
t
*
VolumeModeDowngradeTest
)
Teardown
(
f
*
framework
.
Framework
)
{
By
(
"Deleting the pod"
)
ginkgo
.
By
(
"Deleting the pod"
)
framework
.
ExpectNoError
(
framework
.
DeletePodWithWait
(
f
,
f
.
ClientSet
,
t
.
pod
))
framework
.
ExpectNoError
(
framework
.
DeletePodWithWait
(
f
,
f
.
ClientSet
,
t
.
pod
))
By
(
"Deleting the PVC"
)
ginkgo
.
By
(
"Deleting the PVC"
)
framework
.
ExpectNoError
(
f
.
ClientSet
.
CoreV1
()
.
PersistentVolumeClaims
(
t
.
pvc
.
Namespace
)
.
Delete
(
t
.
pvc
.
Name
,
nil
))
framework
.
ExpectNoError
(
f
.
ClientSet
.
CoreV1
()
.
PersistentVolumeClaims
(
t
.
pvc
.
Namespace
)
.
Delete
(
t
.
pvc
.
Name
,
nil
))
By
(
"Waiting for the PV to be deleted"
)
ginkgo
.
By
(
"Waiting for the PV to be deleted"
)
framework
.
ExpectNoError
(
framework
.
WaitForPersistentVolumeDeleted
(
f
.
ClientSet
,
t
.
pv
.
Name
,
5
*
time
.
Second
,
20
*
time
.
Minute
))
framework
.
ExpectNoError
(
framework
.
WaitForPersistentVolumeDeleted
(
f
.
ClientSet
,
t
.
pv
.
Name
,
5
*
time
.
Second
,
20
*
time
.
Minute
))
}
}
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