11const assert = require ( 'assert' )
22const { log, tokenFor, openIdConfiguration } = require ( '../utils' )
33const { reset, expectUser, expectVhost, expectResource, allow, verifyAll } = require ( '../mock_http_backend' )
4- const { getAmqpConnectionOptions : amqpOptions , open : openAmqp , once : onceAmqp , on : onAmqp , close : closeAmqp } = require ( '../amqp' )
4+ const { getAmqpConnectionOptions : getAmqpOptions ,
5+ setAmqpConnectionOptions : setAmqpOptions ,
6+ open : openAmqp , once : onceAmqp , on : onAmqp , close : closeAmqp } = require ( '../amqp' )
57
68var receivedAmqpMessageCount = 0
79var untilConnectionEstablished = new Promise ( ( resolve , reject ) => {
@@ -31,7 +33,7 @@ describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' +
3133 let password = process . env . RABBITMQ_AMQP_PASSWORD
3234 let usemtls = process . env . AMQP_USE_MTLS
3335 let amqp ;
34- let amqpSettings = amqpOptions ( )
36+ let amqpSettings = getAmqpOptions ( )
3537
3638 before ( function ( ) {
3739 if ( backends . includes ( "http" ) && ( username . includes ( "http" ) || usemtls ) ) {
@@ -55,14 +57,15 @@ describe('Having AMQP 1.0 protocol enabled and the following auth_backends: ' +
5557 log ( "oauthClientSecret : " + oauthClientSecret )
5658 let openIdConfig = openIdConfiguration ( oauthProviderUrl )
5759 log ( "Obtained token_endpoint : " + openIdConfig . token_endpoint )
58- password = tokenFor ( oauthClientId , oauthClientSecret , openIdConfig . token_endpoint , tokenFormat )
60+ password = tokenFor ( oauthClientId , oauthClientSecret , openIdConfig . token_endpoint )
5961 log ( "Obtained access token : " + password )
6062 amqpSettings . password = password
63+ setAmqpOptions ( amqpSettings )
6164 }
6265 } )
6366
6467 it ( 'can open an AMQP 1.0 connection' , async function ( ) {
65- amqp = openAmqp ( "mq-queue" , amqpSettings )
68+ amqp = openAmqp ( )
6669 await untilConnectionEstablished
6770 var untilMessageReceived = new Promise ( ( resolve , reject ) => {
6871 onAmqp ( 'message' , function ( context ) {
0 commit comments