@@ -636,7 +636,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
636636 coreTpl , cellTpl , shardTpl , baseCluster , clusterName , namespace , finalizerName := setupFixtures (
637637 t ,
638638 )
639- errBoom := errors .New ("boom " )
639+ errSimulated := errors .New ("simulated error for testing " )
640640
641641 tests := map [string ]struct {
642642 multigrescluster * multigresv1alpha1.MultigresCluster
@@ -716,7 +716,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
716716 "Error: Fetch Cluster Failed" : {
717717 existingObjects : []client.Object {},
718718 failureConfig : & testutil.FailureConfig {
719- OnGet : testutil .FailOnKeyName (clusterName , errBoom ),
719+ OnGet : testutil .FailOnKeyName (clusterName , errSimulated ),
720720 },
721721 },
722722 "Error: Add Finalizer Failed" : {
@@ -725,7 +725,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
725725 },
726726 existingObjects : []client.Object {},
727727 failureConfig : & testutil.FailureConfig {
728- OnUpdate : testutil .FailOnObjectName (clusterName , errBoom ),
728+ OnUpdate : testutil .FailOnObjectName (clusterName , errSimulated ),
729729 },
730730 },
731731 "Error: Remove Finalizer Failed" : {
@@ -736,7 +736,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
736736 },
737737 existingObjects : []client.Object {},
738738 failureConfig : & testutil.FailureConfig {
739- OnUpdate : testutil .FailOnObjectName (clusterName , errBoom ),
739+ OnUpdate : testutil .FailOnObjectName (clusterName , errSimulated ),
740740 },
741741 },
742742 "Error: CheckChildrenDeleted (List Cells Failed)" : {
@@ -749,7 +749,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
749749 failureConfig : & testutil.FailureConfig {
750750 OnList : func (list client.ObjectList ) error {
751751 if _ , ok := list .(* multigresv1alpha1.CellList ); ok {
752- return errBoom
752+ return errSimulated
753753 }
754754 return nil
755755 },
@@ -765,7 +765,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
765765 failureConfig : & testutil.FailureConfig {
766766 OnList : func (list client.ObjectList ) error {
767767 if _ , ok := list .(* multigresv1alpha1.TableGroupList ); ok {
768- return errBoom
768+ return errSimulated
769769 }
770770 return nil
771771 },
@@ -781,7 +781,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
781781 failureConfig : & testutil.FailureConfig {
782782 OnList : func (list client.ObjectList ) error {
783783 if _ , ok := list .(* multigresv1alpha1.TopoServerList ); ok {
784- return errBoom
784+ return errSimulated
785785 }
786786 return nil
787787 },
@@ -790,7 +790,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
790790 "Error: Resolve CoreTemplate Failed" : {
791791 existingObjects : []client.Object {coreTpl },
792792 failureConfig : & testutil.FailureConfig {
793- OnGet : testutil .FailOnKeyName ("default-core" , errBoom ),
793+ OnGet : testutil .FailOnKeyName ("default-core" , errSimulated ),
794794 },
795795 },
796796 "Error: Resolve Admin Template Failed (Second Call)" : {
@@ -808,37 +808,37 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
808808 },
809809 },
810810 failureConfig : & testutil.FailureConfig {
811- OnGet : testutil .FailOnKeyName ("admin-core-fail" , errBoom ),
811+ OnGet : testutil .FailOnKeyName ("admin-core-fail" , errSimulated ),
812812 },
813813 },
814814 "Error: Create GlobalTopo Failed" : {
815815 failureConfig : & testutil.FailureConfig {
816- OnCreate : testutil .FailOnObjectName (clusterName + "-global-topo" , errBoom ),
816+ OnCreate : testutil .FailOnObjectName (clusterName + "-global-topo" , errSimulated ),
817817 },
818818 },
819819 "Error: Create MultiAdmin Failed" : {
820820 failureConfig : & testutil.FailureConfig {
821- OnCreate : testutil .FailOnObjectName (clusterName + "-multiadmin" , errBoom ),
821+ OnCreate : testutil .FailOnObjectName (clusterName + "-multiadmin" , errSimulated ),
822822 },
823823 },
824824 "Error: Resolve CellTemplate Failed" : {
825825 failureConfig : & testutil.FailureConfig {
826- OnGet : testutil .FailOnKeyName ("default-cell" , errBoom ),
826+ OnGet : testutil .FailOnKeyName ("default-cell" , errSimulated ),
827827 },
828828 },
829829 "Error: List Existing Cells Failed (Reconcile Loop)" : {
830830 failureConfig : & testutil.FailureConfig {
831831 OnList : func (list client.ObjectList ) error {
832832 if _ , ok := list .(* multigresv1alpha1.CellList ); ok {
833- return errBoom
833+ return errSimulated
834834 }
835835 return nil
836836 },
837837 },
838838 },
839839 "Error: Create Cell Failed" : {
840840 failureConfig : & testutil.FailureConfig {
841- OnCreate : testutil .FailOnObjectName (clusterName + "-zone-a" , errBoom ),
841+ OnCreate : testutil .FailOnObjectName (clusterName + "-zone-a" , errSimulated ),
842842 },
843843 },
844844 "Error: Prune Cell Failed" : {
@@ -853,27 +853,27 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
853853 },
854854 },
855855 failureConfig : & testutil.FailureConfig {
856- OnDelete : testutil .FailOnObjectName (clusterName + "-zone-b" , errBoom ),
856+ OnDelete : testutil .FailOnObjectName (clusterName + "-zone-b" , errSimulated ),
857857 },
858858 },
859859 "Error: List Existing TableGroups Failed" : {
860860 failureConfig : & testutil.FailureConfig {
861861 OnList : func (list client.ObjectList ) error {
862862 if _ , ok := list .(* multigresv1alpha1.TableGroupList ); ok {
863- return errBoom
863+ return errSimulated
864864 }
865865 return nil
866866 },
867867 },
868868 },
869869 "Error: Resolve ShardTemplate Failed" : {
870870 failureConfig : & testutil.FailureConfig {
871- OnGet : testutil .FailOnKeyName ("default-shard" , errBoom ),
871+ OnGet : testutil .FailOnKeyName ("default-shard" , errSimulated ),
872872 },
873873 },
874874 "Error: Create TableGroup Failed" : {
875875 failureConfig : & testutil.FailureConfig {
876- OnCreate : testutil .FailOnObjectName (clusterName + "-db1-tg1" , errBoom ),
876+ OnCreate : testutil .FailOnObjectName (clusterName + "-db1-tg1" , errSimulated ),
877877 },
878878 },
879879 "Error: Prune TableGroup Failed" : {
@@ -888,7 +888,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
888888 },
889889 },
890890 failureConfig : & testutil.FailureConfig {
891- OnDelete : testutil .FailOnObjectName (clusterName + "-orphan-tg" , errBoom ),
891+ OnDelete : testutil .FailOnObjectName (clusterName + "-orphan-tg" , errSimulated ),
892892 },
893893 },
894894 "Error: UpdateStatus (List Cells Failed)" : {
@@ -899,7 +899,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
899899 if _ , ok := list .(* multigresv1alpha1.CellList ); ok {
900900 count ++
901901 if count > 1 {
902- return errBoom
902+ return errSimulated
903903 }
904904 }
905905 return nil
@@ -915,7 +915,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
915915 if _ , ok := list .(* multigresv1alpha1.TableGroupList ); ok {
916916 count ++
917917 if count > 1 {
918- return errBoom
918+ return errSimulated
919919 }
920920 }
921921 return nil
@@ -925,7 +925,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
925925 },
926926 "Error: Update Status Failed (API Error)" : {
927927 failureConfig : & testutil.FailureConfig {
928- OnStatusUpdate : testutil .FailOnObjectName (clusterName , errBoom ),
928+ OnStatusUpdate : testutil .FailOnObjectName (clusterName , errSimulated ),
929929 },
930930 },
931931 "Error: Global Topo Resolution Failed (During Cell Reconcile)" : {
@@ -951,7 +951,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
951951 // Call 1: reconcileGlobalComponents -> ResolveCoreTemplate (Succeeds to proceed)
952952 // Call 2: reconcileCells -> getGlobalTopoRef -> ResolveCoreTemplate (Fails)
953953 if count == 2 {
954- return errBoom
954+ return errSimulated
955955 }
956956 }
957957 return nil
@@ -983,7 +983,7 @@ func TestMultigresClusterReconciler_Reconcile_Failure(t *testing.T) {
983983 // Call 2: reconcileCells (Succeeds)
984984 // Call 3: reconcileDatabases -> getGlobalTopoRef (Fails)
985985 if count == 3 {
986- return errBoom
986+ return errSimulated
987987 }
988988 }
989989 return nil
0 commit comments