Skip to content

Commit cdfc274

Browse files
committed
Fix assertion on TopiCreateTimeStamp (#1952)
(cherry picked from commit 7e9cbef)
1 parent 8511bd1 commit cdfc274

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pkg/ctl/topic/stats_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

113116
func 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,

scripts/run-integration-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
readonly PROJECT_ROOT=`cd $(dirname $0)/..; pwd`
55
readonly IMAGE_NAME=pulsarctl-test
6-
readonly PULSAR_DEFAULT_VERSION="4.0.4.3"
6+
readonly PULSAR_DEFAULT_VERSION="4.1.0.10"
77
readonly PULSAR_VERSION=${PULSAR_VERSION:-${PULSAR_DEFAULT_VERSION}}
88

99
docker build --build-arg PULSAR_VERSION=${PULSAR_VERSION} \

0 commit comments

Comments
 (0)