@@ -1150,7 +1150,7 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
1150
1150
})
1151
1151
1152
1152
When ("setting 2 logs per disk" , func () {
1153
- var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt int
1153
+ var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt , serverPerPod int
1154
1154
1155
1155
BeforeEach (func () {
1156
1156
initialLogServerPerPod = fdbCluster .GetLogServersPerPod ()
@@ -1165,67 +1165,17 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
1165
1165
Eventually (func () int {
1166
1166
return len (fdbCluster .GetLogPods ().Items )
1167
1167
}).Should (BeNumerically ("==" , expectedPodCnt ))
1168
+
1169
+ serverPerPod = initialLogServerPerPod * 2
1170
+ log .Printf ("new log servers per Pod: %d" , serverPerPod )
1168
1171
})
1169
1172
1170
1173
AfterEach (func () {
1171
1174
log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
1172
1175
Expect (
1173
1176
fdbCluster .SetLogServersPerPod (initialLogServerPerPod , true ),
1174
1177
).ShouldNot (HaveOccurred ())
1175
- log .Printf (
1176
- "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1177
- expectedPodCnt ,
1178
- expectedPodCnt * initialLogServerPerPod ,
1179
- )
1180
- Eventually (func () int {
1181
- return len (fdbCluster .GetLogPods ().Items )
1182
- }).Should (BeNumerically ("==" , expectedPodCnt ))
1183
- })
1184
1178
1185
- It ("should update the log servers to the expected amount" , func () {
1186
- serverPerPod := initialLogServerPerPod * 2
1187
- log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
1188
- Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
1189
- log .Printf (
1190
- "expectedPodCnt: %d, expectedStorageProcessesCnt: %d" ,
1191
- expectedPodCnt ,
1192
- expectedPodCnt * serverPerPod ,
1193
- )
1194
- fdbCluster .ValidateProcessesCount (
1195
- fdbv1beta2 .ProcessClassLog ,
1196
- expectedPodCnt ,
1197
- expectedPodCnt * serverPerPod ,
1198
- )
1199
- })
1200
- })
1201
-
1202
- When ("setting 2 logs per disk to use transaction process" , func () {
1203
- var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt int
1204
-
1205
- BeforeEach (func () {
1206
- initialLogServerPerPod = fdbCluster .GetLogServersPerPod ()
1207
- initialPods := fdbCluster .GetLogPods ()
1208
- expectedPodCnt = len (initialPods .Items )
1209
- expectedLogProcessesCnt = expectedPodCnt * initialLogServerPerPod
1210
- log .Printf (
1211
- "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1212
- expectedPodCnt ,
1213
- expectedLogProcessesCnt ,
1214
- )
1215
- Eventually (func () int {
1216
- return len (fdbCluster .GetLogPods ().Items )
1217
- }).Should (BeNumerically ("==" , expectedPodCnt ))
1218
- })
1219
-
1220
- AfterEach (func () {
1221
- log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
1222
- Expect (
1223
- fdbCluster .SetTransactionServerPerPod (
1224
- initialLogServerPerPod ,
1225
- expectedLogProcessesCnt ,
1226
- true ,
1227
- ),
1228
- ).ShouldNot (HaveOccurred ())
1229
1179
log .Printf (
1230
1180
"expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1231
1181
expectedPodCnt ,
@@ -1236,29 +1186,76 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
1236
1186
}).Should (BeNumerically ("==" , expectedPodCnt ))
1237
1187
})
1238
1188
1239
- It (
1240
- "should update the log servers to the expected amount and should create transaction Pods" ,
1241
- func () {
1242
- serverPerPod := initialLogServerPerPod * 2
1243
- Expect (
1244
- fdbCluster .SetTransactionServerPerPod (
1245
- serverPerPod ,
1246
- expectedLogProcessesCnt ,
1247
- true ,
1248
- ),
1249
- ).ShouldNot (HaveOccurred ())
1189
+ When ("when using log servers" , func () {
1190
+ BeforeEach (func () {
1191
+ Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
1192
+ })
1193
+
1194
+ It ("should update the log servers to the expected amount" , func () {
1195
+ Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
1250
1196
log .Printf (
1251
1197
"expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1252
1198
expectedPodCnt ,
1253
1199
expectedPodCnt * serverPerPod ,
1254
1200
)
1255
1201
fdbCluster .ValidateProcessesCount (
1256
- fdbv1beta2 .ProcessClassTransaction ,
1202
+ fdbv1beta2 .ProcessClassLog ,
1257
1203
expectedPodCnt ,
1258
1204
expectedPodCnt * serverPerPod ,
1259
1205
)
1260
- },
1261
- )
1206
+ })
1207
+ })
1208
+
1209
+ When ("migrating from log processes to transaction processes" , func () {
1210
+ BeforeEach (func () {
1211
+ // Change the servers per pod and change the transaction process counts and set the log process counts
1212
+ // to -1.
1213
+ cluster := fdbCluster .GetCluster ()
1214
+ spec := cluster .Spec .DeepCopy ()
1215
+ spec .LogServersPerPod = serverPerPod
1216
+
1217
+ processCounts , err := cluster .GetProcessCountsWithDefaults ()
1218
+ Expect (err ).NotTo (HaveOccurred ())
1219
+ spec .ProcessCounts .Transaction = processCounts .Log
1220
+ spec .ProcessCounts .Log = - 1
1221
+
1222
+ // process counts with default?
1223
+ log .Println (spec .ProcessCounts )
1224
+ fdbCluster .UpdateClusterSpecWithSpec (spec )
1225
+ Expect (fdbCluster .WaitForReconciliation ()).NotTo (HaveOccurred ())
1226
+ })
1227
+
1228
+ AfterEach (func () {
1229
+ // Reset the transaction process class changes and make sure we create log pods again.
1230
+ cluster := fdbCluster .GetCluster ()
1231
+ spec := cluster .Spec .DeepCopy ()
1232
+ spec .LogServersPerPod = initialLogServerPerPod
1233
+
1234
+ processCounts , err := cluster .GetProcessCountsWithDefaults ()
1235
+ Expect (err ).NotTo (HaveOccurred ())
1236
+ spec .ProcessCounts .Log = processCounts .Transaction
1237
+ spec .ProcessCounts .Transaction = - 1
1238
+ log .Println (spec .ProcessCounts )
1239
+ fdbCluster .UpdateClusterSpecWithSpec (spec )
1240
+ Expect (fdbCluster .WaitForReconciliation ()).NotTo (HaveOccurred ())
1241
+ })
1242
+
1243
+ It (
1244
+ "should update the log servers to the expected amount and should create transaction Pods" ,
1245
+ func () {
1246
+ log .Printf (
1247
+ "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1248
+ expectedPodCnt ,
1249
+ expectedPodCnt * serverPerPod ,
1250
+ )
1251
+ fdbCluster .ValidateProcessesCount (
1252
+ fdbv1beta2 .ProcessClassTransaction ,
1253
+ expectedPodCnt ,
1254
+ expectedPodCnt * serverPerPod ,
1255
+ )
1256
+ },
1257
+ )
1258
+ })
1262
1259
})
1263
1260
1264
1261
When ("Replacing a Pod with PVC stuck in Terminating state" , func () {
0 commit comments