Skip to content

Commit f31ee42

Browse files
DanielePalaiaDaniele Palaia
andauthored
adding integration test for issue 11 (#50)
Co-authored-by: Daniele Palaia <[email protected]>
1 parent d25e3e5 commit f31ee42

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

integration_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Use of this source code is governed by a BSD-style
44
// license that can be found in the LICENSE file.
55

6+
//go:build integration
67
// +build integration
78

89
package amqp091
@@ -1909,6 +1910,31 @@ func assertConsumeBody(t *testing.T, messages <-chan Delivery, want []byte) (msg
19091910
return msg
19101911
}
19111912

1913+
// https://github.com/rabbitmq/amqp091-go/issues/11
1914+
func TestShouldNotWaitAfterConnectionClosedNewChannelCreatedIssue11(t *testing.T) {
1915+
conn := integrationConnection(t, "TestShouldNotWaitAfterConnectionClosedNewChannelCreatedIssue11")
1916+
ch, err := conn.Channel()
1917+
if err != nil {
1918+
t.Fatalf("channel error: %v", err)
1919+
}
1920+
1921+
conn.NotifyClose(make(chan *Error, 1))
1922+
1923+
_, err = ch.PublishWithDeferredConfirm("issue11", "issue11", false, false, Publishing{Body: []byte("abc")})
1924+
if err != nil {
1925+
t.Fatalf("PublishWithDeferredConfirm error: %v", err)
1926+
}
1927+
1928+
ch.Close()
1929+
conn.Close()
1930+
1931+
ch, err = conn.Channel()
1932+
if err == nil {
1933+
t.Fatalf("Opening a channel from a closed connection should not block but returning an error %v", err)
1934+
}
1935+
1936+
}
1937+
19121938
// Pulls out the CRC and verifies the remaining content against the CRC
19131939
func assertMessageCrc32(t *testing.T, msg []byte, assert string) {
19141940
size := binary.BigEndian.Uint32(msg[:4])

0 commit comments

Comments
 (0)