Skip to content

Commit a7f02ba

Browse files
authored
add logs to the failing test (#340)
Signed-off-by: Gabriele Santomaggio <g.santomaggio@gmail.com>
1 parent 558be3b commit a7f02ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/stream/super_stream_producer_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
. "github.com/onsi/ginkgo/v2"
66
. "github.com/onsi/gomega"
77
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/amqp"
8+
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/logs"
89
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/message"
910
"github.com/rabbitmq/rabbitmq-stream-go-client/pkg/test-helper"
1011
"math/rand"
@@ -158,6 +159,8 @@ var _ = Describe("Super Stream Producer", Label("super-stream"), func() {
158159
}
159160
mutex.Lock()
160161
msgReceived[superStreamPublishConfirm.Partition] = len(superStreamPublishConfirm.ConfirmationStatus)
162+
logs.LogInfo("Partition %s confirmed %d messages, total %d",
163+
superStreamPublishConfirm.Partition, len(superStreamPublishConfirm.ConfirmationStatus), msgReceived[superStreamPublishConfirm.Partition])
161164
mutex.Unlock()
162165
}
163166

@@ -168,23 +171,26 @@ var _ = Describe("Super Stream Producer", Label("super-stream"), func() {
168171
msg.ApplicationProperties = map[string]interface{}{"routingKey": fmt.Sprintf("hello%d", i)}
169172
Expect(superProducer.Send(msg)).NotTo(HaveOccurred())
170173
}
171-
174+
time.Sleep(1 * time.Second)
172175
// these values are the same for .NET,Python,Java stream clients
173176
// The aim for this test is to validate the correct routing with the
174177
// MurmurStrategy.
175178
Eventually(func() int {
176179
mutex.Lock()
177180
defer mutex.Unlock()
181+
logs.LogInfo("Partition 0 confirmed %d messages", msgReceived[fmt.Sprintf("%s-%s", superStream, "0")])
178182
return msgReceived[fmt.Sprintf("%s-%s", superStream, "0")]
179183
}).WithPolling(300 * time.Millisecond).WithTimeout(2 * time.Second).Should(Equal(9))
180184
Eventually(func() int {
181185
mutex.Lock()
182186
defer mutex.Unlock()
187+
logs.LogInfo("Partition 1 confirmed %d messages", msgReceived[fmt.Sprintf("%s-%s", superStream, "1")])
183188
return msgReceived[fmt.Sprintf("%s-%s", superStream, "1")]
184189
}).WithPolling(300 * time.Millisecond).WithTimeout(2 * time.Second).Should(Equal(7))
185190
Eventually(func() int {
186191
mutex.Lock()
187192
defer mutex.Unlock()
193+
logs.LogInfo("Partition 2 confirmed %d messages", msgReceived[fmt.Sprintf("%s-%s", superStream, "2")])
188194
return msgReceived[fmt.Sprintf("%s-%s", superStream, "2")]
189195
}).WithPolling(300 * time.Millisecond).WithTimeout(2 * time.Second).Should(Equal(4))
190196

0 commit comments

Comments
 (0)