Tests: internal/notify
internal/notify · 8 tests
Each test is named for the property it holds, and runs against a real deployment: there is no mock of the database and no arm that skips when it is absent. The sentence is the test's name read back; the name is what go test -run takes.
notify_test.go
- Nothing is sent until an operator says where and never into the deployments own network —
TestNothingIsSentUntilAnOperatorSaysWhereAndNeverIntoTheDeploymentsOwnNetwork. ── #49's egress ────────────────────────────────────────────────────────────────────────────── A notification goes to an address a customer supplies, from inside whatever network this deployment runs in. - A signature fails on one altered byte and on a delivery replayed later —
TestASignatureFailsOnOneAlteredByteAndOnADeliveryReplayedLater. ── #49's signature ─────────────────────────────────────────────────────────────────────────── A receiver must be able to tell our call from anybody's, and must not be fooled by one of ours replayed later. - A sender refuses a destination that has started resolving somewhere else —
TestASenderRefusesADestinationThatHasStartedResolvingSomewhereElse. The destination is checked again at the moment of sending, not only when it was registered. - The operators configuration is off until it says otherwise —
TestTheOperatorsConfigurationIsOffUntilItSaysOtherwise. What an operator's two variables mean, including the case where they mean nothing. - A redirect from a permitted destination is never followed —
TestARedirectFromAPermittedDestinationIsNeverFollowed. ── #233: a permitted destination cannot choose a second one ───────────────────────────────── A redirect from a listed host is answered, never followed, whatever it points at — here another listener on this machine, standing for the deployment's own network. - A rebinding answer is refused on the address actually dialled —
TestARebindingAnswerIsRefusedOnTheAddressActuallyDialled. The check before sending resolves the name; the connection resolves it again. - A failure is stored as a category that names no address —
TestAFailureIsStoredAsACategoryThatNamesNoAddress. What a delivery's failure is stored as: a category an owner can act on, and never the transport's own words, which name the address and port a destination led to. - A transport the sender cannot guard is replaced not trusted —
TestATransportTheSenderCannotGuardIsReplacedNotTrusted. A client whose transport the sender cannot put its checks into is not trusted with a delivery: its transport is replaced, and the replacement is logged rather than silent.