Skip to content

Commit 51d1614

Browse files
authored
multiregion (#190)
1 parent 02d73f4 commit 51d1614

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

test/e2e/configuration_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ var _ = Describe("[cluster-ns] Configuration namespaced. Deploy cluster", func()
8787
},
8888
30002,
8989
)),
90-
// Entry(newData("Multiregion, Backup and 2 users", "data/atlascluster_multiregion.yaml",
91-
// append(
92-
// []utils.DBUser{},
93-
// *utils.NewDBUser("user1").
94-
// WithSecretRef("dbuser-secret-u1").
95-
// AddRole("atlasAdmin", "admin", ""),
96-
// *utils.NewDBUser("user2").
97-
// WithSecretRef("dbuser-secret-u2").
98-
// AddRole("atlasAdmin", "admin", ""),
99-
// ),
100-
// )), // TODO CLOUDP-83419
90+
Entry(newData("Multiregion, Backup and 2 users", "data/atlascluster_multiregion.yaml",
91+
[]model.DBUser{
92+
*model.NewDBUser("user1").
93+
WithSecretRef("dbuser-secret-u1").
94+
AddRole("atlasAdmin", "admin", ""),
95+
*model.NewDBUser("user2").
96+
WithSecretRef("dbuser-secret-u2").
97+
AddRole("atlasAdmin", "admin", ""),
98+
},
99+
30004,
100+
)),
101101
)
102102
})
103103

@@ -133,7 +133,6 @@ func mainCycle(clusterConfigurationFile string, resources model.UserInputs, port
133133

134134
By("Create namespaced Operator\n", func() {
135135
CopyKustomizeNamespaceOperator(resources)
136-
// CreateCopyKustomizeNamespace(resources.namespace)
137136
kube.Apply("-k", resources.GetOperatorFolder())
138137
Eventually(
139138
kube.GetPodStatus(resources.Namespace),
@@ -168,9 +167,9 @@ func mainCycle(clusterConfigurationFile string, resources model.UserInputs, port
168167
})
169168

170169
By("Deploy application for user", func() {
171-
// // kube apply application
172-
// // send ddata
173-
// // retrieve data
170+
// kube apply application
171+
// send data
172+
// retrieve data
174173
for i, user := range resources.Users { // TODO in parallel(?)
175174
// data
176175
port := strconv.Itoa(i + portGroup)

test/e2e/user_input_test.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,28 @@ func compareClustersSpec(requested model.ClusterSpec, created mongodbatlas.Clust
7272
"ProviderSettings": PointTo(MatchFields(IgnoreExtras, Fields{
7373
"InstanceSizeName": Equal(requested.ProviderSettings.InstanceSizeName),
7474
"ProviderName": Equal(string(requested.ProviderSettings.ProviderName)),
75-
"RegionName": Equal(requested.ProviderSettings.RegionName),
7675
})),
7776
"ConnectionStrings": PointTo(MatchFields(IgnoreExtras, Fields{
7877
"Standard": Not(BeEmpty()),
7978
"StandardSrv": Not(BeEmpty()),
8079
})),
8180
}), "Cluster should be the same as requested by the user")
81+
82+
if len(requested.ReplicationSpecs) > 0 {
83+
for i, replica := range requested.ReplicationSpecs {
84+
for key, region := range replica.RegionsConfig {
85+
// diffent type
86+
ExpectWithOffset(1, created.ReplicationSpecs[i].RegionsConfig[key].AnalyticsNodes).Should(PointTo(Equal(*region.AnalyticsNodes)), "Replica Spec: AnalyticsNodes is not the same")
87+
ExpectWithOffset(1, created.ReplicationSpecs[i].RegionsConfig[key].ElectableNodes).Should(PointTo(Equal(*region.ElectableNodes)), "Replica Spec: ElectableNodes is not the same")
88+
ExpectWithOffset(1, created.ReplicationSpecs[i].RegionsConfig[key].Priority).Should(PointTo(Equal(*region.Priority)), "Replica Spec: Priority is not the same")
89+
ExpectWithOffset(1, created.ReplicationSpecs[i].RegionsConfig[key].ReadOnlyNodes).Should(PointTo(Equal(*region.ReadOnlyNodes)), "Replica Spec: ReadOnlyNodes is not the same")
90+
}
91+
}
92+
} else {
93+
ExpectWithOffset(1, requested.ProviderSettings).To(PointTo(MatchFields(IgnoreExtras, Fields{
94+
"RegionName": Equal(created.ProviderSettings.RegionName),
95+
})), "Cluster should be the same as requested by the user: Region Name")
96+
}
8297
}
8398

8499
func SaveK8sResources(resources []string, ns string) {
@@ -110,9 +125,7 @@ func checkUsersAttributes(input model.UserInputs) {
110125

111126
// CopyKustomizeNamespaceOperator create copy of `/deploy/namespaced` folder with kustomization file for overriding namespace
112127
func CopyKustomizeNamespaceOperator(input model.UserInputs) {
113-
// fullPath := filepath.Join("data", input.projectName, "operator")
114128
fullPath := input.GetOperatorFolder()
115-
// fullPath := filepath.Dir(projectPath)
116129
os.Mkdir(fullPath, os.ModePerm)
117130
utils.CopyFile("../../deploy/namespaced/crds.yaml", filepath.Join(fullPath, "crds.yaml"))
118131
utils.CopyFile("../../deploy/namespaced/namespaced-config.yaml", filepath.Join(fullPath, "namespaced-config.yaml"))

0 commit comments

Comments
 (0)