Skip to content
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

Open
61 tasks
chradek opened this issue Jul 17, 2020 · 2 comments
Open
61 tasks

[Ops] Add tests to project #58

chradek opened this issue Jul 17, 2020 · 2 comments

Comments

@chradek
Copy link
Collaborator

chradek commented Jul 17, 2020

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 and Session 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

  • Connection.open
    Ensure the connection is in an 'opened' state after Connection.open() yields.
  • Connection.close
    Ensure the connection is no longer in an 'opened' state after Connection.close() yields.
  • Connection.isOpen()
    Ensure isOpen() is true after Connection.open() yields.
  • Connection.isOpen()
    Ensure isOpen() is false after Connection.close() yields.
  • Connection.isRemoteOpen()
    Ensure isRemoteOpen() is true after Connection.open() yields.
  • Connection.isRemoteOpen()
    Ensure isRemoteOpen() is false after Connection.close() yields.
  • Connection.on('connectionOpen')
    Ensure the connection fires the connectionOpen event when Connection.open() is called.
  • Connection.on('connectionClose')
    Ensure the connection fires the connectionClose event when Connection.close() is called.
  • Connection.on('connectionError')
    Ensure the connection fires the connectionError event when service closes the connection with an error.
  • Connection.createSession()
    Ensure the session is created and in an open state.
  • Connection.createSender()
    Call createSender() without a session and ensure the sender is created and in an open state.
  • Connection.createSender()
    Call createSender() with a session and ensure the sender is created and in an open state.
  • Connection.createAwaitableSender()
    Ensure the sender is created and in an open state.
  • Connection.createReceiver()
    Ensure the receiver is created and in an open state.
  • Connection.createRequestResponseLink()
    Ensure the RequestResponseLink is created and in an open state.
  • Connection.removeSession()
    Create a session via Connection.createSession(), remove session via Connection.removeSession() and ensure session.remove() is called.

Session

  • Session.begin()
    Ensure the session fires the sessionOpen event.
  • Session.close()
    Ensure the session is fully closed after Session.close() yields.
  • Session.isOpen()
    Ensure isOpen() is true after connection.createSession resolves.
  • Session.isOpen()
    Ensure isOpen() is true after the sessionOpen event is fired.
  • Session.isClosed()
    Ensure isClosed() is true after Session.close() yields.
  • Session.isItselfClosed()
    Ensure isItselfClosed() is true after Session.close() yields.
  • Session.remove()
    Ensure the session does not have any event listeners registered.
  • Session.on('sessionOpen')
    Ensure the session fires the sessionOpen event after session.begin() is called.
  • Session.on('sessionClose')
    Ensure the session fires the sessionClose event after session.close() is called.
  • Session.connection
    Ensure session.connection matches the Connection used to instantiate the Session.
  • Session.createSender()
    Ensure the sender is created and in an open state.
  • Session.createAwaitableSender()
    Ensure the sender is created and in an open state.
  • Session.createReceiver()
    Ensure the receiver is created and in an open state.

RequestResponseLink

  • Connection.createRequestResponseLink()
    Call method without providedSession and ensure the return value includes the following fields,each in the open state:
    • session
    • sender
    • receiver
  • Connection.createRequestResponseLink()
    Call method with providedSession and ensure the session in the return value matches the session provided.

Sender

  • Sender.isOpen()
    Ensure isOpen() returns true after connection.createSender() resolves.
  • Sender.isRemoteOpen()
    Ensure isRemoteOpen() returns true after connection.createSender() resolves.
  • Sender.isClosed()
    Ensure isClosed returns true after sender.close() resolves.
  • Sender.isItselfClosed()
    Ensure isItselfClosed returns true after sender.close() resolves.
  • Sender.isSender()
    Ensure isSender() returns true.
  • Sender.isReceiver()
    Ensure isReceiver() returns false.
  • Sender.remove()
    Ensure the sender and the session do not have any event listeners registered.
  • Sender.close()
    Don't set closeSession, and ensure sender and session are closed.
  • Sender.close()
    Set closeSession to true, and ensure sender and session are closed.
  • Sender.close()
    Set closeSession to false, and ensure sender is closed and session is open.
  • Sender.name
    Returns the sender's name.
  • Sender.session
    Ensure the sender.session matches the Session used to instantiate the Sender.
  • Sender.connection
    Ensure the sender.connection matches the Connection used to instantiate the Sender.
  • Sender.setDrained()
    Ensure set_drained() is called on the rhea link.
  • Sender.sendable()
    Ensure sendable() is called on the rhea link.
  • Sender.send()
    Ensure send() is called on the rhea link with message, tag and format.

AwaitableSender

  • Sender.send()
    Ensure send is called on the rhea link with message, tag and format.

Receiver

  • Receiver.isOpen()
    Ensure isOpen() returns true after connection.createReceiver() resolves.
  • Receiver.isRemoteOpen()
    Ensure isRemoteOpen() returns true after connection.createReceiver() resolves.
  • Receiver.isClosed()
    Ensure isClosed returns true after receiver.close() resolves.
  • Receiver.isItselfClosed()
    Ensure isItselfClosed returns true after receiver.close() resolves.
  • Receiver.isSender()
    Ensure isSender() returns false.
  • Receiver.isReceiver()
    Ensure isReceiver() returns true.
  • Receiver.remove()
    Ensure the receiver and the session do not have any event listeners registered.
  • Receiver.close()
    Don't set closeSession, and ensure receiver and session are closed.
  • Receiver.close()
    Set closeSession to true, and ensure receiver and session are closed.
  • Receiver.close()
    Set closeSession to false, and ensure receiver is closed and session is open.
  • Receiver.name
    Returns the receiver's name.
  • Receiver.session
    Ensure the receiver.session matches the Session used to instantiate the Receiver.
  • Receiver.connection
    Ensure the receiver.connection matches the Connection used to instantiate the Receiver.
@jmealo
Copy link

jmealo commented Nov 20, 2020

@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.

@chradek
Copy link
Collaborator Author

chradek commented Nov 20, 2020

@jmealo
Can you log an issue on the azure-sdk-for-js repo since you're seeing this issue in the service-bus library? The service-bus library doesn't use rhea's built in reconnection logic so if you're seeing an error when reconnecting we'll want to investigate if there's an issue with the service-bus library first.

When you log the issue, any steps you can provide on how to reproduce (and any logs too!) would be very helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants