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
18be0a49
Commit
18be0a49
authored
Feb 27, 2019
by
Jing Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GCE PD tests for windows cluster
This PR is the first one to add a few GCE PD tests for windows cluster. Will add more tests in later PRs
parent
fb9fdb33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
210 additions
and
64 deletions
+210
-64
volume_util.go
test/e2e/framework/volume_util.go
+127
-37
csi.go
test/e2e/storage/drivers/csi.go
+6
-0
in_tree.go
test/e2e/storage/drivers/in_tree.go
+32
-13
testpattern.go
test/e2e/storage/testpatterns/testpattern.go
+24
-0
base.go
test/e2e/storage/testsuites/base.go
+3
-0
provisioning.go
test/e2e/storage/testsuites/provisioning.go
+7
-5
volumes.go
test/e2e/storage/testsuites/volumes.go
+11
-9
No files found.
test/e2e/framework/volume_util.go
View file @
18be0a49
This diff is collapsed.
Click to expand it.
test/e2e/storage/drivers/csi.go
View file @
18be0a49
...
@@ -347,6 +347,9 @@ func (g *gcePDCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
...
@@ -347,6 +347,9 @@ func (g *gcePDCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
if
pattern
.
FsType
==
"xfs"
{
if
pattern
.
FsType
==
"xfs"
{
framework
.
SkipUnlessNodeOSDistroIs
(
"ubuntu"
,
"custom"
)
framework
.
SkipUnlessNodeOSDistroIs
(
"ubuntu"
,
"custom"
)
}
}
if
pattern
.
FeatureTag
==
"sig-windows"
{
framework
.
Skipf
(
"Skipping tests for windows since CSI does not support it yet"
)
}
}
}
func
(
g
*
gcePDCSIDriver
)
GetDynamicProvisionStorageClass
(
config
*
testsuites
.
PerTestConfig
,
fsType
string
)
*
storagev1
.
StorageClass
{
func
(
g
*
gcePDCSIDriver
)
GetDynamicProvisionStorageClass
(
config
*
testsuites
.
PerTestConfig
,
fsType
string
)
*
storagev1
.
StorageClass
{
...
@@ -461,6 +464,9 @@ func (g *gcePDExternalCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPa
...
@@ -461,6 +464,9 @@ func (g *gcePDExternalCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPa
if
pattern
.
FsType
==
"xfs"
{
if
pattern
.
FsType
==
"xfs"
{
framework
.
SkipUnlessNodeOSDistroIs
(
"ubuntu"
,
"custom"
)
framework
.
SkipUnlessNodeOSDistroIs
(
"ubuntu"
,
"custom"
)
}
}
if
pattern
.
FeatureTag
==
"sig-windows"
{
framework
.
Skipf
(
"Skipping tests for windows since CSI does not support it yet"
)
}
}
}
func
(
g
*
gcePDExternalCSIDriver
)
GetDynamicProvisionStorageClass
(
config
*
testsuites
.
PerTestConfig
,
fsType
string
)
*
storagev1
.
StorageClass
{
func
(
g
*
gcePDExternalCSIDriver
)
GetDynamicProvisionStorageClass
(
config
*
testsuites
.
PerTestConfig
,
fsType
string
)
*
storagev1
.
StorageClass
{
...
...
test/e2e/storage/drivers/in_tree.go
View file @
18be0a49
...
@@ -1104,23 +1104,32 @@ var _ testsuites.InlineVolumeTestDriver = &gcePdDriver{}
...
@@ -1104,23 +1104,32 @@ var _ testsuites.InlineVolumeTestDriver = &gcePdDriver{}
var
_
testsuites
.
PreprovisionedPVTestDriver
=
&
gcePdDriver
{}
var
_
testsuites
.
PreprovisionedPVTestDriver
=
&
gcePdDriver
{}
var
_
testsuites
.
DynamicPVTestDriver
=
&
gcePdDriver
{}
var
_
testsuites
.
DynamicPVTestDriver
=
&
gcePdDriver
{}
// InitGceDriver returns gcePdDriver that implements TestDriver interface
// InitGce
Pd
Driver returns gcePdDriver that implements TestDriver interface
func
InitGcePdDriver
()
testsuites
.
TestDriver
{
func
InitGcePdDriver
()
testsuites
.
TestDriver
{
var
supportedTypes
sets
.
String
var
capFsGroup
bool
if
framework
.
NodeOSDistroIs
(
"windows"
)
{
supportedTypes
=
sets
.
NewString
(
"ntfs"
)
capFsGroup
=
false
}
else
{
supportedTypes
=
sets
.
NewString
(
""
,
// Default fsType
"ext2"
,
"ext3"
,
"ext4"
,
"xfs"
,
)
capFsGroup
=
true
}
return
&
gcePdDriver
{
return
&
gcePdDriver
{
driverInfo
:
testsuites
.
DriverInfo
{
driverInfo
:
testsuites
.
DriverInfo
{
Name
:
"gcepd"
,
Name
:
"gcepd"
,
MaxFileSize
:
testpatterns
.
FileSizeMedium
,
MaxFileSize
:
testpatterns
.
FileSizeMedium
,
SupportedFsType
:
sets
.
NewString
(
SupportedFsType
:
supportedTypes
,
""
,
// Default fsType
"ext2"
,
"ext3"
,
"ext4"
,
"xfs"
,
),
SupportedMountOption
:
sets
.
NewString
(
"debug"
,
"nouid32"
),
SupportedMountOption
:
sets
.
NewString
(
"debug"
,
"nouid32"
),
Capabilities
:
map
[
testsuites
.
Capability
]
bool
{
Capabilities
:
map
[
testsuites
.
Capability
]
bool
{
testsuites
.
CapPersistence
:
true
,
testsuites
.
CapPersistence
:
true
,
testsuites
.
CapFsGroup
:
true
,
testsuites
.
CapFsGroup
:
capFsGroup
,
testsuites
.
CapBlock
:
true
,
testsuites
.
CapBlock
:
true
,
testsuites
.
CapExec
:
true
,
testsuites
.
CapExec
:
true
,
},
},
...
@@ -1134,6 +1143,9 @@ func (g *gcePdDriver) GetDriverInfo() *testsuites.DriverInfo {
...
@@ -1134,6 +1143,9 @@ func (g *gcePdDriver) GetDriverInfo() *testsuites.DriverInfo {
func
(
g
*
gcePdDriver
)
SkipUnsupportedTest
(
pattern
testpatterns
.
TestPattern
)
{
func
(
g
*
gcePdDriver
)
SkipUnsupportedTest
(
pattern
testpatterns
.
TestPattern
)
{
framework
.
SkipUnlessProviderIs
(
"gce"
,
"gke"
)
framework
.
SkipUnlessProviderIs
(
"gce"
,
"gke"
)
if
pattern
.
FeatureTag
==
"sig-windows"
{
framework
.
SkipUnlessNodeOSDistroIs
(
"windows"
)
}
}
}
func
(
g
*
gcePdDriver
)
GetVolumeSource
(
readOnly
bool
,
fsType
string
,
volume
testsuites
.
TestVolume
)
*
v1
.
VolumeSource
{
func
(
g
*
gcePdDriver
)
GetVolumeSource
(
readOnly
bool
,
fsType
string
,
volume
testsuites
.
TestVolume
)
*
v1
.
VolumeSource
{
...
@@ -1183,11 +1195,18 @@ func (h *gcePdDriver) GetClaimSize() string {
...
@@ -1183,11 +1195,18 @@ func (h *gcePdDriver) GetClaimSize() string {
}
}
func
(
g
*
gcePdDriver
)
PrepareTest
(
f
*
framework
.
Framework
)
(
*
testsuites
.
PerTestConfig
,
func
())
{
func
(
g
*
gcePdDriver
)
PrepareTest
(
f
*
framework
.
Framework
)
(
*
testsuites
.
PerTestConfig
,
func
())
{
return
&
testsuites
.
PerTestConfig
{
config
:=
&
testsuites
.
PerTestConfig
{
Driver
:
g
,
Driver
:
g
,
Prefix
:
"gcepd"
,
Prefix
:
"gcepd"
,
Framework
:
f
,
Framework
:
f
,
},
func
()
{}
}
if
framework
.
NodeOSDistroIs
(
"windows"
)
{
config
.
ClientNodeSelector
=
map
[
string
]
string
{
"beta.kubernetes.io/os"
:
"windows"
,
}
}
return
config
,
func
()
{}
}
}
func
(
g
*
gcePdDriver
)
CreateVolume
(
config
*
testsuites
.
PerTestConfig
,
volType
testpatterns
.
TestVolType
)
testsuites
.
TestVolume
{
func
(
g
*
gcePdDriver
)
CreateVolume
(
config
*
testsuites
.
PerTestConfig
,
volType
testpatterns
.
TestVolType
)
testsuites
.
TestVolume
{
...
...
test/e2e/storage/testpatterns/testpattern.go
View file @
18be0a49
...
@@ -145,6 +145,30 @@ var (
...
@@ -145,6 +145,30 @@ var (
FsType
:
"xfs"
,
FsType
:
"xfs"
,
}
}
// Definitions for ntfs
// NtfsInlineVolume is TestPattern for "Inline-volume (ntfs)"
NtfsInlineVolume
=
TestPattern
{
Name
:
"Inline-volume (ntfs)"
,
VolType
:
InlineVolume
,
FsType
:
"ntfs"
,
FeatureTag
:
"sig-windows"
,
}
// NtfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (ntfs)"
NtfsPreprovisionedPV
=
TestPattern
{
Name
:
"Pre-provisioned PV (ntfs)"
,
VolType
:
PreprovisionedPV
,
FsType
:
"ntfs"
,
FeatureTag
:
"sig-windows"
,
}
// NtfsDynamicPV is TestPattern for "Dynamic PV (xfs)"
NtfsDynamicPV
=
TestPattern
{
Name
:
"Dynamic PV (ntfs)"
,
VolType
:
DynamicPV
,
FsType
:
"ntfs"
,
FeatureTag
:
"sig-windows"
,
}
// Definitions for Filesystem volume mode
// Definitions for Filesystem volume mode
// FsVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (filesystem)"
// FsVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (filesystem)"
...
...
test/e2e/storage/testsuites/base.go
View file @
18be0a49
...
@@ -133,6 +133,9 @@ func skipUnsupportedTest(driver TestDriver, pattern testpatterns.TestPattern) {
...
@@ -133,6 +133,9 @@ func skipUnsupportedTest(driver TestDriver, pattern testpatterns.TestPattern) {
if
pattern
.
FsType
==
"xfs"
&&
framework
.
NodeOSDistroIs
(
"gci"
)
{
if
pattern
.
FsType
==
"xfs"
&&
framework
.
NodeOSDistroIs
(
"gci"
)
{
framework
.
Skipf
(
"Distro doesn't support xfs -- skipping"
)
framework
.
Skipf
(
"Distro doesn't support xfs -- skipping"
)
}
}
if
pattern
.
FsType
==
"ntfs"
&&
!
framework
.
NodeOSDistroIs
(
"windows"
)
{
framework
.
Skipf
(
"Distro %s doesn't support ntfs -- skipping"
,
framework
.
TestContext
.
NodeOSDistro
)
}
}
}
// 4. Check with driver specific logic
// 4. Check with driver specific logic
...
...
test/e2e/storage/testsuites/provisioning.go
View file @
18be0a49
...
@@ -35,7 +35,6 @@ import (
...
@@ -35,7 +35,6 @@ import (
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
imageutils
"k8s.io/kubernetes/test/utils/image"
)
)
// StorageClassTest represents parameters to be used by provisioning tests.
// StorageClassTest represents parameters to be used by provisioning tests.
...
@@ -70,6 +69,7 @@ func InitProvisioningTestSuite() TestSuite {
...
@@ -70,6 +69,7 @@ func InitProvisioningTestSuite() TestSuite {
name
:
"provisioning"
,
name
:
"provisioning"
,
testPatterns
:
[]
testpatterns
.
TestPattern
{
testPatterns
:
[]
testpatterns
.
TestPattern
{
testpatterns
.
DefaultFsDynamicPV
,
testpatterns
.
DefaultFsDynamicPV
,
testpatterns
.
NtfsDynamicPV
,
},
},
},
},
}
}
...
@@ -120,7 +120,7 @@ func (p *provisioningTestSuite) defineTests(driver TestDriver, pattern testpatte
...
@@ -120,7 +120,7 @@ func (p *provisioningTestSuite) defineTests(driver TestDriver, pattern testpatte
l
.
config
,
l
.
testCleanup
=
driver
.
PrepareTest
(
f
)
l
.
config
,
l
.
testCleanup
=
driver
.
PrepareTest
(
f
)
l
.
cs
=
l
.
config
.
Framework
.
ClientSet
l
.
cs
=
l
.
config
.
Framework
.
ClientSet
claimSize
:=
dDriver
.
GetClaimSize
()
claimSize
:=
dDriver
.
GetClaimSize
()
l
.
sc
=
dDriver
.
GetDynamicProvisionStorageClass
(
l
.
config
,
""
)
l
.
sc
=
dDriver
.
GetDynamicProvisionStorageClass
(
l
.
config
,
pattern
.
FsType
)
if
l
.
sc
==
nil
{
if
l
.
sc
==
nil
{
framework
.
Skipf
(
"Driver %q does not define Dynamic Provision StorageClass - skipping"
,
dInfo
.
Name
)
framework
.
Skipf
(
"Driver %q does not define Dynamic Provision StorageClass - skipping"
,
dInfo
.
Name
)
}
}
...
@@ -472,6 +472,9 @@ func PVMultiNodeCheck(client clientset.Interface, claim *v1.PersistentVolumeClai
...
@@ -472,6 +472,9 @@ func PVMultiNodeCheck(client clientset.Interface, claim *v1.PersistentVolumeClai
By
(
fmt
.
Sprintf
(
"checking the created volume is readable and retains data on another node %+v"
,
secondNode
))
By
(
fmt
.
Sprintf
(
"checking the created volume is readable and retains data on another node %+v"
,
secondNode
))
command
=
"grep 'hello world' /mnt/test/data"
command
=
"grep 'hello world' /mnt/test/data"
if
framework
.
NodeOSDistroIs
(
"windows"
)
{
command
=
"select-string 'hello world' /mnt/test/data"
}
pod
=
StartInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
"pvc-reader-node2"
,
command
,
secondNode
)
pod
=
StartInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
"pvc-reader-node2"
,
command
,
secondNode
)
framework
.
ExpectNoError
(
framework
.
WaitForPodSuccessInNamespaceSlow
(
client
,
pod
.
Name
,
pod
.
Namespace
))
framework
.
ExpectNoError
(
framework
.
WaitForPodSuccessInNamespaceSlow
(
client
,
pod
.
Name
,
pod
.
Namespace
))
runningPod
,
err
=
client
.
CoreV1
()
.
Pods
(
pod
.
Namespace
)
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
runningPod
,
err
=
client
.
CoreV1
()
.
Pods
(
pod
.
Namespace
)
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
...
@@ -607,9 +610,8 @@ func StartInPodWithVolume(c clientset.Interface, ns, claimName, podName, command
...
@@ -607,9 +610,8 @@ func StartInPodWithVolume(c clientset.Interface, ns, claimName, podName, command
Containers
:
[]
v1
.
Container
{
Containers
:
[]
v1
.
Container
{
{
{
Name
:
"volume-tester"
,
Name
:
"volume-tester"
,
Image
:
imageutils
.
GetE2EImage
(
imageutils
.
BusyBox
),
Image
:
framework
.
GetTestImage
(
framework
.
BusyBoxImage
),
Command
:
[]
string
{
"/bin/sh"
},
Command
:
framework
.
GenerateScriptCmd
(
command
),
Args
:
[]
string
{
"-c"
,
command
},
VolumeMounts
:
[]
v1
.
VolumeMount
{
VolumeMounts
:
[]
v1
.
VolumeMount
{
{
{
Name
:
"my-volume"
,
Name
:
"my-volume"
,
...
...
test/e2e/storage/testsuites/volumes.go
View file @
18be0a49
...
@@ -23,7 +23,6 @@ package testsuites
...
@@ -23,7 +23,6 @@ package testsuites
import
(
import
(
"fmt"
"fmt"
"path/filepath"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
...
@@ -63,6 +62,10 @@ func InitVolumesTestSuite() TestSuite {
...
@@ -63,6 +62,10 @@ func InitVolumesTestSuite() TestSuite {
testpatterns
.
XfsInlineVolume
,
testpatterns
.
XfsInlineVolume
,
testpatterns
.
XfsPreprovisionedPV
,
testpatterns
.
XfsPreprovisionedPV
,
testpatterns
.
XfsDynamicPV
,
testpatterns
.
XfsDynamicPV
,
// ntfs
testpatterns
.
NtfsInlineVolume
,
testpatterns
.
NtfsPreprovisionedPV
,
testpatterns
.
NtfsDynamicPV
,
},
},
},
},
}
}
...
@@ -105,7 +108,7 @@ func (t *volumesTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
...
@@ -105,7 +108,7 @@ func (t *volumesTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
// registers its own BeforeEach which creates the namespace. Beware that it
// registers its own BeforeEach which creates the namespace. Beware that it
// also registers an AfterEach which renders f unusable. Any code using
// also registers an AfterEach which renders f unusable. Any code using
// f must run inside an It or Context callback.
// f must run inside an It or Context callback.
f
:=
framework
.
NewDefaultFramework
(
"volume
io
"
)
f
:=
framework
.
NewDefaultFramework
(
"volume"
)
init
:=
func
()
{
init
:=
func
()
{
l
=
local
{}
l
=
local
{}
...
@@ -181,10 +184,9 @@ func testScriptInPod(
...
@@ -181,10 +184,9 @@ func testScriptInPod(
volName
=
"vol1"
volName
=
"vol1"
)
)
suffix
:=
generateSuffixForPodName
(
volumeType
)
suffix
:=
generateSuffixForPodName
(
volumeType
)
scriptName
:=
fmt
.
Sprintf
(
"test-%s.sh"
,
suffix
)
fileName
:=
fmt
.
Sprintf
(
"test-%s"
,
suffix
)
fullPath
:=
filepath
.
Join
(
volPath
,
scriptName
)
content
:=
fmt
.
Sprintf
(
"ls %s"
,
volPath
)
cmd
:=
fmt
.
Sprintf
(
"echo
\"
ls %s
\"
> %s; chmod u+x %s; %s"
,
volPath
,
fullPath
,
fullPath
,
fullPath
)
command
:=
framework
.
GenerateWriteandExecuteScriptFileCmd
(
content
,
fileName
,
volPath
)
pod
:=
&
v1
.
Pod
{
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
fmt
.
Sprintf
(
"exec-volume-test-%s"
,
suffix
),
Name
:
fmt
.
Sprintf
(
"exec-volume-test-%s"
,
suffix
),
...
@@ -194,8 +196,8 @@ func testScriptInPod(
...
@@ -194,8 +196,8 @@ func testScriptInPod(
Containers
:
[]
v1
.
Container
{
Containers
:
[]
v1
.
Container
{
{
{
Name
:
fmt
.
Sprintf
(
"exec-container-%s"
,
suffix
),
Name
:
fmt
.
Sprintf
(
"exec-container-%s"
,
suffix
),
Image
:
imageutils
.
GetE2EImage
(
imageutils
.
Nginx
),
Image
:
framework
.
GetTestImage
(
imageutils
.
GetE2EImage
(
imageutils
.
Nginx
)
),
Command
:
[]
string
{
"/bin/sh"
,
"-ec"
,
cmd
}
,
Command
:
command
,
VolumeMounts
:
[]
v1
.
VolumeMount
{
VolumeMounts
:
[]
v1
.
VolumeMount
{
{
{
Name
:
volName
,
Name
:
volName
,
...
@@ -215,7 +217,7 @@ func testScriptInPod(
...
@@ -215,7 +217,7 @@ func testScriptInPod(
},
},
}
}
By
(
fmt
.
Sprintf
(
"Creating pod %s"
,
pod
.
Name
))
By
(
fmt
.
Sprintf
(
"Creating pod %s"
,
pod
.
Name
))
f
.
TestContainerOutput
(
"exec-volume-test"
,
pod
,
0
,
[]
string
{
script
Name
})
f
.
TestContainerOutput
(
"exec-volume-test"
,
pod
,
0
,
[]
string
{
file
Name
})
By
(
fmt
.
Sprintf
(
"Deleting pod %s"
,
pod
.
Name
))
By
(
fmt
.
Sprintf
(
"Deleting pod %s"
,
pod
.
Name
))
err
:=
framework
.
DeletePodWithWait
(
f
,
f
.
ClientSet
,
pod
)
err
:=
framework
.
DeletePodWithWait
(
f
,
f
.
ClientSet
,
pod
)
...
...
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