@@ -22,20 +22,26 @@ package v1beta2
22
22
23
23
import (
24
24
"encoding/json"
25
+ "maps"
25
26
"net"
26
27
"os"
27
28
"path/filepath"
28
-
29
- "k8s.io/utils/pointer"
29
+ "slices"
30
30
31
31
. "github.com/onsi/ginkgo/v2"
32
32
. "github.com/onsi/gomega"
33
+ "github.com/onsi/gomega/format"
34
+ "k8s.io/utils/pointer"
33
35
)
34
36
35
37
var _ = Describe ("FoundationDBStatus" , func () {
38
+ BeforeEach (func () {
39
+ format .MaxLength = 10000000
40
+ })
41
+
36
42
When ("parsing the status json with a 7.1.0-rc1 cluster" , func () {
37
43
migrationType := StorageMigrationTypeDisabled
38
- status := FoundationDBStatusClusterInfo {
44
+ clusterInfo := FoundationDBStatusClusterInfo {
39
45
Messages : []FoundationDBStatusMessage {},
40
46
IncompatibleConnections : []string {},
41
47
ConnectionString :
"test_cluster:[email protected] :4501,10.1.18.254:4501,10.1.19.0:4501" ,
@@ -73,10 +79,23 @@ var _ = Describe("FoundationDBStatus", func() {
73
79
{
74
80
Role : string (ProcessRoleGrvProxy ),
75
81
ID : "0de7f5c5e549cad1" ,
82
+ GRVLatencyStatistics : FoundationDBStatusGRVStatistics {
83
+ Batch : FoundationDBStatusPerfStatistics {Count : pointer .Int (6 ), Median : pointer .Float64 (0.000531435 ), P99 : pointer .Float64 (0.00130677 )},
84
+ Default : FoundationDBStatusPerfStatistics {Count : pointer .Int (225 ), Median : pointer .Float64 (0.00062561 ), P99 : pointer .Float64 (0.010715200000000001 )},
85
+ },
76
86
},
77
87
{
78
88
Role : string (ProcessRoleStorage ),
79
89
ID : "9941616400759d37" ,
90
+ DataLag : FoundationDBStatusLagInfo {
91
+ Seconds : 0.19625800000000002 ,
92
+ Versions : 196258 ,
93
+ },
94
+ KVStoreUsedBytes : pointer .Int64 (104878232 ),
95
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
96
+ KVStoreFreeBytes : pointer .Int64 (84178223104 ),
97
+ KVStoreAvailableBytes : pointer .Int64 (84178223104 ),
98
+ ReadLatencyStatistics : FoundationDBStatusPerfStatistics {Count : pointer .Int (297 ), Median : pointer .Float64 (0.000116825 ), P99 : pointer .Float64 (0.000711441 )},
80
99
},
81
100
},
82
101
Messages : []FoundationDBStatusProcessMessage {},
@@ -100,8 +119,14 @@ var _ = Describe("FoundationDBStatus", func() {
100
119
Roles : []FoundationDBStatusProcessRoleInfo {
101
120
{Role : string (ProcessRoleCoordinator )},
102
121
{
103
- Role : string (ProcessClassStorage ),
104
- ID : "389c23d59a646e52" ,
122
+ Role : string (ProcessClassStorage ),
123
+ ID : "389c23d59a646e52" ,
124
+ DataLag : FoundationDBStatusLagInfo {Seconds : 2.1227 , Versions : 2122697 },
125
+ KVStoreUsedBytes : pointer .Int64 (104878232 ),
126
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
127
+ KVStoreFreeBytes : pointer .Int64 (84178239488 ),
128
+ KVStoreAvailableBytes : pointer .Int64 (84178239488 ),
129
+ ReadLatencyStatistics : FoundationDBStatusPerfStatistics {Count : pointer .Int (334 ), Median : pointer .Float64 (0.000102282 ), P99 : pointer .Float64 (0.000386477 )},
105
130
},
106
131
{
107
132
Role : string (ProcessRoleResolver ),
@@ -131,10 +156,24 @@ var _ = Describe("FoundationDBStatus", func() {
131
156
{
132
157
Role : string (ProcessRoleCommitProxy ),
133
158
ID : "0eb90e4a0ece85b3" ,
159
+ CommitLatencyStatistics : FoundationDBStatusPerfStatistics {
160
+ Count : pointer .Int (31 ),
161
+ Median : pointer .Float64 (0.00794888 ),
162
+ P99 : pointer .Float64 (0.09054090000000001 ),
163
+ },
134
164
},
135
165
{
136
166
Role : string (ProcessRoleStorage ),
137
167
ID : "b5e42e100018bf11" ,
168
+ DataLag : FoundationDBStatusLagInfo {
169
+ Seconds : 0.19625800000000002 ,
170
+ Versions : 196258 ,
171
+ },
172
+ KVStoreUsedBytes : pointer .Int64 (104861752 ),
173
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
174
+ KVStoreFreeBytes : pointer .Int64 (84178112512 ),
175
+ KVStoreAvailableBytes : pointer .Int64 (84178112512 ),
176
+ ReadLatencyStatistics : FoundationDBStatusPerfStatistics {Count : pointer .Int (0 ), Median : pointer .Float64 (0 ), P99 : pointer .Float64 (0 )},
138
177
},
139
178
},
140
179
Messages : []FoundationDBStatusProcessMessage {},
@@ -213,8 +252,12 @@ var _ = Describe("FoundationDBStatus", func() {
213
252
UptimeSeconds : 85.0029 ,
214
253
Roles : []FoundationDBStatusProcessRoleInfo {
215
254
{
216
- Role : string (ProcessRoleLog ),
217
- ID : "2c66a861b33b2697" ,
255
+ Role : string (ProcessRoleLog ),
256
+ ID : "2c66a861b33b2697" ,
257
+ KVStoreUsedBytes : pointer .Int64 (104861752 ),
258
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
259
+ KVStoreFreeBytes : pointer .Int64 (84178214912 ),
260
+ KVStoreAvailableBytes : pointer .Int64 (84178214912 ),
218
261
},
219
262
},
220
263
Messages : []FoundationDBStatusProcessMessage {},
@@ -237,8 +280,12 @@ var _ = Describe("FoundationDBStatus", func() {
237
280
UptimeSeconds : 85.003 ,
238
281
Roles : []FoundationDBStatusProcessRoleInfo {
239
282
{
240
- Role : string (ProcessRoleLog ),
241
- ID : "56cf105980ec2b07" ,
283
+ Role : string (ProcessRoleLog ),
284
+ ID : "56cf105980ec2b07" ,
285
+ KVStoreUsedBytes : pointer .Int64 (104861752 ),
286
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
287
+ KVStoreFreeBytes : pointer .Int64 (84178214912 ),
288
+ KVStoreAvailableBytes : pointer .Int64 (84178214912 ),
242
289
},
243
290
},
244
291
Messages : []FoundationDBStatusProcessMessage {},
@@ -261,8 +308,12 @@ var _ = Describe("FoundationDBStatus", func() {
261
308
UptimeSeconds : 85.0027 ,
262
309
Roles : []FoundationDBStatusProcessRoleInfo {
263
310
{
264
- Role : string (ProcessRoleLog ),
265
- ID : "31754d1d7d8d6f05" ,
311
+ Role : string (ProcessRoleLog ),
312
+ ID : "31754d1d7d8d6f05" ,
313
+ KVStoreUsedBytes : pointer .Int64 (104861752 ),
314
+ KVStoreTotalBytes : pointer .Int64 (135012552704 ),
315
+ KVStoreFreeBytes : pointer .Int64 (84178202624 ),
316
+ KVStoreAvailableBytes : pointer .Int64 (84178202624 ),
266
317
},
267
318
},
268
319
Messages : []FoundationDBStatusProcessMessage {},
@@ -274,10 +325,12 @@ var _ = Describe("FoundationDBStatus", func() {
274
325
State : FoundationDBStatusDataState {Description : "" , Healthy : true , Name : "healthy" , MinReplicasRemaining : 2 },
275
326
TeamTrackers : []FoundationDBStatusTeamTracker {
276
327
{
277
- Primary : true ,
278
- State : FoundationDBStatusDataState {Description : "" , Healthy : true , Name : "healthy" , MinReplicasRemaining : 2 },
328
+ Primary : true ,
329
+ State : FoundationDBStatusDataState {Description : "" , Healthy : true , Name : "healthy" , MinReplicasRemaining : 2 },
330
+ UnhealthyServers : pointer .Int64 (0 ),
279
331
},
280
332
},
333
+ TotalDiskUsedBytes : pointer .Int64 (629203472 ),
281
334
},
282
335
FullReplication : true ,
283
336
Clients : FoundationDBStatusClusterClientInfo {
@@ -399,6 +452,7 @@ var _ = Describe("FoundationDBStatus", func() {
399
452
},
400
453
},
401
454
Layers : FoundationDBStatusLayerInfo {
455
+ Valid : pointer .Bool (true ),
402
456
Backup : FoundationDBStatusBackupInfo {Paused : false , Tags : nil },
403
457
Error : "" ,
404
458
},
@@ -442,6 +496,11 @@ var _ = Describe("FoundationDBStatus", func() {
442
496
BounceImpact : FoundationDBBounceImpact {
443
497
CanCleanBounce : pointer .Bool (true ),
444
498
},
499
+ DatabaseAvailable : pointer .Bool (true ),
500
+ ActivePrimaryDC : pointer .String ("" ),
501
+ DatabaseLockState : FoundationDBStatusLockState {
502
+ Locked : pointer .Bool (false ),
503
+ },
445
504
}
446
505
447
506
It ("should parse all values correctly" , func () {
@@ -452,7 +511,28 @@ var _ = Describe("FoundationDBStatus", func() {
452
511
statusParsed := FoundationDBStatus {}
453
512
err = statusDecoder .Decode (& statusParsed )
454
513
Expect (err ).NotTo (HaveOccurred ())
455
- Expect (statusParsed .Cluster ).To (Equal (status ))
514
+
515
+ // Gomega needs some prodding to effectively format diffs between these status objects, so we compare
516
+ // the fields one by one.
517
+ clusterInfoParsed := statusParsed .Cluster
518
+ Expect (clusterInfoParsed .DatabaseConfiguration ).To (Equal (clusterInfo .DatabaseConfiguration ))
519
+ Expect (clusterInfoParsed .Processes ).To (ConsistOf (slices .Collect (maps .Values (clusterInfo .Processes ))))
520
+ Expect (clusterInfoParsed .Data ).To (Equal (clusterInfo .Data ))
521
+ Expect (clusterInfoParsed .FullReplication ).To (Equal (clusterInfo .FullReplication ))
522
+ Expect (clusterInfoParsed .Generation ).To (Equal (clusterInfo .Generation ))
523
+ Expect (clusterInfoParsed .MaintenanceZone ).To (Equal (clusterInfo .MaintenanceZone ))
524
+ Expect (clusterInfoParsed .Clients .Count ).To (Equal (clusterInfo .Clients .Count ))
525
+ Expect (clusterInfoParsed .Clients .SupportedVersions ).To (HaveExactElements (clusterInfoParsed .Clients .SupportedVersions ))
526
+ Expect (clusterInfoParsed .Layers ).To (Equal (clusterInfo .Layers ))
527
+ Expect (clusterInfoParsed .Logs ).To (HaveExactElements (clusterInfo .Logs ))
528
+ Expect (clusterInfoParsed .Qos ).To (Equal (clusterInfo .Qos ))
529
+ Expect (clusterInfoParsed .FaultTolerance ).To (Equal (clusterInfo .FaultTolerance ))
530
+ Expect (clusterInfoParsed .MaintenanceZone ).To (Equal (clusterInfo .MaintenanceZone ))
531
+ Expect (clusterInfoParsed .IncompatibleConnections ).To (HaveExactElements (clusterInfo .IncompatibleConnections ))
532
+ Expect (clusterInfoParsed .BounceImpact ).To (Equal (clusterInfo .BounceImpact ))
533
+ Expect (clusterInfoParsed .DatabaseAvailable ).To (Equal (clusterInfo .DatabaseAvailable ))
534
+ Expect (clusterInfoParsed .ActivePrimaryDC ).To (Equal (clusterInfo .ActivePrimaryDC ))
535
+ Expect (clusterInfoParsed .DatabaseLockState ).To (Equal (clusterInfo .DatabaseLockState ))
456
536
})
457
537
})
458
538
0 commit comments