You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2019/05/07 04:46:53 UTC
[pulsar] branch branch-2.3 updated: fix cannot use size (type
_Ctype_int) as type _Ctype_ulong (#4212)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.3 by this push:
new 1f4a836 fix cannot use size (type _Ctype_int) as type _Ctype_ulong (#4212)
1f4a836 is described below
commit 1f4a836a46483db408e0bf39903215974262d946
Author: 冉小龙 <ra...@gmail.com>
AuthorDate: Tue May 7 12:46:47 2019 +0800
fix cannot use size (type _Ctype_int) as type _Ctype_ulong (#4212)
* Fixed conversion of unix timestamp to golang time (#3659)
* fix cannot use size (type _Ctype_int) as type _Ctype_ulong
Signed-off-by: xiaolong.ran <ra...@gmail.com>
---
pulsar-client-go/pulsar/c_message.go | 3 +--
pulsar-client-go/pulsar/client_test.go | 2 +-
pulsar-client-go/pulsar/consumer_test.go | 18 ++++++++++++------
pulsar-client-go/pulsar/producer_test.go | 1 -
pulsar-client-go/pulsar/reader_test.go | 8 +++++---
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/pulsar-client-go/pulsar/c_message.go b/pulsar-client-go/pulsar/c_message.go
index c882039..36cbd5c 100644
--- a/pulsar-client-go/pulsar/c_message.go
+++ b/pulsar-client-go/pulsar/c_message.go
@@ -87,8 +87,7 @@ func buildMessage(message ProducerMessage) *C.pulsar_message_t {
for i, s := range message.ReplicationClusters {
C.setString(array, C.CString(s), C.int(i))
}
-
- C.pulsar_message_set_replication_clusters(cMsg, array, size)
+ C.pulsar_message_set_replication_clusters(cMsg, array, C.size_t(size))
}
}
diff --git a/pulsar-client-go/pulsar/client_test.go b/pulsar-client-go/pulsar/client_test.go
index 57b3185..34d9247 100644
--- a/pulsar-client-go/pulsar/client_test.go
+++ b/pulsar-client-go/pulsar/client_test.go
@@ -58,7 +58,7 @@ func TestGetTopicPartitions(t *testing.T) {
assert.Equal(t, partitions[0], topic)
}
-const TestTokenFilePath = "/tmp/pulsar-test-data/certs/token.txt"
+const TestTokenFilePath = "/tmp/pulsar-test-data/tokens/token.txt"
func readToken(t *testing.T) string {
data, err := ioutil.ReadFile(TestTokenFilePath)
diff --git a/pulsar-client-go/pulsar/consumer_test.go b/pulsar-client-go/pulsar/consumer_test.go
index 858f4cf..f8863cf 100644
--- a/pulsar-client-go/pulsar/consumer_test.go
+++ b/pulsar-client-go/pulsar/consumer_test.go
@@ -61,15 +61,17 @@ func TestConsumer(t *testing.T) {
assert.Nil(t, err)
defer client.Close()
+ topic := fmt.Sprintf("my-topic-%d", time.Now().Unix())
+
producer, err := client.CreateProducer(ProducerOptions{
- Topic: "my-topic",
+ Topic: topic,
})
assert.Nil(t, err)
defer producer.Close()
consumer, err := client.Subscribe(ConsumerOptions{
- Topic: "my-topic",
+ Topic: topic,
SubscriptionName: "my-sub",
AckTimeout: 1 * time.Minute,
Name: "my-consumer-name",
@@ -81,7 +83,7 @@ func TestConsumer(t *testing.T) {
assert.Nil(t, err)
defer consumer.Close()
- assert.Equal(t, consumer.Topic(), "persistent://public/default/my-topic")
+ assert.Equal(t, consumer.Topic(), "persistent://public/default/" + topic)
assert.Equal(t, consumer.Subscription(), "my-sub")
ctx := context.Background()
@@ -100,7 +102,10 @@ func TestConsumer(t *testing.T) {
assert.NotNil(t, msg)
assert.Equal(t, string(msg.Payload()), fmt.Sprintf("hello-%d", i))
- assert.Equal(t, string(msg.Topic()), "persistent://public/default/my-topic")
+ assert.Equal(t, msg.Topic(), "persistent://public/default/" + topic)
+ fmt.Println("Send time: ", sendTime)
+ fmt.Println("Publish time: ", msg.PublishTime())
+ fmt.Println("Receive time: ", recvTime)
assert.True(t, sendTime.Unix() <= msg.PublishTime().Unix())
assert.True(t, recvTime.Unix() >= msg.PublishTime().Unix())
@@ -374,7 +379,7 @@ func TestConsumerRegex(t *testing.T) {
defer producer2.Close()
consumer, err := client.Subscribe(ConsumerOptions{
- TopicsPattern: "topic-\\d+",
+ TopicsPattern: "persistent://public/default/topic-.*",
SubscriptionName: "my-sub",
})
@@ -400,6 +405,7 @@ func TestConsumerRegex(t *testing.T) {
}
for i := 0; i < 20; i++ {
+ ctx, _ = context.WithTimeout(context.Background(), 1 * time.Second)
msg, err := consumer.Receive(ctx)
assert.Nil(t, err)
assert.NotNil(t, msg)
@@ -478,7 +484,7 @@ func TestConsumer_SubscriptionInitPos(t *testing.T) {
assert.Nil(t, err)
defer client.Close()
- topicName := "persistent://public/default/testSeek"
+ topicName := fmt.Sprintf("testSeek-%d", time.Now().Unix())
subName := "test-subscription-initial-earliest-position"
// create producer
diff --git a/pulsar-client-go/pulsar/producer_test.go b/pulsar-client-go/pulsar/producer_test.go
index 0a13024..633714b 100644
--- a/pulsar-client-go/pulsar/producer_test.go
+++ b/pulsar-client-go/pulsar/producer_test.go
@@ -195,7 +195,6 @@ func TestProducerZstd(t *testing.T) {
defer producer.Close()
assert.Equal(t, producer.Topic(), "persistent://public/default/my-topic")
- assert.Equal(t, producer.Name(), "my-producer-name")
ctx := context.Background()
diff --git a/pulsar-client-go/pulsar/reader_test.go b/pulsar-client-go/pulsar/reader_test.go
index 90821a8..e6cb9f2 100644
--- a/pulsar-client-go/pulsar/reader_test.go
+++ b/pulsar-client-go/pulsar/reader_test.go
@@ -58,22 +58,24 @@ func TestReader(t *testing.T) {
assert.Nil(t, err)
defer client.Close()
+ topic := fmt.Sprintf("my-reader-topic-%d", time.Now().Unix())
+
producer, err := client.CreateProducer(ProducerOptions{
- Topic: "my-reader-topic",
+ Topic: topic,
})
assert.Nil(t, err)
defer producer.Close()
reader, err := client.CreateReader(ReaderOptions{
- Topic: "my-reader-topic",
+ Topic: topic,
StartMessageID: LatestMessage,
})
assert.Nil(t, err)
defer reader.Close()
- assert.Equal(t, reader.Topic(), "persistent://public/default/my-reader-topic")
+ assert.Equal(t, reader.Topic(), "persistent://public/default/" + topic )
ctx := context.Background()