mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-02 01:39:02 +00:00
Add e2e for fsGroupChangePolicy for RWOP volume types
This commit is contained in:
@@ -113,8 +113,6 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
l = local{}
|
l = local{}
|
||||||
l.driver = driver
|
l.driver = driver
|
||||||
l.config = driver.PrepareTest(ctx, f)
|
l.config = driver.PrepareTest(ctx, f)
|
||||||
testVolumeSizeRange := s.GetTestSuiteInfo().SupportedSizeRange
|
|
||||||
l.resource = storageframework.CreateVolumeResource(ctx, l.driver, l.config, pattern, testVolumeSizeRange)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup := func(ctx context.Context) {
|
cleanup := func(ctx context.Context) {
|
||||||
@@ -129,6 +127,8 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
framework.ExpectNoError(errors.NewAggregate(errs), "while cleanup resource")
|
framework.ExpectNoError(errors.NewAggregate(errs), "while cleanup resource")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rwopAccessMode := v1.ReadWriteOncePod
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string // Test case name
|
name string // Test case name
|
||||||
podfsGroupChangePolicy string // 'Always' or 'OnRootMismatch'
|
podfsGroupChangePolicy string // 'Always' or 'OnRootMismatch'
|
||||||
@@ -143,6 +143,7 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
// * OnRootMismatch policy is not supported.
|
// * OnRootMismatch policy is not supported.
|
||||||
// * It may not be possible to chgrp after mounting a volume.
|
// * It may not be possible to chgrp after mounting a volume.
|
||||||
supportsVolumeMountGroup bool
|
supportsVolumeMountGroup bool
|
||||||
|
volumeAccessMode *v1.PersistentVolumeAccessMode
|
||||||
}{
|
}{
|
||||||
// Test cases for 'Always' policy
|
// Test cases for 'Always' policy
|
||||||
{
|
{
|
||||||
@@ -154,6 +155,16 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
finalExpectedSubDirFileOwnership: 2000,
|
finalExpectedSubDirFileOwnership: 2000,
|
||||||
supportsVolumeMountGroup: true,
|
supportsVolumeMountGroup: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "rwop pod created with an initial fsgroup, new pod fsgroup applied to volume contents",
|
||||||
|
podfsGroupChangePolicy: "Always",
|
||||||
|
initialPodFsGroup: 1000,
|
||||||
|
secondPodFsGroup: 2000,
|
||||||
|
finalExpectedRootDirFileOwnership: 2000,
|
||||||
|
finalExpectedSubDirFileOwnership: 2000,
|
||||||
|
supportsVolumeMountGroup: true,
|
||||||
|
volumeAccessMode: &rwopAccessMode,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "pod created with an initial fsgroup, volume contents ownership changed via chgrp in first pod, new pod with same fsgroup applied to the volume contents",
|
name: "pod created with an initial fsgroup, volume contents ownership changed via chgrp in first pod, new pod with same fsgroup applied to the volume contents",
|
||||||
podfsGroupChangePolicy: "Always",
|
podfsGroupChangePolicy: "Always",
|
||||||
@@ -218,6 +229,13 @@ func (s *fsGroupChangePolicyTestSuite) DefineTests(driver storageframework.TestD
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(ctx)
|
init(ctx)
|
||||||
|
testVolumeSizeRange := s.GetTestSuiteInfo().SupportedSizeRange
|
||||||
|
if test.volumeAccessMode != nil {
|
||||||
|
accessModes := []v1.PersistentVolumeAccessMode{*test.volumeAccessMode}
|
||||||
|
l.resource = storageframework.CreateVolumeResourceWithAccessModes(ctx, l.driver, l.config, pattern, testVolumeSizeRange, accessModes, nil)
|
||||||
|
} else {
|
||||||
|
l.resource = storageframework.CreateVolumeResource(ctx, l.driver, l.config, pattern, testVolumeSizeRange)
|
||||||
|
}
|
||||||
ginkgo.DeferCleanup(cleanup)
|
ginkgo.DeferCleanup(cleanup)
|
||||||
podConfig := e2epod.Config{
|
podConfig := e2epod.Config{
|
||||||
NS: f.Namespace.Name,
|
NS: f.Namespace.Name,
|
||||||
|
Reference in New Issue
Block a user