Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/rabbitmqamqp/amqp_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ func (a *AmqpConnection) open(ctx context.Context, address string, connOptions *
WriteTimeout: connOptions.WriteTimeout,
}
azureConnection, err = amqp.Dial(ctx, address, amqpLiteConnOptions)
if err != nil && (connOptions.TLSConfig != nil || uri.Scheme == AMQPS) {
Error("Failed to open TLS connection", fmt.Sprintf("%s://%s", uri.Scheme, uri.Host), err, "ID", connOptions.Id)
return fmt.Errorf("failed to open TLS connection: %w", err)
}
if err != nil {
Error("Failed to open connection", ExtractWithoutPassword(address), err, "ID", connOptions.Id)
return fmt.Errorf("failed to open connection: %w", err)
Expand Down
12 changes: 12 additions & 0 deletions pkg/rabbitmqamqp/amqp_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,16 @@ var _ = Describe("AMQP connection Test", func() {
}()
})

Describe("AMQP TLS connection should fail with error.", func() {
tlsConfig := &tls.Config{}

// Dial the AMQP server with TLS configuration
connection, err := Dial(context.Background(), "amqps://does_not_exist:5671", &AmqpConnOptions{
TLSConfig: tlsConfig,
})
Expect(connection).To(BeNil())
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("failed to open TLS connection"))
})

})
1 change: 1 addition & 0 deletions pkg/rabbitmqamqp/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

// public consts

const AMQPS = "amqps"
const StreamFilterValue = "x-stream-filter-value"

const (
Expand Down
Loading