-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ops] Add tests to project #58
Comments
@richardpark-msft: @chradek: I'm having issues with reconnections in production using the preview service-bus library that uses rhea-promise (they don't occur). The listeners stop processing messages at some point. No errors are raised through the public interfaces. It doesn't look like there is any test coverage for that working correctly. |
@jmealo When you log the issue, any steps you can provide on how to reproduce (and any logs too!) would be very helpful! |
I'd like to propose some tests that we can add to this project so that updates can be made with higher confidence that they don't change the existing behaviour.
My wish-list would be to have high coverage of the public APIs exported by this package. I'll create a PR that updates the npm test script to run mocha against some
Connection
andSession
tests as a base to build on. (I chose mocha to match what rhea is using.)Here's a list of tests I think should be added based on the API that's exposed today. This list doesn't cover 100% of the API (some error validation would be nice) but should at least cover the happy path.
Connection
Ensure the connection is in an 'opened' state after Connection.open() yields.
Ensure the connection is no longer in an 'opened' state after Connection.close() yields.
Ensure
isOpen()
istrue
afterConnection.open()
yields.Ensure
isOpen()
isfalse
afterConnection.close()
yields.Ensure
isRemoteOpen()
istrue
afterConnection.open()
yields.Ensure
isRemoteOpen()
isfalse
afterConnection.close()
yields.Ensure the connection fires the
connectionOpen
event whenConnection.open()
is called.Ensure the connection fires the
connectionClose
event whenConnection.close()
is called.Ensure the connection fires the
connectionError
event when service closes the connection with an error.Ensure the session is created and in an
open
state.Call
createSender()
without a session and ensure the sender is created and in anopen
state.Call
createSender()
with a session and ensure the sender is created and in anopen
state.Ensure the sender is created and in an
open
state.Ensure the receiver is created and in an
open
state.Ensure the RequestResponseLink is created and in an
open
state.Create a session via
Connection.createSession()
, remove session viaConnection.removeSession()
and ensuresession.remove()
is called.Session
Ensure the session fires the
sessionOpen
event.Ensure the session is fully closed after
Session.close()
yields.Ensure
isOpen()
istrue
afterconnection.createSession
resolves.Ensure
isOpen()
istrue
after thesessionOpen
event is fired.Ensure
isClosed()
istrue
afterSession.close()
yields.Ensure
isItselfClosed()
istrue
afterSession.close()
yields.Ensure the session does not have any event listeners registered.
Ensure the session fires the
sessionOpen
event aftersession.begin()
is called.Ensure the session fires the
sessionClose
event aftersession.close()
is called.Ensure
session.connection
matches theConnection
used to instantiate theSession
.Ensure the sender is created and in an
open
state.Ensure the sender is created and in an
open
state.Ensure the receiver is created and in an
open
state.RequestResponseLink
Call method without
providedSession
and ensure the return value includes the following fields,each in theopen
state:session
sender
receiver
Call method with
providedSession
and ensure thesession
in the return value matches thesession
provided.Sender
Ensure
isOpen()
returnstrue
afterconnection.createSender()
resolves.Ensure
isRemoteOpen()
returnstrue
afterconnection.createSender()
resolves.Ensure
isClosed
returnstrue
aftersender.close()
resolves.Ensure
isItselfClosed
returnstrue
aftersender.close()
resolves.Ensure
isSender()
returns true.Ensure
isReceiver()
returns false.Ensure the
sender
and thesession
do not have any event listeners registered.Don't set
closeSession
, and ensuresender
andsession
are closed.Set
closeSession
totrue
, and ensuresender
andsession
are closed.Set
closeSession
tofalse
, and ensuresender
is closed andsession
is open.Returns the sender's name.
Ensure the
sender.session
matches theSession
used to instantiate theSender
.Ensure the
sender.connection
matches theConnection
used to instantiate theSender
.Ensure
set_drained()
is called on the rhea link.Ensure
sendable()
is called on the rhea link.Ensure
send()
is called on the rhea link with message, tag and format.AwaitableSender
Ensure
send
is called on the rhea link with message, tag and format.Receiver
Ensure
isOpen()
returnstrue
afterconnection.createReceiver()
resolves.Ensure
isRemoteOpen()
returnstrue
afterconnection.createReceiver()
resolves.Ensure
isClosed
returnstrue
afterreceiver.close()
resolves.Ensure
isItselfClosed
returnstrue
afterreceiver.close()
resolves.Ensure
isSender()
returnsfalse
.Ensure
isReceiver()
returnstrue
.Ensure the
receiver
and thesession
do not have any event listeners registered.Don't set
closeSession
, and ensurereceiver
andsession
are closed.Set
closeSession
totrue
, and ensurereceiver
andsession
are closed.Set
closeSession
tofalse
, and ensurereceiver
is closed andsession
is open.Returns the receiver's name.
Ensure the
receiver.session
matches theSession
used to instantiate theReceiver
.Ensure the
receiver.connection
matches theConnection
used to instantiate theReceiver
.The text was updated successfully, but these errors were encountered: