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

Test Harness Expansion to cover AIP 1.0 Protocol 0160-connection-protocol (Happy Path Only) #7

Closed
3 tasks done
nodlesh opened this issue Feb 5, 2020 · 4 comments
Closed
3 tasks done

Comments

@nodlesh
Copy link
Contributor

nodlesh commented Feb 5, 2020

AS AN Agent, I WANT to connect to another Agent, SO THAT we can do secure transactions together beyond this initial connection

Acceptance Criteria

Feature: Aries agent connection functions RFC 0160

Scenario: establish a connection between two agents
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection response
And "Alice" accepts the connection response
And "Bob" sends a response ping
And "Alice" receives the response ping
Then "Alice" and "Bob" have a connection

Question: The RFC states "The inviter sends a connection-response message at the end of the share phase" How is this captured here? It seems there might be some confusion here. Not sure if the Protocol Implemented needs to change or just tests?
Here is my rewrite of the scenario above based on how I see the RFC.

tags: P1 AcceptanceTest NeedsReview Automated
Scenario: establish a connection between two agents
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And "Alice" receives the connection request
And "Alice" sends a connection response
And "Bob" sends a response ping
And "Alice" receives the response ping

Then "Alice" and "Bob" have a connection

tags: P1 AcceptanceTest NeedsReview Automated
Scenario: Connection established between two agents and inviter gets a preceding message
Given we have two agents "Alice" and "Bob"
And Bob has sent a connection request to Alice
And Alice has accepted the connection request by sending a connection response
And Bob is in the state of complete
And Alice is in the state of responded
When Bob sends [message]
Then Alice is in the state of complete

Examples:
| message |
| acks |

tags: SingleUseInvite P2 ExceptionTest NeedsReview Automated
Scenario: Inviter Sends invitation for one agent second agent tries after connection
Given we have three agents "Alice", "Bob", and "Frank"
And "Alice" generated a single-use connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
And "Alice" accepts the connection request by sending a connection response
And "Alice" and "Bob" have a connection
When "Frank" sends a connection request based on the connection invitation
Then "Alice" sends a request_not_accepted error

tags: SingleUseInvite P2 ExceptionTest NeedsReview Automated
Scenario: Inviter Sends invitation for one agent second agent tries during first share phase
Given we have three agents "Alice", "Bob", and "Frank"
And "Alice" generated a single-use connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
When "Frank" sends a connection request based on the connection invitation
Then "Alice" sends a request_not_accepted error

tags: MultiUseInvite P3 DerivedFunctionalTest NeedsReview
Scenario: Inviter Sends invitation for multiple agents
Given we have three agents "Alice", "Bob", and "Frank"
And "Alice" generated a single-use connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
And "Alice" sent a connection response to "Bob"
When "Frank" sends a connection request based on the connection invitation
Then "Alice" sent a connection response to "Frank"

tags: MultiUseInvite P3 DerivedFunctionalTest NeedsReview
Scenario: Inviter Sends invitation for multiple agents completing connections for both
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And "Frank" receives the connection invitation
And "Frank" sends a connection request
And "Alice" accepts the connection request of "Bob" by sending a connection response
And "Alice" accepts the connection request of "Frank" by sending a connection response
Then "Alice" and "Bob" have a connection
And "Alice" and "Frank" have a connection

Question: Are invitations generic or specific to the intended invitee?
Answer: There can be two types single-use for one invitee or multi-use for more than one invitee. With a single-use invite it is generic at first, then at that point the invitation connection request, that invite can no longer be used.

Scenario: Inviter Sends invitations to an agent and never gets a connection request from them
Question: Does the invitee stay invited perpetually, what is the lifespan of an invite?
Answer: That's business logic. In theory (and to this point, in practice), there is no time limit on them. However, that could be logic applied by the controller. But inherently, there is no time limit from an RFC perspective.

tags: P3 NegativeTest NeedsReview
Scenario: Inviter gets connection request but invitee is offline for connection response
Given "Alice" and "Bob" do not have an existing connection
And "Alice" has generated a connection invitation
And "Bob" has received a connection invitation
And "Bob" sends a connection request
And "Bob" goes offline
And "Alice sends a connection response
When "Bob" comes online
And Bob resends a connection request
Then Alice and Bob can successfully complete the connection
Question: Connection Protocol again. What happens if one of the agents is offline during the invite or share phase? Ian mentioned that there may be 2 scenarios. 1. Agent might retry a few (3?) times. 2 There may be a "routing agent" in between. Assuming RFC for mediators and relays take up the slack here but that protocol is not included in AIP1.0. Is this another case where its up to the business to decide what happens here and not part of the AIP 1.0 Protocols RFCs?
Answer: For the mobile use case, there will be a mediator to handle the offline use case -- the sender never knows. All messages are async and no expectations are set on the time to reply at the RFC level. That would be a business question. Where it's an unexpected offline scenario, any sort of retry strategy would be up to the agent. At this point, I'm not aware of any agents that have gotten into that.

Scenario: Invitee sends connection response but inviter is offline
Scenario: Invitee sends new invitation after a preceding one
Question: Since the new invitation "supersedes" the old one, does that mean the old one will no longer work? Depends on the agent. up to implementation
**Answer:**Actually not sure you should worry about it. I think the language is clear enough that it might be up to the business. Its in the state table in the invitation column "No Change (resend or new invite that supersedes)"

tags: P3 DerivedFunctionalTest NeedsReview
Scenario: Establish a connection between two agents who already have a connection
Given we have two agents "Alice" and "Bob"
And "Alice" and "Bob" have an existing connection
When "Alice" generates a connection invitation
And they complete the connection process
Then Alice and Bob have another connection

tags: P4 DerivedFunctionalTest NeedsReview
Scenario: Establish a connection between two agents who already have a connection initiated from invitee
Given we have two agents "Alice" and "Bob"
And "Alice" and "Bob" have an existing connection
When "Bob" generates a connection invitation
And they complete the connection process
Then Alice and Bob have another connection

Question: Should I change the following 2 to an acknowledgement, trust ping isn't implemented? Maybe Move this to the ack suite?
Scenario: send a trust ping between two agents
Given "Alice" and "Bob" have an existing connection
When "Alice" sends a trust ping
Then "Bob" receives the trust ping

Maybe Move this to the ack suite?
Scenario: Send an acks between two agents that do not have a connection
Given "Alice" and "Bob" do not have an existing connection
When "Alice" sends a acks
Then "Alice" receives
Then "Bob" doesn't receive a response?

Question: Can we check the states of the Agents through the backchannel?
Answer: Yes we can.

tags: P2 AcceptanceTest NeedsReview
Scenario: Inviter sends an Invitation to Invitee
Given "Alice" and "Bob" do not have an existing connection
When "Alice" sends generates a connection Invitation
Then "Alice" is in the state of invited

tags: P2 AcceptanceTest NeedsReview
Scenario: Invitee receives an Invitation
Given "Alice" and "Bob" do not have an existing connection
And "Alice" has generated a connection invitation
When "Bob" receives the connection Invitation
Then "Bob" is in the state of invited

tags: P2 AcceptanceTest NeedsReview
Scenario: Invitee sends a connection request
Given "Alice" and "Bob" do not have an existing connection
And "Alice" has generated a connection invitation
And Bob has received a connection invitation
When "Bob" sends a connection request
Then "Bob" is in the state of requested
And "Alice" is in the state of invited

tags: P2 AcceptanceTest NeedsReview
Scenario: Inviter sends a connection response
Given "Alice" and "Bob" do not have an existing connection
And "Alice" has generated a connection invitation
And Bob has received a connection invitation
And Bob has sent a connection request
When "Alice" sends a connection response
Then "Alice" is in the state of responded
And "Bob" is in the state of complete or responded?

Error Conditions

The following tests may need to be split into Retryable and SingleTry. The states are different based on each. If retryable, the tests would need to capture how many times the agent will retry to run the test effectively.
tags: T007-API10-RFC0160 P2 ExceptionTest SingleTryOnException NeedsReview
Scenario: Establish a connection between two agents but gets a request not accepted report problem message
Given we have two agents "Alice" and "Bob"
And Bob has [problem]
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
Then Alice sends an request not accepted error
And the state of Alice is reset to Null?
And the state of Bob is reset to Null?

Examples:
| problem |
| Invalid DID Method |
| unknown endpoint protocols |
| ? |

Scenario: Retry to Establish a connection between two agents that previously had a request not accepted report problem message
Given we have two agents "Alice" and "Bob"
And a request not accepted was issued by Alice in a previous connection attempt
And Bob has fixed his [problem]
When "Bob" sends a connection request
Then they can complete the connection successfully

Examples:
| problem |
| Invalid DID Method |
| unknown endpoint protocols |
| ? |

Scenario: Establish a connection between two agents but gets a request processing error report problem message
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And Alice has a problem processing the connection request (What conditions?)
Then Alice sends a request processing error

Scenario: Establish a connection between two agents that had a request processing error report problem and Invitee retries
Given we have two agents "Alice" and "Bob"
And "Alice" has generated a connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
And Alice sent a request processing error
When Bob retries sending the connection request
Then they can complete the connection successfully

Scenario: Establish a connection between two agents but gets a response not accepted report problem message
Given we have two agents "Alice" and "Bob"
And Bob has a [problem]
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
Then Alice has sends a response not accepted report problem
And the report contains the reason for the [problem]

Examples:
| problem |
| not accepting the method of the provided DID |
| unknown endpoint protocols |
| invalid signature |
| ? |

Scenario: Retry to establish a connection between two agents that had a response not accepted report problem message
Given we have two agents "Alice" and "Bob"
And Bob has a [problem]
And "Alice" generated a connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
And Alice has sent a response not accepted report problem
When Bob corrects the [problem]
And retires the connection request
Then they can complete the connection successfully

Examples:
| problem |
| not accepting the method of the provided DID |
| unknown endpoint protocols |
| invalid signature |
| ? |

