Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
worg committed Mar 23, 2022
1 parent 0c2d0d8 commit d0bea46
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func subscribeHelper(c *C, ackMode AckMode, version Version, opts ...func(*frame
frame.MessageId, messageId,
frame.Destination, destination)
if version == V12 {
f4.Header.Add(frame.Id, messageId)
f4.Header.Add(frame.Ack, messageId)
}
f4.Body = []byte(bodyText)
err = rw.Write(f4)
Expand All @@ -395,7 +395,7 @@ func subscribeHelper(c *C, ackMode AckMode, version Version, opts ...func(*frame
f5, _ := rw.Read()
c.Assert(f5.Command, Equals, "ACK")
if version == V12 {
c.Assert(f5.Header.Get("id"), Equals, messageId)
c.Assert(f5.Header.Get(frame.Id), Equals, messageId)
} else {
c.Assert(f5.Header.Get("subscription"), Equals, id)
c.Assert(f5.Header.Get("message-id"), Equals, messageId)
Expand Down Expand Up @@ -431,6 +431,9 @@ func subscribeHelper(c *C, ackMode AckMode, version Version, opts ...func(*frame
c.Assert(msg.Body, DeepEquals, []byte(bodyText))
c.Assert(msg.Destination, Equals, "/queue/test-1")
c.Assert(msg.Header.Get(frame.MessageId), Equals, messageId)
if version == V12 && ackMode.ShouldAck() {
c.Assert(msg.Header.Get(frame.Ack), Equals, messageId)
}

c.Assert(msg.ShouldAck(), Equals, ackMode.ShouldAck())
if msg.ShouldAck() {
Expand Down Expand Up @@ -491,8 +494,8 @@ func subscribeTransactionHelper(c *C, ackMode AckMode, version Version, abort bo
frame.Subscription, id,
frame.MessageId, messageId,
frame.Destination, destination)
if version == V12 {
f4.Header.Add(frame.Id, messageId)
if version == V12 && ackMode.ShouldAck() {
f4.Header.Add(frame.Ack, messageId)
}
f4.Body = []byte(bodyText)
err = rw.Write(f4)
Expand All @@ -514,7 +517,7 @@ func subscribeTransactionHelper(c *C, ackMode AckMode, version Version, abort bo
c.Assert(f5.Command, Equals, "ACK")
}
if version == V12 {
c.Assert(f5.Header.Get("id"), Equals, messageId)
c.Assert(f5.Header.Get(frame.Id), Equals, messageId)
} else {
c.Assert(f5.Header.Get("subscription"), Equals, id)
c.Assert(f5.Header.Get("message-id"), Equals, messageId)
Expand Down

0 comments on commit d0bea46

Please sign in to comment.