Skip to content

Commit 40d150f

Browse files
Fix bug building connection options for amqps
1 parent 31f0a54 commit 40d150f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

selenium/test/amqp.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var container = require('rhea') // https://github.com/amqp/rhea
22
var fs = require('fs');
33
var path = require('path');
4+
var connectionOptions = getConnectionOptions()
45

56
function getAmqpConnectionOptions() {
67
return {
@@ -23,12 +24,14 @@ function getAmqpsConnectionOptions() {
2324
options['key'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_key.pem'))
2425
options['cert'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_certificate.pem'))
2526
options['ca'] = fs.readFileSync(path.resolve(certsLocation,'ca_rabbitmq_certificate.pem'))
27+
return options
2628
}
2729
function getConnectionOptions() {
28-
switch(process.env.RABBITMQ_AMQP_SCHEME || 'amqp'){
29-
case 'amqp':
30+
let scheme = process.env.RABBITMQ_AMQP_SCHEME || 'amqp'
31+
switch(scheme){
32+
case "amqp":
3033
return getAmqpConnectionOptions()
31-
case 'amqps':
34+
case "amqps":
3235
return getAmqpsConnectionOptions()
3336
}
3437
}
@@ -40,7 +43,7 @@ module.exports = {
4043
resolve()
4144
})
4245
})
43-
let connection = container.connect(getConnectionOptions())
46+
let connection = container.connect(connectionOptions)
4447
let receiver = connection.open_receiver({
4548
source: 'my-queue',
4649
target: 'receiver-target',

0 commit comments

Comments
 (0)