Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions pkg/ctl/topic/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func TestGetStatsCmd(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Greaterf(t, stats.TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
stats.TopicCreationTimeStamp = 0 // reset to zero for comparison

assert.Equal(t, defaultStats, stats)
}
Expand Down Expand Up @@ -108,6 +110,7 @@ func TestGetPartitionedStatsCmd(t *testing.T) {
assert.Equal(t, "", stats.DeDuplicationStatus)
assert.Equal(t, 2, stats.Metadata.Partitions)
assert.Equal(t, 0, len(stats.Partitions))
assert.Greater(t, stats.TopicCreationTimeStamp, int64(0))
}

func TestGetPerPartitionedStatsCmd(t *testing.T) {
Expand All @@ -125,6 +128,15 @@ func TestGetPerPartitionedStatsCmd(t *testing.T) {
t.Fatal(err)
}

assert.Greater(t, stats.TopicCreationTimeStamp, int64(0))
stats.TopicCreationTimeStamp = 0
partitionKey := "persistent://public/default/test-topic-per-partitioned-stats-partition-0"
assert.Contains(t, stats.Partitions, partitionKey)
assert.Greaterf(t, stats.Partitions[partitionKey].TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
v := stats.Partitions[partitionKey]
v.TopicCreationTimeStamp = 0
stats.Partitions[partitionKey] = v

defaultStats := utils.PartitionedTopicStats{
MsgRateIn: 0,
MsgRateOut: 0,
Expand All @@ -138,7 +150,7 @@ func TestGetPerPartitionedStatsCmd(t *testing.T) {
DeDuplicationStatus: "",
Metadata: utils.PartitionedTopicMetadata{Partitions: 1},
Partitions: map[string]utils.TopicStats{
"persistent://public/default/test-topic-per-partitioned-stats-partition-0": {
partitionKey: {
MsgRateIn: 0,
MsgRateOut: 0,
MsgThroughputIn: 0,
Expand Down Expand Up @@ -195,6 +207,8 @@ func TestGetStatsWithPreciseBacklog(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Greaterf(t, stats.TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
stats.TopicCreationTimeStamp = 0

assert.Equal(t, defaultStats, stats)
}
Expand All @@ -213,6 +227,8 @@ func TestGetStatsWithoutSubscriptionBacklogSize(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Greaterf(t, stats.TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
stats.TopicCreationTimeStamp = 0

assert.Equal(t, defaultStats, stats)
}
Expand All @@ -231,6 +247,8 @@ func TestGetStatsWithEarliestTimeInBacklog(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Greaterf(t, stats.TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
stats.TopicCreationTimeStamp = 0

assert.Equal(t, defaultStats, stats)
}
Expand All @@ -249,6 +267,8 @@ func TestGetStatsWithMultipleNewFlags(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Greaterf(t, stats.TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
stats.TopicCreationTimeStamp = 0

assert.Equal(t, defaultStats, stats)
}
Expand Down Expand Up @@ -297,6 +317,15 @@ func TestGetPerPartitionStatsWithNewFlags(t *testing.T) {
t.Fatal(err)
}

assert.Greater(t, stats.TopicCreationTimeStamp, int64(0))
stats.TopicCreationTimeStamp = 0
partitionKey := "persistent://public/default/test-per-part-stats-new-flags-partition-0"
assert.Contains(t, stats.Partitions, partitionKey)
assert.Greaterf(t, stats.Partitions[partitionKey].TopicCreationTimeStamp, int64(0), "TopicCreationTimeStamp should be greater than 0")
v := stats.Partitions[partitionKey]
v.TopicCreationTimeStamp = 0
stats.Partitions[partitionKey] = v

defaultStats := utils.PartitionedTopicStats{
MsgRateIn: 0,
MsgRateOut: 0,
Expand All @@ -310,7 +339,7 @@ func TestGetPerPartitionStatsWithNewFlags(t *testing.T) {
DeDuplicationStatus: "",
Metadata: utils.PartitionedTopicMetadata{Partitions: 1},
Partitions: map[string]utils.TopicStats{
"persistent://public/default/test-per-part-stats-new-flags-partition-0": {
partitionKey: {
MsgRateIn: 0,
MsgRateOut: 0,
MsgThroughputIn: 0,
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

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

docker build --build-arg PULSAR_VERSION=${PULSAR_VERSION} \
Expand Down
Loading