Tasty Test Results

All 34 tests passed (0.31s)

  • Tests

    • BrokerTests

      • the show instance of BrokerResult makes sense
      • when a broker message box creation throws an exception, the exception is returned in a Left...
      • when a broker message box input creation throws an exception, the exception is returned in a Left...
      • when the receive function throws a synchronous exception, then waiting on the broker will return the exception
      • when evaluation of an incoming message causes an exception, then the broker ignores the error and continues
      • when evaluation of the first incoming message causes an async exception, then the broker exits with that exception
      • when a broker is cancelled while waiting for the first message, then the broker exits with AsyncCancelled
      • when a broker receives a message for a missing resource, it silently drops the message
      • when an empty broker receives a start message without payload and the creator callback throws an exception, a normal message for that key will be ignored, no cleanup is performed, and the broker lives on
      • when an empty broker receives a start message with a payload and when the MessageHandler callback throws an exception when applied to that payload, cleanup is performed once, and incoming messages for that key will be ignored, and the broker lives on (0.01s)
      • when 3 resources are initialized and then the broker is cancelled, cleanup is performed foreach resource. (0.02s)
      • when 3 resources are initialized and then the broker is cancelled, cleanup is performed foreach resource, even if exceptions are thrown from the cleanup callbacks (0.02s)
      • when 2 resources are added and while adding a 3rd an async exception is thrown when handling the initial message, then the broker cleans up the 3 resources and exists
      • when adding a new resource with an extra initial message, when the messageHandler returns KeepResource, then the resource returned from the create callback is passed to the cleanup function
      • when adding a new resource with an extra initial message, when the messageHandler returns (UpdateResource x), then x is passed to the cleanup function (0.10s)
      • when adding a new resource with an extra initial message, when the messageHandler returns (RemoveResource Nothing), then the initial resource is passed to the cleanup function
      • when adding a new resource with an extra initial message, when the messageHandler returns (RemoveResource (Just x)), then x is passed to the cleanup function
      • when adding a new resource without an extra initial message, then the initial resource is passed to the cleanup function (0.10s)
      • on a broker with two resources a and b with keys 1 and 2, for an incoming message with key=1 the MessageDispatcher is called with resource a and for key=2 with resource b
      • When the MessageDispatcher is called with resource x and returns (UpdateResource y), then next time it is called with resource y
      • when the receive function throws a synchronous exception x, then all resources will be cleaned up and the broker will re-throw x
      • when the receive function returns Nothing, then all resources will be cleaned up and the broker will exit.
      • when an initialisation message without payload for an existant resource is received, the message is ignored
      • when an initialisation message with payload, then after the resource creation is done, the payload is dispatched to the messageDispatcher
    • Pool

      • empty pool

        • when broker creation throws an exception, the process doesn't block and returns an error
        • when receiving from the pool input throws an exception, the pool exits with that exception
      • non-empty pool

        • when delivering an Initialize, the worker callback is executed in a new process
        • when delivering an Initialize and the worker message box creation fails, the worker will be cleaned up and not be in the pool
        • when delivering an Initialize and the worker message box input creation fails, the worker will be cleaned up and not be in the pool
        • when delivering an 'Initialize (Just Nothing)', the worker will be cleaned up and not be in the pool (0.01s)
        • when several workers are initialized with different keys, all are created and available in the pool.
        • when 'Dispatch k (Just x)' is delivered, and a worker k exists, the worker will receive the message x, otherwise it will silently be dropped. (0.01s)
        • when Dispatch k Nothing is delivered, and a worker k exists, the worker will be cleaned up and removed from the pool (0.01s)
        • when 'deliver' to a worker message box returns False, the worker is removed (and cancelled) (0.01s)