@@ -698,34 +698,34 @@ func TestValidateServiceInstance(t *testing.T) {
698
698
699
699
func TestInternalValidateServiceInstanceUpdateAllowed (t * testing.T ) {
700
700
cases := []struct {
701
- name string
702
- newSpecChange bool
703
- onGoingSpecChange bool
704
- valid bool
701
+ name string
702
+ specChange bool
703
+ onGoingOperation bool
704
+ valid bool
705
705
}{
706
706
{
707
- name : "spec change when no on-going spec change " ,
708
- newSpecChange : true ,
709
- onGoingSpecChange : false ,
710
- valid : true ,
707
+ name : "spec change when no on-going operation " ,
708
+ specChange : true ,
709
+ onGoingOperation : false ,
710
+ valid : true ,
711
711
},
712
712
{
713
- name : "spec change when on-going spec change " ,
714
- newSpecChange : true ,
715
- onGoingSpecChange : true ,
716
- valid : false ,
713
+ name : "spec change when on-going operation " ,
714
+ specChange : true ,
715
+ onGoingOperation : true ,
716
+ valid : false ,
717
717
},
718
718
{
719
- name : "meta change when no on-going spec change " ,
720
- newSpecChange : false ,
721
- onGoingSpecChange : false ,
722
- valid : true ,
719
+ name : "meta change when no on-going operation " ,
720
+ specChange : false ,
721
+ onGoingOperation : false ,
722
+ valid : true ,
723
723
},
724
724
{
725
- name : "meta change when on-going spec change " ,
726
- newSpecChange : false ,
727
- onGoingSpecChange : true ,
728
- valid : true ,
725
+ name : "meta change when on-going operation " ,
726
+ specChange : false ,
727
+ onGoingOperation : true ,
728
+ valid : true ,
729
729
},
730
730
}
731
731
@@ -742,12 +742,10 @@ func TestInternalValidateServiceInstanceUpdateAllowed(t *testing.T) {
742
742
},
743
743
},
744
744
}
745
- if tc .onGoingSpecChange {
746
- oldInstance .Generation = 2
747
- } else {
748
- oldInstance .Generation = 1
745
+ oldInstance .Generation = 1
746
+ if tc .onGoingOperation {
747
+ oldInstance .Status .CurrentOperation = servicecatalog .ServiceInstanceOperationProvision
749
748
}
750
- oldInstance .Status .ReconciledGeneration = 1
751
749
752
750
newInstance := & servicecatalog.ServiceInstance {
753
751
ObjectMeta : metav1.ObjectMeta {
@@ -756,17 +754,16 @@ func TestInternalValidateServiceInstanceUpdateAllowed(t *testing.T) {
756
754
},
757
755
Spec : servicecatalog.ServiceInstanceSpec {
758
756
PlanReference : servicecatalog.PlanReference {
759
- ClusterServiceClassExternalName : "test-serviceclass" ,
760
- ClusterServicePlanExternalName : "test-plan" ,
757
+ ClusterServiceClassExternalName : clusterServiceClassExternalName ,
758
+ ClusterServicePlanExternalName : clusterServicePlanExternalName ,
761
759
},
762
760
},
763
761
}
764
- if tc .newSpecChange {
762
+ if tc .specChange {
765
763
newInstance .Generation = oldInstance .Generation + 1
766
764
} else {
767
765
newInstance .Generation = oldInstance .Generation
768
766
}
769
- newInstance .Status .ReconciledGeneration = 1
770
767
771
768
errs := internalValidateServiceInstanceUpdateAllowed (newInstance , oldInstance )
772
769
if len (errs ) != 0 && tc .valid {
0 commit comments