@@ -27,7 +27,6 @@ func TestPubSubMessage_Commit(t *testing.T) {
2727 ctx := context .Background ()
2828 topic := "pubsub-commit-topic"
2929
30- // Start subscription first to ensure it's ready
3130 msgChan := make (chan * pubsub.Message )
3231 errChan := make (chan error )
3332
@@ -41,22 +40,18 @@ func TestPubSubMessage_Commit(t *testing.T) {
4140 msgChan <- msg
4241 }()
4342
44- // Wait a bit for subscription to be ready
4543 time .Sleep (100 * time .Millisecond )
4644
47- // Then publish the message
4845 err := client .PubSub .Publish (ctx , topic , []byte ("test" ))
4946 require .NoError (t , err )
5047
51- // Wait for message with timeout
5248 select {
5349 case err := <- errChan :
5450 require .NoError (t , err )
5551 case msg := <- msgChan :
5652 require .NotNil (t , msg )
5753 require .NotNil (t , msg .Committer )
5854
59- // Commit should not panic
6055 assert .NotPanics (t , func () {
6156 msg .Committer .Commit ()
6257 })
@@ -163,7 +158,6 @@ func TestStreamMessage_Commit_Success(t *testing.T) {
163158
164159 mock .ExpectXAck (stream , group , id ).SetVal (1 )
165160
166- // Test stream message commit through actual stream subscription
167161 client , s := setupTest (t , map [string ]string {
168162 "REDIS_PUBSUB_MODE" : "streams" ,
169163 "REDIS_STREAMS_CONSUMER_GROUP" : group ,
@@ -173,21 +167,18 @@ func TestStreamMessage_Commit_Success(t *testing.T) {
173167
174168 ctx := context .Background ()
175169
176- // Create topic and publish
177170 err := client .PubSub .CreateTopic (ctx , stream )
178171 require .NoError (t , err )
179172
180173 go func () {
181174 _ = client .PubSub .Publish (ctx , stream , []byte ("test" ))
182175 }()
183176
184- // Subscribe to get message with committer
185177 msg , err := client .PubSub .Subscribe (ctx , stream )
186178 require .NoError (t , err )
187179 require .NotNil (t , msg )
188180 require .NotNil (t , msg .Committer )
189181
190- // Commit should not panic
191182 assert .NotPanics (t , func () {
192183 msg .Committer .Commit ()
193184 })
@@ -196,7 +187,6 @@ func TestStreamMessage_Commit_Success(t *testing.T) {
196187func TestStreamMessage_Commit_Error (t * testing.T ) {
197188 t .Parallel ()
198189
199- // Test stream message commit error handling
200190 client , s := setupTest (t , map [string ]string {
201191 "REDIS_PUBSUB_MODE" : "streams" ,
202192 "REDIS_STREAMS_CONSUMER_GROUP" : "test-group" ,
@@ -207,24 +197,20 @@ func TestStreamMessage_Commit_Error(t *testing.T) {
207197 ctx := context .Background ()
208198 stream := "test-stream-error"
209199
210- // Create topic and publish
211200 err := client .PubSub .CreateTopic (ctx , stream )
212201 require .NoError (t , err )
213202
214203 go func () {
215204 _ = client .PubSub .Publish (ctx , stream , []byte ("test" ))
216205 }()
217206
218- // Subscribe to get message
219207 msg , err := client .PubSub .Subscribe (ctx , stream )
220208 require .NoError (t , err )
221209 require .NotNil (t , msg )
222210 require .NotNil (t , msg .Committer )
223211
224- // Close Redis to simulate error
225212 s .Close ()
226213
227- // Commit should handle error gracefully
228214 assert .NotPanics (t , func () {
229215 msg .Committer .Commit ()
230216 })
@@ -233,7 +219,6 @@ func TestStreamMessage_Commit_Error(t *testing.T) {
233219func TestStreamMessage_Commit_Timeout (t * testing.T ) {
234220 t .Parallel ()
235221
236- // Test stream message commit with timeout
237222 client , s := setupTest (t , map [string ]string {
238223 "REDIS_PUBSUB_MODE" : "streams" ,
239224 "REDIS_STREAMS_CONSUMER_GROUP" : "test-group" ,
@@ -244,21 +229,18 @@ func TestStreamMessage_Commit_Timeout(t *testing.T) {
244229 ctx := context .Background ()
245230 stream := "test-stream-timeout"
246231
247- // Create topic and publish
248232 err := client .PubSub .CreateTopic (ctx , stream )
249233 require .NoError (t , err )
250234
251235 go func () {
252236 _ = client .PubSub .Publish (ctx , stream , []byte ("test" ))
253237 }()
254238
255- // Subscribe to get message
256239 msg , err := client .PubSub .Subscribe (ctx , stream )
257240 require .NoError (t , err )
258241 require .NotNil (t , msg )
259242 require .NotNil (t , msg .Committer )
260243
261- // Commit should handle timeout gracefully (uses defaultRetryTimeout internally)
262244 assert .NotPanics (t , func () {
263245 msg .Committer .Commit ()
264246 })
0 commit comments