@@ -79,12 +79,15 @@ func TestClusterMatchesSpec(t *testing.T) {
7979 t .Run ("Clusters match when Atlas adds default ReplicationSpecs" , func (t * testing.T ) {
8080 atlasCluster , err := mdbv1 .DefaultAWSCluster ("test-ns" , "project-name" ).Spec .Cluster ()
8181 assert .NoError (t , err )
82- atlasCluster .ReplicationSpecs = []mongodbatlas.ReplicationSpec {{
83- ID : "id" ,
84- NumShards : int64ptr (1 ),
85- ZoneName : "zone1" ,
86- RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
87- "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )}}},
82+ atlasCluster .ReplicationSpecs = []mongodbatlas.ReplicationSpec {
83+ {
84+ ID : "id" ,
85+ NumShards : int64ptr (1 ),
86+ ZoneName : "zone1" ,
87+ RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
88+ "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )},
89+ },
90+ },
8891 }
8992 operatorCluster := mdbv1 .DefaultAWSCluster ("test-ns" , "project-name" )
9093 operatorCluster .Spec .ReplicationSpecs = []mdbv1.ReplicationSpec {{
@@ -101,12 +104,15 @@ func TestClusterMatchesSpec(t *testing.T) {
101104 t .Run ("Clusters don't match when Atlas adds default ReplicationSpecs and Operator overrides something" , func (t * testing.T ) {
102105 atlasCluster , err := mdbv1 .DefaultAWSCluster ("test-ns" , "project-name" ).Spec .Cluster ()
103106 assert .NoError (t , err )
104- atlasCluster .ReplicationSpecs = []mongodbatlas.ReplicationSpec {{
105- ID : "id" ,
106- NumShards : int64ptr (1 ),
107- ZoneName : "zone1" ,
108- RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
109- "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )}}},
107+ atlasCluster .ReplicationSpecs = []mongodbatlas.ReplicationSpec {
108+ {
109+ ID : "id" ,
110+ NumShards : int64ptr (1 ),
111+ ZoneName : "zone1" ,
112+ RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
113+ "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )},
114+ },
115+ },
110116 }
111117 operatorCluster := mdbv1 .DefaultAWSCluster ("test-ns" , "project-name" )
112118 operatorCluster .Spec .ReplicationSpecs = []mdbv1.ReplicationSpec {{
@@ -117,12 +123,15 @@ func TestClusterMatchesSpec(t *testing.T) {
117123 merged , err := MergedCluster (* atlasCluster , operatorCluster .Spec )
118124 assert .NoError (t , err )
119125
120- expectedReplicationSpecs := []mongodbatlas.ReplicationSpec {{
121- ID : "id" ,
122- NumShards : int64ptr (2 ),
123- ZoneName : "zone5" ,
124- RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
125- "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )}}},
126+ expectedReplicationSpecs := []mongodbatlas.ReplicationSpec {
127+ {
128+ ID : "id" ,
129+ NumShards : int64ptr (2 ),
130+ ZoneName : "zone5" ,
131+ RegionsConfig : map [string ]mongodbatlas.RegionsConfig {
132+ "US_EAST" : {AnalyticsNodes : int64ptr (0 ), ElectableNodes : int64ptr (3 ), Priority : int64ptr (7 ), ReadOnlyNodes : int64ptr (0 )},
133+ },
134+ },
126135 }
127136 assert .Equal (t , expectedReplicationSpecs , merged .ReplicationSpecs )
128137
@@ -167,6 +176,7 @@ func TestClusterMatchesSpec(t *testing.T) {
167176 assert .False (t , equal )
168177 })
169178}
179+
170180func int64ptr (i int64 ) * int64 {
171181 return & i
172182}
0 commit comments