2018-01-01 18:55:59 +00:00
# Ricochet Testing Specification
This documents outlines each scenario this library must correctly handle and
links it to the automated test that exercises that functionality.
2018-01-03 18:11:56 +00:00
# Version Negotiation
2018-01-01 18:55:59 +00:00
2018-01-03 18:11:56 +00:00
## Open
File: [iricochet_test.go ](./ricochet_test.go )
2018-01-03 18:20:53 +00:00
This stub test exercises the Open() function. `TestRicochetOpen` , and in cases where the server returns a bad version, `TestRicochetOpenWithError` , and where there is no server at all `TestRicochetOpenWithNoServer` - in both cases Open should return an error.
2018-01-03 18:11:56 +00:00
## Inbound
2018-01-01 18:55:59 +00:00
2018-01-02 17:23:20 +00:00
File: [inbound_version_negotiation_test.go ](./inbound_version_negotiation_test.go )
2018-01-01 18:55:59 +00:00
### Invalid Protocol
If the inbound listener receives:
* Less than 4 bytes (`TestBadProtcolLength`)
* The first 2 bytes are not equal ot 0x49 and 0x4D
* A number of supported Versions < 1 (`TestNoSupportedVersions`, `TestInvalidVersionList` )
Then it must close the connection.
### No Compatible Version Found
If the inbound listener does not receive a compatible version in the list of
supported versions. Then is must close the connection. `TestNoCompatibleVersions`
### Successful Version Negotiation
Assuming the inbound listener receives a valid protocol message, and that message
2018-01-03 18:11:56 +00:00
contains a known supported version. Then the connection should remain open. `TestNegotiateInboundVersions`
2018-01-01 18:55:59 +00:00
2018-01-03 18:11:56 +00:00
## Outbound
2018-01-02 17:23:20 +00:00
File: [outbound_version_negotiation_test.go ](./outbound_version_negotiation_test.go )
### No Compatible Version Found
If the outbound connection receives a response that does not match one of the versions
2018-01-03 18:11:56 +00:00
they sent out in their supporting list. Then then must close the connection `TestInvalidResponse` , `TestInvalidServer`
2018-01-02 17:23:20 +00:00
### Successful Version Negotiation
Assuming the outbound connection receives a valid protocol message, and that message
2018-01-03 18:11:56 +00:00
contains a known supported version. Then the connection should remain open. `TestOutboundVersionNegotiation`
2018-01-02 17:23:20 +00:00