Skip to content

Commit 2d58d4e

Browse files
committed
Fix unit tests and feature gate stuff
1 parent a9d71bd commit 2d58d4e

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

pkg/volume/util/operationexecutor/node_expander.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
clientset "k8s.io/client-go/kubernetes"
2525
"k8s.io/client-go/tools/record"
2626
"k8s.io/klog/v2"
27+
"k8s.io/kubectl/pkg/util/storage"
2728
kevents "k8s.io/kubernetes/pkg/kubelet/events"
2829
"k8s.io/kubernetes/pkg/volume/util"
2930
volumetypes "k8s.io/kubernetes/pkg/volume/util/types"
@@ -99,7 +100,7 @@ func (ne *NodeExpander) runPreCheck() bool {
99100
// last recorded size in ASOW is older. This can happen for RWX volume types.
100101
if ne.pvcStatusCap.Cmp(ne.pluginResizeOpts.NewSize) >= 0 &&
101102
ne.resizeStatus == "" &&
102-
ne.hasReadWriteMany() {
103+
storage.ContainsAccessMode(ne.pvc.Spec.AccessModes, v1.ReadWriteMany) {
103104
ne.pvcAlreadyUpdated = true
104105
return true
105106
}
@@ -120,20 +121,6 @@ func (ne *NodeExpander) runPreCheck() bool {
120121
return false
121122
}
122123

123-
func (ne *NodeExpander) hasReadWriteMany() bool {
124-
accessModes := ne.pvc.Spec.AccessModes
125-
if accessModes == nil {
126-
return false
127-
}
128-
129-
for _, mode := range accessModes {
130-
if mode == v1.ReadWriteMany {
131-
return true
132-
}
133-
}
134-
return false
135-
}
136-
137124
func (ne *NodeExpander) expandOnPlugin() (bool, resource.Quantity, error) {
138125
allowExpansion := ne.runPreCheck()
139126
if !allowExpansion {

pkg/volume/util/operationexecutor/node_expander_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func TestNodeExpander(t *testing.T) {
121121
expectedStatusSize: resource.MustParse("2G"),
122122
},
123123
{
124-
name: "RWOP volumes, pv.spec.cap = pvc.status.cap, resizeStatus='', desiredSize > actualSize",
124+
name: "RWX volumes, pv.spec.cap = pvc.status.cap, resizeStatus='', desiredSize > actualSize",
125125
pvc: addAccessMode(getTestPVC("test-vol0", "2G", "2G", "2G", nil), v1.ReadWriteMany),
126126
pv: getTestPV("test-vol0", "2G"),
127127

pkg/volume/util/operationexecutor/operation_generator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func TestOperationGenerator_nodeExpandVolume(t *testing.T) {
255255
actualSize: getSizeFunc("1G"),
256256

257257
expectedResizeStatus: "",
258-
resizeCallCount: 1,
258+
resizeCallCount: 0,
259259
expectedStatusSize: resource.MustParse("2G"),
260260
},
261261
{

test/featuregates_linter/test_data/versioned_feature_list.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,10 @@
922922
lockToDefault: false
923923
preRelease: Alpha
924924
version: "1.23"
925+
- default: true
926+
lockToDefault: false
927+
preRelease: Beta
928+
version: "1.32"
925929
- name: RecursiveReadOnlyMounts
926930
versionedSpecs:
927931
- default: false

0 commit comments

Comments
 (0)