Skip to content

EBP-649: Go API partitioned queue test prints to console #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2025
Merged
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
11 changes: 8 additions & 3 deletions test/partitioned_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package test

import (
"fmt"
"strconv"
"sync/atomic"
"time"

"solace.dev/go/messaging"
Expand Down Expand Up @@ -58,6 +58,7 @@ var _ = Describe("Partitioned Queue Tests", func() {
var messagingServices [4]solace.MessagingService
var partitionKeys [9]string
var rebalanceDelayDuration = time.Duration(rebalanceDelay) * 2
var receivedMessageCount uint64 = 0

//generate partition keys
for i := 0; i < 9; i++ {
Expand Down Expand Up @@ -101,7 +102,8 @@ var _ = Describe("Partitioned Queue Tests", func() {
publisher.Terminate(rebalanceDelayDuration * time.Second)

messageHandler := func(message message.InboundMessage) {
fmt.Println("message received")
// count the received messages dispatched for the receiver
atomic.AddUint64(&receivedMessageCount, 1)
}

receiverOne.ReceiveAsync(messageHandler)
Expand Down Expand Up @@ -131,6 +133,10 @@ var _ = Describe("Partitioned Queue Tests", func() {
return totalMessagesReceived
}).WithTimeout(rebalanceDelayDuration * time.Second).Should(Equal(publisherMetrics.GetValue(metrics.TotalMessagesSent)))

Eventually(func() uint64 {
return receivedMessageCount // what was actually received in the API callback
}).WithTimeout(rebalanceDelayDuration * time.Second).Should(Equal(publisherMetrics.GetValue(metrics.TotalMessagesSent)))

Expect(receiverOne.Terminate(10 * time.Second)).ToNot(HaveOccurred())
Expect(receiverTwo.Terminate(10 * time.Second)).ToNot(HaveOccurred())
Expect(receiverThree.Terminate(10 * time.Second)).ToNot(HaveOccurred())
Expand Down Expand Up @@ -279,7 +285,6 @@ var _ = Describe("Partitioned Queue Tests", func() {
receiverTwo, _ := messagingServices[2].CreatePersistentMessageReceiverBuilder().
WithSubscriptions(resource.TopicSubscriptionOf(topicName)).Build(partitionedQueue)
receiverTwoMessageHandler := func(message message.InboundMessage) {
//fmt.Println("Received message in receiverTwo")
// count the received messages dispatched for the receiver
receiverTwoMessageCount += 1
}
Expand Down
Loading