Skip to content

Commit 6757b6d

Browse files
committed
handle tests in suite specially for queues with no adv window support
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
1 parent 65798d3 commit 6757b6d

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

common_test.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ type QueueSuite struct {
5959
suite.Suite
6060
r rand.Rand
6161

62-
TxNotSupported bool
63-
BrokerURI string
62+
TxNotSupported bool
63+
AdvWindowNotSupported bool
64+
BrokerURI string
6465

6566
Broker Broker
6667
}
@@ -136,10 +137,17 @@ func (s *QueueSuite) TestJob_Reject_no_requeue() {
136137
err = j.Reject(false)
137138
assert.NoError(err)
138139

139-
done := s.checkNextClosed(iter)
140-
<-time.After(50 * time.Millisecond)
141-
assert.NoError(iter.Close())
142-
<-done
140+
if s.AdvWindowNotSupported {
141+
j, err := iter.Next()
142+
assert.Nil(j)
143+
assert.NoError(err)
144+
assert.NoError(iter.Close())
145+
} else {
146+
done := s.checkNextClosed(iter)
147+
<-time.After(50 * time.Millisecond)
148+
assert.NoError(iter.Close())
149+
<-done
150+
}
143151
}
144152

145153
func (s *QueueSuite) TestJob_Reject_requeue() {
@@ -395,10 +403,17 @@ func (s *QueueSuite) TestTransaction_Error() {
395403
advertisedWindow := 1
396404
i, err := q.Consume(advertisedWindow)
397405
assert.NoError(err)
398-
done := s.checkNextClosed(i)
399-
<-time.After(50 * time.Millisecond)
400-
assert.NoError(i.Close())
401-
<-done
406+
if s.AdvWindowNotSupported {
407+
j, err := i.Next()
408+
assert.Nil(j)
409+
assert.NoError(err)
410+
assert.NoError(i.Close())
411+
} else {
412+
done := s.checkNextClosed(i)
413+
<-time.After(50 * time.Millisecond)
414+
assert.NoError(i.Close())
415+
<-done
416+
}
402417
}
403418

404419
func (s *QueueSuite) TestTransaction() {

memory_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type MemorySuite struct {
1717

1818
func (s *MemorySuite) SetupSuite() {
1919
s.BrokerURI = testMemoryURI
20+
s.AdvWindowNotSupported = true
2021
}
2122

2223
func (s *MemorySuite) TestIntegration() {

0 commit comments

Comments
 (0)