Scenario: Establish a connection between two agents but gets a response processing error report problem message
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And Alice sends the connection response
And Bob has a [problem] processing the connection response (What conditions?)
Then Bob sends a request processing error

Scenario: Retry to establish a connection between two agents that had a response processing error report problem message
Given we have two agents "Alice" and "Bob"
And "Alice" generated a connection invitation
And "Bob" received the connection invitation
And "Bob" sent a connection request
And Alice sent the connection response
And Bob had a [problem] processing the connection response (What conditions?)
And Bob sends a request processing error
When Alice retries the connection response
Then they can complete the connection successfully

Question How can the tests force an unknown error report problem?
Scenario: Establish a connection between two agents but gets a unknown error report problem message
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And Alice sends the connection response
And Bob has a [problem] processing the connection response (What problems?)
Then Bob sends an unknown error

Question Can either party retry the last communication to continue the connection process after an unknown error or does the process have to restart?
Scenario: Retry to establish a connection between two agents that had an unknown error report problem message

No errors are sent in timeout situations. If the inviter or invitee wishes to retract the messages they sent, they record so locally and return a request_not_accepted or response_not_accepted error when the other party sends a request or response .
Scenario: Established connection between two agents but Inviter retracts/terminates the connection
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Alice" retracts the invitation
When "Bob" sends a connection request
Then "Alice" sends a request_not_accepted error

Scenario: Established connection between two agents but Invitee retracts/terminates the connection
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends a connection request
And "Bob" terminates the connection
And "Alice" accepts the connection request by sending a connection response
Then "Bob" sends a response_not_accepted error

Scenario: Attempt to established connection between two agents where the Inviter has retracted the connection
Given we have two agents "Alice" and "Bob"
And Alice has [retracted the connection]
When "Bob" generates a connection invitation
Then "Alice" sends a request_not_accepted error

Examples:
| retracted the connection |
| sent a request not accepted error during a previous connection attempt |
| retracted the connection after a successful connection was made |

Scenario: Attempt to established connection between two agents where the Invitee has retracted the connection
Given we have two agents "Alice" and "Bob"
And Bob has [retracted the connection]
When "Alice" generates a connection invitation
Then "Bob" sends a request_not_accepted error

Examples:
| retracted the connection |
| sent a response not accepted error during a previous connection attempt |
| retracted the connection after a successful connection was made |

Negative Conditions

Scenario: Invitee sends unexpected message during share phase
Given we have two agents "Alice" and "Bob"
When "Alice" generates a connection invitation
And "Bob" receives the connection invitation
And "Bob" sends an [unexpected message]
Then "Alice sends What?
Question: can they continue the proper connection procedure after the unexpected message?

Examples:
| unexpected message |
| ack |

Scenario: Inviter sends unexpected message during share phase
Question: What happens if before Alice gets in the complete state Bob initiates a connection with an invitation in turn becoming an Inviter? Are all other previous messages and states ignored and the process starts over? It's a separate connection. Low priority.

References:
0160-connection-protocol from the Aries Interop Profile

  • Get the Aries Test Harness Working

  • Write All Gherkin Test Definitions

  • Implement the Step Defs for the Tests

@swcurran
Copy link
Member

swcurran commented Feb 7, 2020

The answer to your question is that yes, your rewrite is appropriate.

The use of the "trust ping" after the connection is not a requirement and is problematic. The need for it is because there is not an "ACK" back to the invitee to say that the connection is established. Further, "trust ping" itself was dropped from AIP 1.0. I'm not exactly sure what we need to do about that.

For now we can leave it at that, but this is something we need to figure out as the use of this spreads out.

@nodlesh
Copy link
Contributor Author

nodlesh commented Feb 7, 2020

Ok, Thanks @swcurran, I'll remove the pings and call it connected after the connection response.

There was another question above asking if the State can be determined at any point through the backchannel or otherwise. I need to know if checking state can be accomplished in the tests. I'm assuming yes, and that there should be a set of test scenarios to check proper state after each interaction between agents.

@nodlesh nodlesh changed the title Test Harness Expansion to cover AIP 1.0.0 Protocol 0160-connection-protocol Test Harness Expansion to cover AIP 1.0 Protocol 0160-connection-protocol Feb 7, 2020
@swcurran
Copy link
Member

swcurran commented Feb 7, 2020 via email

@nodlesh
Copy link
Contributor Author

nodlesh commented Feb 7, 2020 via email

@nodlesh nodlesh changed the title Test Harness Expansion to cover AIP 1.0 Protocol 0160-connection-protocol Test Harness Expansion to cover AIP 1.0 Protocol 0160-connection-protocol (Happy Path Only) Apr 29, 2020
swcurran pushed a commit that referenced this issue Jun 23, 2020
…tions

initial happy path feature file for present proof
@ianco ianco closed this as completed Sep 8, 2020
swcurran pushed a commit that referenced this issue Sep 18, 2020
Matt-Spence pushed a commit to Matt-Spence/aries-agent-test-harness that referenced this issue Jun 29, 2021
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

3 participants