mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Fix flexvolume online resizing tests
This commit is contained in:
parent
ac6ef262df
commit
5e49fb067f
@ -76,45 +76,35 @@ func TestDropConditions(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, enabled := range []bool{true} {
|
for _, oldPvcInfo := range pvcInfo {
|
||||||
for _, oldPvcInfo := range pvcInfo {
|
for _, newPvcInfo := range pvcInfo {
|
||||||
for _, newPvcInfo := range pvcInfo {
|
oldPvcHasConditins, oldPvc := oldPvcInfo.hasConditions, oldPvcInfo.pvc()
|
||||||
oldPvcHasConditins, oldPvc := oldPvcInfo.hasConditions, oldPvcInfo.pvc()
|
newPvcHasConditions, newPvc := newPvcInfo.hasConditions, newPvcInfo.pvc()
|
||||||
newPvcHasConditions, newPvc := newPvcInfo.hasConditions, newPvcInfo.pvc()
|
|
||||||
|
|
||||||
t.Run(fmt.Sprintf("feature enabled=%v, old pvc %v, new pvc %v", enabled, oldPvcInfo.description, newPvcInfo.description), func(t *testing.T) {
|
t.Run(fmt.Sprintf("old pvc %s, new pvc %s", oldPvcInfo.description, newPvcInfo.description), func(t *testing.T) {
|
||||||
StatusStrategy.PrepareForUpdate(ctx, newPvc, oldPvc)
|
StatusStrategy.PrepareForUpdate(ctx, newPvc, oldPvc)
|
||||||
|
|
||||||
// old pvc should never be changed
|
// old pvc should never be changed
|
||||||
if !reflect.DeepEqual(oldPvc, oldPvcInfo.pvc()) {
|
if !reflect.DeepEqual(oldPvc, oldPvcInfo.pvc()) {
|
||||||
t.Errorf("old pvc changed: %v", diff.ObjectReflectDiff(oldPvc, oldPvcInfo.pvc()))
|
t.Errorf("old pvc changed: %v", diff.ObjectReflectDiff(oldPvc, oldPvcInfo.pvc()))
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case oldPvcHasConditins || newPvcHasConditions:
|
||||||
|
// new pvc should not be changed if the feature is enabled, or if the old pvc had Conditions
|
||||||
|
if !reflect.DeepEqual(newPvc, newPvcInfo.pvc()) {
|
||||||
|
t.Errorf("new pvc changed: %v", diff.ObjectReflectDiff(newPvc, newPvcInfo.pvc()))
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
switch {
|
// new pvc should not need to be changed
|
||||||
case enabled || oldPvcHasConditins:
|
if !reflect.DeepEqual(newPvc, newPvcInfo.pvc()) {
|
||||||
// new pvc should not be changed if the feature is enabled, or if the old pvc had Conditions
|
t.Errorf("new pvc changed: %v", diff.ObjectReflectDiff(newPvc, newPvcInfo.pvc()))
|
||||||
if !reflect.DeepEqual(newPvc, newPvcInfo.pvc()) {
|
|
||||||
t.Errorf("new pvc changed: %v", diff.ObjectReflectDiff(newPvc, newPvcInfo.pvc()))
|
|
||||||
}
|
|
||||||
case newPvcHasConditions:
|
|
||||||
// new pvc should be changed
|
|
||||||
if reflect.DeepEqual(newPvc, newPvcInfo.pvc()) {
|
|
||||||
t.Errorf("new pvc was not changed")
|
|
||||||
}
|
|
||||||
// new pvc should not have Conditions
|
|
||||||
if !reflect.DeepEqual(newPvc, pvcWithoutConditions()) {
|
|
||||||
t.Errorf("new pvc had Conditions: %v", diff.ObjectReflectDiff(newPvc, pvcWithoutConditions()))
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
// new pvc should not need to be changed
|
|
||||||
if !reflect.DeepEqual(newPvc, newPvcInfo.pvc()) {
|
|
||||||
t.Errorf("new pvc changed: %v", diff.ObjectReflectDiff(newPvc, newPvcInfo.pvc()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrepareForCreate(t *testing.T) {
|
func TestPrepareForCreate(t *testing.T) {
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow]", func() {
|
var _ = utils.SIGDescribe("[Feature:Flexvolumes] Mounted flexvolume volume expand [Slow]", func() {
|
||||||
var (
|
var (
|
||||||
c clientset.Interface
|
c clientset.Interface
|
||||||
ns string
|
ns string
|
||||||
|
Loading…
Reference in New Issue
Block a user