@@ -52,6 +52,8 @@ func TestGetStatsCmd(t *testing.T) {
5252 if err != nil {
5353 t .Fatal (err )
5454 }
55+ assert .Greaterf (t , stats .TopicCreationTimeStamp , int64 (0 ), "TopicCreationTimeStamp should be greater than 0" )
56+ stats .TopicCreationTimeStamp = 0 // reset to zero for comparison
5557
5658 assert .Equal (t , defaultStats , stats )
5759}
@@ -108,6 +110,7 @@ func TestGetPartitionedStatsCmd(t *testing.T) {
108110 assert .Equal (t , "" , stats .DeDuplicationStatus )
109111 assert .Equal (t , 2 , stats .Metadata .Partitions )
110112 assert .Equal (t , 0 , len (stats .Partitions ))
113+ assert .Greater (t , stats .TopicCreationTimeStamp , int64 (0 ))
111114}
112115
113116func TestGetPerPartitionedStatsCmd (t * testing.T ) {
@@ -125,6 +128,15 @@ func TestGetPerPartitionedStatsCmd(t *testing.T) {
125128 t .Fatal (err )
126129 }
127130
131+ assert .Greater (t , stats .TopicCreationTimeStamp , int64 (0 ))
132+ stats .TopicCreationTimeStamp = 0
133+ partitionKey := "persistent://public/default/test-topic-per-partitioned-stats-partition-0"
134+ assert .Contains (t , stats .Partitions , partitionKey )
135+ assert .Greaterf (t , stats .Partitions [partitionKey ].TopicCreationTimeStamp , int64 (0 ), "TopicCreationTimeStamp should be greater than 0" )
136+ v := stats .Partitions [partitionKey ]
137+ v .TopicCreationTimeStamp = 0
138+ stats .Partitions [partitionKey ] = v
139+
128140 defaultStats := utils.PartitionedTopicStats {
129141 MsgRateIn : 0 ,
130142 MsgRateOut : 0 ,
@@ -138,7 +150,7 @@ func TestGetPerPartitionedStatsCmd(t *testing.T) {
138150 DeDuplicationStatus : "" ,
139151 Metadata : utils.PartitionedTopicMetadata {Partitions : 1 },
140152 Partitions : map [string ]utils.TopicStats {
141- "persistent://public/default/test-topic-per-partitioned-stats-partition-0" : {
153+ partitionKey : {
142154 MsgRateIn : 0 ,
143155 MsgRateOut : 0 ,
144156 MsgThroughputIn : 0 ,
0 commit comments