@@ -1572,10 +1572,9 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
1572
1572
},
1573
1573
}
1574
1574
type dsUpdateTest struct {
1575
- old apps.DaemonSet
1576
- update apps.DaemonSet
1577
- expectedErrNum int
1578
- enableSkipReadOnlyValidationGCE bool
1575
+ old apps.DaemonSet
1576
+ update apps.DaemonSet
1577
+ expectedErrNum int
1579
1578
}
1580
1579
successCases := map [string ]dsUpdateTest {
1581
1580
"no change" : {
@@ -1729,7 +1728,6 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
1729
1728
},
1730
1729
},
1731
1730
"Read-write volume verification" : {
1732
- enableSkipReadOnlyValidationGCE : true ,
1733
1731
old : apps.DaemonSet {
1734
1732
ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
1735
1733
Spec : apps.DaemonSetSpec {
@@ -1756,7 +1754,6 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
1756
1754
}
1757
1755
for testName , successCase := range successCases {
1758
1756
t .Run (testName , func (t * testing.T ) {
1759
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , successCase .enableSkipReadOnlyValidationGCE )()
1760
1757
// ResourceVersion is required for updates.
1761
1758
successCase .old .ObjectMeta .ResourceVersion = "1"
1762
1759
successCase .update .ObjectMeta .ResourceVersion = "2"
@@ -1848,32 +1845,6 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
1848
1845
},
1849
1846
expectedErrNum : 1 ,
1850
1847
},
1851
- "invalid read-write volume" : {
1852
- enableSkipReadOnlyValidationGCE : false ,
1853
- old : apps.DaemonSet {
1854
- ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
1855
- Spec : apps.DaemonSetSpec {
1856
- Selector : & metav1.LabelSelector {MatchLabels : validSelector },
1857
- TemplateGeneration : 1 ,
1858
- Template : validPodTemplateAbc .Template ,
1859
- UpdateStrategy : apps.DaemonSetUpdateStrategy {
1860
- Type : apps .OnDeleteDaemonSetStrategyType ,
1861
- },
1862
- },
1863
- },
1864
- update : apps.DaemonSet {
1865
- ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
1866
- Spec : apps.DaemonSetSpec {
1867
- Selector : & metav1.LabelSelector {MatchLabels : validSelector },
1868
- TemplateGeneration : 2 ,
1869
- Template : readWriteVolumePodTemplate .Template ,
1870
- UpdateStrategy : apps.DaemonSetUpdateStrategy {
1871
- Type : apps .OnDeleteDaemonSetStrategyType ,
1872
- },
1873
- },
1874
- },
1875
- expectedErrNum : 1 ,
1876
- },
1877
1848
"invalid update strategy" : {
1878
1849
old : apps.DaemonSet {
1879
1850
ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
@@ -1977,7 +1948,6 @@ func TestValidateDaemonSetUpdate(t *testing.T) {
1977
1948
}
1978
1949
for testName , errorCase := range errorCases {
1979
1950
t .Run (testName , func (t * testing.T ) {
1980
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , errorCase .enableSkipReadOnlyValidationGCE )()
1981
1951
// ResourceVersion is required for updates.
1982
1952
errorCase .old .ObjectMeta .ResourceVersion = "1"
1983
1953
errorCase .update .ObjectMeta .ResourceVersion = "2"
@@ -2645,10 +2615,9 @@ func TestValidateDeploymentUpdate(t *testing.T) {
2645
2615
},
2646
2616
}
2647
2617
type depUpdateTest struct {
2648
- old apps.Deployment
2649
- update apps.Deployment
2650
- expectedErrNum int
2651
- enableSkipReadOnlyValidationGCE bool
2618
+ old apps.Deployment
2619
+ update apps.Deployment
2620
+ expectedErrNum int
2652
2621
}
2653
2622
successCases := map [string ]depUpdateTest {
2654
2623
"positive replicas" : {
@@ -2671,7 +2640,6 @@ func TestValidateDeploymentUpdate(t *testing.T) {
2671
2640
},
2672
2641
},
2673
2642
"Read-write volume verification" : {
2674
- enableSkipReadOnlyValidationGCE : true ,
2675
2643
old : apps.Deployment {
2676
2644
ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
2677
2645
Spec : apps.DeploymentSpec {
@@ -2693,7 +2661,6 @@ func TestValidateDeploymentUpdate(t *testing.T) {
2693
2661
}
2694
2662
for testName , successCase := range successCases {
2695
2663
t .Run (testName , func (t * testing.T ) {
2696
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , successCase .enableSkipReadOnlyValidationGCE )()
2697
2664
// ResourceVersion is required for updates.
2698
2665
successCase .old .ObjectMeta .ResourceVersion = "1"
2699
2666
successCase .update .ObjectMeta .ResourceVersion = "2"
@@ -2710,26 +2677,6 @@ func TestValidateDeploymentUpdate(t *testing.T) {
2710
2677
}
2711
2678
})
2712
2679
errorCases := map [string ]depUpdateTest {
2713
- "more than one read/write" : {
2714
- old : apps.Deployment {
2715
- ObjectMeta : metav1.ObjectMeta {Name : "" , Namespace : metav1 .NamespaceDefault },
2716
- Spec : apps.DeploymentSpec {
2717
- Selector : & metav1.LabelSelector {MatchLabels : validLabels },
2718
- Template : validPodTemplate .Template ,
2719
- Strategy : apps.DeploymentStrategy {Type : apps .RecreateDeploymentStrategyType },
2720
- },
2721
- },
2722
- update : apps.Deployment {
2723
- ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
2724
- Spec : apps.DeploymentSpec {
2725
- Replicas : 2 ,
2726
- Selector : & metav1.LabelSelector {MatchLabels : validLabels },
2727
- Template : readWriteVolumePodTemplate .Template ,
2728
- Strategy : apps.DeploymentStrategy {Type : apps .RecreateDeploymentStrategyType },
2729
- },
2730
- },
2731
- expectedErrNum : 2 ,
2732
- },
2733
2680
"invalid selector" : {
2734
2681
old : apps.Deployment {
2735
2682
ObjectMeta : metav1.ObjectMeta {Name : "" , Namespace : metav1 .NamespaceDefault },
@@ -2793,7 +2740,6 @@ func TestValidateDeploymentUpdate(t *testing.T) {
2793
2740
}
2794
2741
for testName , errorCase := range errorCases {
2795
2742
t .Run (testName , func (t * testing.T ) {
2796
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , errorCase .enableSkipReadOnlyValidationGCE )()
2797
2743
// ResourceVersion is required for updates.
2798
2744
errorCase .old .ObjectMeta .ResourceVersion = "1"
2799
2745
errorCase .update .ObjectMeta .ResourceVersion = "2"
@@ -3074,10 +3020,9 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
3074
3020
},
3075
3021
}
3076
3022
type rcUpdateTest struct {
3077
- old apps.ReplicaSet
3078
- update apps.ReplicaSet
3079
- expectedErrNum int
3080
- enableSkipReadOnlyValidationGCE bool
3023
+ old apps.ReplicaSet
3024
+ update apps.ReplicaSet
3025
+ expectedErrNum int
3081
3026
}
3082
3027
successCases := map [string ]rcUpdateTest {
3083
3028
"positive replicas" : {
@@ -3098,7 +3043,6 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
3098
3043
},
3099
3044
},
3100
3045
"Read-write volume verification" : {
3101
- enableSkipReadOnlyValidationGCE : true ,
3102
3046
old : apps.ReplicaSet {
3103
3047
ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
3104
3048
Spec : apps.ReplicaSetSpec {
@@ -3118,7 +3062,6 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
3118
3062
}
3119
3063
for testName , successCase := range successCases {
3120
3064
t .Run (testName , func (t * testing.T ) {
3121
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , successCase .enableSkipReadOnlyValidationGCE )()
3122
3065
// ResourceVersion is required for updates.
3123
3066
successCase .old .ObjectMeta .ResourceVersion = "1"
3124
3067
successCase .update .ObjectMeta .ResourceVersion = "2"
@@ -3136,24 +3079,6 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
3136
3079
})
3137
3080
}
3138
3081
errorCases := map [string ]rcUpdateTest {
3139
- "more than one read/write" : {
3140
- old : apps.ReplicaSet {
3141
- ObjectMeta : metav1.ObjectMeta {Name : "" , Namespace : metav1 .NamespaceDefault },
3142
- Spec : apps.ReplicaSetSpec {
3143
- Selector : & metav1.LabelSelector {MatchLabels : validLabels },
3144
- Template : validPodTemplate .Template ,
3145
- },
3146
- },
3147
- update : apps.ReplicaSet {
3148
- ObjectMeta : metav1.ObjectMeta {Name : "abc" , Namespace : metav1 .NamespaceDefault },
3149
- Spec : apps.ReplicaSetSpec {
3150
- Replicas : 2 ,
3151
- Selector : & metav1.LabelSelector {MatchLabels : validLabels },
3152
- Template : readWriteVolumePodTemplate .Template ,
3153
- },
3154
- },
3155
- expectedErrNum : 2 ,
3156
- },
3157
3082
"invalid selector" : {
3158
3083
old : apps.ReplicaSet {
3159
3084
ObjectMeta : metav1.ObjectMeta {Name : "" , Namespace : metav1 .NamespaceDefault },
@@ -3211,7 +3136,6 @@ func TestValidateReplicaSetUpdate(t *testing.T) {
3211
3136
}
3212
3137
for testName , errorCase := range errorCases {
3213
3138
t .Run (testName , func (t * testing.T ) {
3214
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , features .SkipReadOnlyValidationGCE , errorCase .enableSkipReadOnlyValidationGCE )()
3215
3139
// ResourceVersion is required for updates.
3216
3140
errorCase .old .ObjectMeta .ResourceVersion = "1"
3217
3141
errorCase .update .ObjectMeta .ResourceVersion = "2"
0 commit comments