File tree Expand file tree Collapse file tree 5 files changed +28
-3
lines changed Expand file tree Collapse file tree 5 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 1+ * Fixed DescribeConsumer ignoring PartitionConsumerStats
12* Added virtualtimestamps field to cdc description
23
34## v3.99.10
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ func (v *Duration) MustFromProto(proto *durationpb.Duration) {
4848}
4949
5050func (v * Duration ) ToDuration () * time.Duration {
51- if v .HasValue {
51+ if ! v .HasValue {
5252 return nil
5353 }
5454
@@ -96,7 +96,7 @@ func (v *Time) MustFromProto(proto *timestamppb.Timestamp) {
9696}
9797
9898func (v * Time ) ToTime () * time.Time {
99- if v .HasValue {
99+ if ! v .HasValue {
100100 return nil
101101 }
102102
Original file line number Diff line number Diff line change @@ -147,5 +147,9 @@ func (pi *DescribeConsumerResultPartitionInfo) FromProto(proto *Ydb_Topic.Descri
147147 pi .ChildPartitionIDs = clone .Int64Slice (proto .GetChildPartitionIds ())
148148 pi .ParentPartitionIDs = clone .Int64Slice (proto .GetParentPartitionIds ())
149149
150+ if err := pi .PartitionConsumerStats .FromProto (proto .GetPartitionConsumerStats ()); err != nil {
151+ return err
152+ }
153+
150154 return pi .PartitionStats .FromProto (proto .GetPartitionStats ())
151155}
Original file line number Diff line number Diff line change @@ -247,6 +247,26 @@ func TestDescribeTopicConsumer(t *testing.T) {
247247
248248 requireAndCleanSubset (& consumer .Consumer .Attributes , & expectedConsumerDesc .Consumer .Attributes )
249249
250+ for i := range consumer .Partitions {
251+ // Fields that are checked here are dynamic and they change with time, so we need to set them to expected values
252+ // to make the comparison possible.
253+ p := & consumer .Partitions [i ]
254+
255+ require .NotNil (t , p .PartitionStats .LastWriteTime )
256+
257+ p .PartitionStats .LastWriteTime = expectedConsumerDesc .Partitions [i ].PartitionStats .LastWriteTime
258+ p .PartitionStats .MaxWriteTimeLag = expectedConsumerDesc .Partitions [i ].PartitionStats .MaxWriteTimeLag
259+
260+ require .NotNil (t , p .PartitionConsumerStats .LastReadTime )
261+ require .NotNil (t , p .PartitionConsumerStats .MaxReadTimeLag )
262+ require .NotNil (t , p .PartitionConsumerStats .MaxWriteTimeLag )
263+
264+ p .PartitionConsumerStats .PartitionReadSessionCreateTime = expectedConsumerDesc .Partitions [i ].PartitionConsumerStats .PartitionReadSessionCreateTime
265+ p .PartitionConsumerStats .LastReadTime = expectedConsumerDesc .Partitions [i ].PartitionConsumerStats .LastReadTime
266+ p .PartitionConsumerStats .MaxReadTimeLag = expectedConsumerDesc .Partitions [i ].PartitionConsumerStats .MaxReadTimeLag
267+ p .PartitionConsumerStats .MaxWriteTimeLag = expectedConsumerDesc .Partitions [i ].PartitionConsumerStats .MaxWriteTimeLag
268+ }
269+
250270 require .Equal (t , expectedConsumerDesc , consumer )
251271}
252272
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ func TestTopicConsumerDescriptionFromRaw(t *testing.T) {
325325 v .testName , func (t * testing.T ) {
326326 d := TopicConsumerDescription {}
327327 d .FromRaw (v .rawConsumerDescription )
328- if ! reflect .DeepEqual (d . Consumer , v .expectedDescription . Consumer ) {
328+ if ! reflect .DeepEqual (d , v .expectedDescription ) {
329329 t .Errorf ("got\n %+v\n expected\n %+v" , d , v .expectedDescription )
330330 }
331331 },
You can’t perform that action at this time.
0 commit comments