Skip to content

Commit

Permalink
Merge pull request #12847 from rabbitmq/add-missing-nodejs-module
Browse files Browse the repository at this point in the history
Fix issues in amqp10
  • Loading branch information
michaelklishin authored Nov 28, 2024
2 parents c4d9a84 + 1d8b28d commit 7b2f5fb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test-authnz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ on:
- .github/workflows/test-authnz.yaml
pull_request:
paths:
- 'selenium/**'
- 'deps/rabbit/**'
- 'deps/rabbitmq_auth_/**'
- 'deps/rabbitmq_mqtt/**'
- 'deps/rabbitmq_management/selenium/full-suite-authnz-messaging'
- 'deps/rabbitmq_management/selenium/suites/authnz-messaging/**'
- 'deps/rabbitmq_management/selenium/test/authnz-msg-protocols/**'
- .github/workflows/test-authnz.yaml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
17 changes: 10 additions & 7 deletions selenium/test/amqp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var container = require('rhea') // https://github.com/amqp/rhea
var fs = require('fs');
var path = require('path');
var connectionOptions = getConnectionOptions()

function getAmqpConnectionOptions() {
return {
Expand All @@ -19,16 +20,18 @@ function getAmqpsConnectionOptions() {
options['enable_sasl_external'] = true
}
options['transport'] = 'tls'
let certsLocation = getEnv("RABBITMQ_CERTS");
let certsLocation = process.env.RABBITMQ_CERTS
options['key'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_key.pem'))
options['cert'] = fs.readFileSync(path.resolve(certsLocation,'client_rabbitmq_certificate.pem'))
options['ca'] = fs.readFileSync(path.resolve(certsLocation,'ca_rabbitmq_certificate.pem'))
return options
}
function getConnectionOptions() {
switch(process.env.RABBITMQ_AMQP_SCHEME || 'amqp'){
case 'amqp':
let scheme = process.env.RABBITMQ_AMQP_SCHEME || 'amqp'
switch(scheme){
case "amqp":
return getAmqpConnectionOptions()
case 'amqps':
case "amqps":
return getAmqpsConnectionOptions()
}
}
Expand All @@ -40,14 +43,14 @@ module.exports = {
resolve()
})
})
let connection = container.connect(getConnectionOptions())
let connection = container.connect(connectionOptions)
let receiver = connection.open_receiver({
source: 'examples',
source: 'my-queue',
target: 'receiver-target',
name: 'receiver-link'
})
let sender = connection.open_sender({
target: 'examples',
target: 'my-queue',
source: 'sender-source',
name: 'sender-link'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
let sessions = await connectionPage.getSessions()
assert.equal(1, sessions.sessions.length)
let session = connectionPage.getSessionInfo(sessions.sessions, 0)
//console.log("session: " + JSON.stringify(session))
assert.equal(0, session.channelNumber)
assert.equal(1, session.nextIncomingId)
assert.equal(0, session.outgoingUnsettledDeliveries)
Expand All @@ -70,20 +69,18 @@ describe('Given an amqp10 connection opened, listed and clicked on it', function
assert.equal(1, sessions.outgoing_links.length)

let incomingLink = connectionPage.getIncomingLinkInfo(sessions.incoming_links, 0)
//console.log("incomingLink: " + JSON.stringify(incomingLink))
assert.equal(1, incomingLink.handle)
assert.equal("sender-link", incomingLink.name)
assert.equal("examples", incomingLink.targetAddress)
assert.equal("my-queue", incomingLink.targetAddress)
assert.equal("mixed", incomingLink.sndSettleMode)
assert.equal("0", incomingLink.unconfirmedMessages)
assert.equal(1, incomingLink.deliveryCount)

let outgoingLink = connectionPage.getOutgoingLinkInfo(sessions.outgoing_links, 0)
//console.log("outgoingLink: " + JSON.stringify(outgoingLink))
assert.equal(0, outgoingLink.handle)
assert.equal("receiver-link", outgoingLink.name)
assert.equal("examples", outgoingLink.sourceAddress)
assert.equal("examples", outgoingLink.queueName)
assert.equal("my-queue", outgoingLink.sourceAddress)
assert.equal("my-queue", outgoingLink.queueName)

assert.equal(false, outgoingLink.sendSettled)
assert.equal("unlimited", outgoingLink.maxMessageSize)
Expand Down

0 comments on commit 7b2f5fb

Please sign in to comment.