Closed dbluhm closed 4 years ago
Related Issue on RFC 0270: hyperledger/aries-rfcs#337
https://github.com/hyperledger/aries-rfcs/issues/337#issuecomment-562779805
Given @dhh1128's support expressed in the above comment, I'll merge this as a temporary solution to the ambiguity around backchannels to unblock progress on test development. The definition of backchannels will be revisited and the test suite code updated to reflect the resolution of those conversations.
Make Backchannel implementations pluggable. This affords greater flexibility to agent developers as they can use whatever mechanism makes sense for their agent to trigger actions. In the case of ACA-Py, for example, an backchannel that calls their REST API might be the most appropriate solution for testing whereas another agent might be better suited to an agent message style backchannel.
The "root" methods to a Backchannel are defined in
backchannel.py
in theprotocol_tests
directory. This includes the core functions of resetting the agent and establishing a new connection to be used in testing, as well as backchannel startup. Methods specific to starting off a protocol or for controlling actions taken next by the test subject within a protocol are defined in separate backchannel interfaces that reside alongside the tests for that protocol. Seeprotocol_tests/connection/backchannel.py
for a possible convention. Backchannel implementers will create a class that inherits from all relevant backchannel ABCs and implement the methods contained within those ABCs. Backchannels are dynamically loaded at startup based on the module path.Included is a
ManualBackchannel
, acting as both an example of implementing alternative backchannels and as a default implementation. This works much the same as the "manual" tests did before.This is a generalization of the alternate backchannel written by @Artemkaaas in #20. Instead of a generic
send
method with actions and an optional payload, I opted to use Abstract Base Classes to define the expected methods and inputs to those methods. I feel this will make it easier for others to implement their own backchannel as the interface is unambiguously defined. His work should be easily adaptable to match this structure.