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
3 changes: 2 additions & 1 deletion pulsar/client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ func TestTokenAuthWithClientVersion(t *testing.T) {
topicState, err := admin.Topics().GetStats(*topicName)
assert.Nil(t, err)
publisher := topicState.Publishers[0]
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar Go version"))
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar-Go-version"))
assert.True(t, strings.HasSuffix(publisher.ClientVersion, "-test-client"))
assert.NotContains(t, publisher.ClientVersion, " ")
}

func TestTokenAuthWithSupplier(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions pulsar/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5027,7 +5027,8 @@ func TestClientVersion(t *testing.T) {
topicState, err := admin.Topics().GetStats(*topicName)
assert.Nil(t, err)
publisher := topicState.Publishers[0]
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar Go version"))
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar-Go-version"))
assert.NotContains(t, publisher.ClientVersion, " ")

topic = newTopicName()
client, err = NewClient(ClientOptions{
Expand All @@ -5045,9 +5046,9 @@ func TestClientVersion(t *testing.T) {
topicState, err = admin.Topics().GetStats(*topicName)
assert.Nil(t, err)
publisher = topicState.Publishers[0]
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar Go version"))
assert.True(t, strings.HasPrefix(publisher.ClientVersion, "Pulsar-Go-version"))
assert.True(t, strings.HasSuffix(publisher.ClientVersion, "-test-client"))

assert.NotContains(t, publisher.ClientVersion, " ")
}

func TestSelectConnectionForSameConsumer(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pulsar/internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func init() {
for _, dep := range buildInfo.Deps {
if dep.Path == pulsarClientGoModulePath {
Version = semver.Canonical(dep.Version)
ClientVersionString = "Pulsar Go " + Version
ClientVersionString = "Pulsar-Go-" + Version
return
}
}
}
Version = "unknown"
ClientVersionString = "Pulsar Go version unknown"
ClientVersionString = "Pulsar-Go-version-unknown"
}
4 changes: 4 additions & 0 deletions pulsar/internal/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ import (
func TestInitVersion(t *testing.T) {
assert.NotEmpty(t, Version, "version string should not be empty")
}

func TestVersionHasNoSpaces(t *testing.T) {
assert.NotContains(t, Version, " ", "version string should not contain any white space")
}
6 changes: 4 additions & 2 deletions pulsaradmin/pkg/admin/topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ func TestPartitionState(t *testing.T) {
assert.Equal(t, publisher.IsSupportsPartialProducer, false)
assert.Equal(t, publisher.ProducerName, producerName)
assert.Contains(t, publisher.Address, "127.0.0.1")
assert.Contains(t, publisher.ClientVersion, "Pulsar Go version")
assert.Contains(t, publisher.ClientVersion, "Pulsar-Go-version")
assert.NotContains(t, publisher.ClientVersion, " ")

sub := topicState.Subscriptions[subName]
assert.Equal(t, sub.BytesOutCounter, int64(0))
Expand Down Expand Up @@ -244,7 +245,8 @@ func TestPartitionState(t *testing.T) {
assert.Equal(t, consumerState.ChunkedMessageRate, float64(0))
assert.Equal(t, consumerState.AvgMessagesPerEntry, int(0))
assert.Contains(t, consumerState.Address, "127.0.0.1")
assert.Contains(t, consumerState.ClientVersion, "Pulsar Go version")
assert.Contains(t, consumerState.ClientVersion, "Pulsar-Go-version")
assert.NotContains(t, consumerState.ClientVersion, " ")
assert.Equal(t, consumerState.LastAckedTimestamp, int64(0))
assert.Equal(t, consumerState.LastConsumedTimestamp, int64(0))
assert.True(t, consumerState.LastConsumedFlowTimestamp > 0)
Expand Down
Loading