Fix flexvolume online resizing tests
This commit is contained in:
		@@ -76,13 +76,12 @@ func TestDropConditions(t *testing.T) {
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, enabled := range []bool{true} {
 | 
			
		||||
	for _, oldPvcInfo := range pvcInfo {
 | 
			
		||||
		for _, newPvcInfo := range pvcInfo {
 | 
			
		||||
			oldPvcHasConditins, oldPvc := oldPvcInfo.hasConditions, oldPvcInfo.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)
 | 
			
		||||
 | 
			
		||||
				// old pvc should never be changed
 | 
			
		||||
@@ -91,20 +90,11 @@ func TestDropConditions(t *testing.T) {
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				switch {
 | 
			
		||||
					case enabled || oldPvcHasConditins:
 | 
			
		||||
				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()))
 | 
			
		||||
					}
 | 
			
		||||
					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()) {
 | 
			
		||||
@@ -114,7 +104,7 @@ func TestDropConditions(t *testing.T) {
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestPrepareForCreate(t *testing.T) {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ import (
 | 
			
		||||
	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 (
 | 
			
		||||
		c                 clientset.Interface
 | 
			
		||||
		ns                string
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user